From 3fd30989cd7512804f276e8d988b50800c31ffd7 Mon Sep 17 00:00:00 2001 From: missytake Date: Sun, 26 Jul 2026 12:30:08 +0200 Subject: [PATCH] chore: integrate filtermail's .github directory into relay's --- .../.github => .github}/dependabot.yml | 2 +- .github/workflows/chatmaild-ci.yml | 35 ++++++++++++++ .github/workflows/ci.yaml | 26 +++------- .../workflows/filtermail-ci.yml | 48 ++++--------------- .../workflows/filtermail-release.yml | 24 ++++++---- .gitignore | 1 + .../src/cmdeploy/mtail}/filtermail.mtail | 0 filtermail/.gitignore | 1 - filtermail/Cargo.toml | 2 +- 9 files changed, 71 insertions(+), 68 deletions(-) rename {filtermail/.github => .github}/dependabot.yml (90%) create mode 100644 .github/workflows/chatmaild-ci.yml rename filtermail/.github/workflows/ci.yml => .github/workflows/filtermail-ci.yml (58%) rename filtermail/.github/workflows/release.yml => .github/workflows/filtermail-release.yml (86%) rename {filtermail/contrib => cmdeploy/src/cmdeploy/mtail}/filtermail.mtail (100%) delete mode 100644 filtermail/.gitignore diff --git a/filtermail/.github/dependabot.yml b/.github/dependabot.yml similarity index 90% rename from filtermail/.github/dependabot.yml rename to .github/dependabot.yml index 83fb5346..8bf7efb9 100644 --- a/filtermail/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,7 +1,7 @@ version: 2 updates: - package-ecosystem: "cargo" - directory: "/" + directory: "/filtermail" schedule: interval: "monthly" cooldown: diff --git a/.github/workflows/chatmaild-ci.yml b/.github/workflows/chatmaild-ci.yml new file mode 100644 index 00000000..335663fc --- /dev/null +++ b/.github/workflows/chatmaild-ci.yml @@ -0,0 +1,35 @@ +name: chatmaild CI + +on: + # Triggers when a PR is merged into main or a direct push occurs + push: + branches: [ "main" ] + + # Triggers for any PR (and its subsequent commits) targeting the main branch + pull_request: + branches: [ "main" ] + +permissions: {} + +# Newest push wins: Prevents multiple runs from clashing and wasting runner efforts +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + tox: + name: isolated chatmaild tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + # Checkout pull request HEAD commit instead of merge commit + # Otherwise `test_deployed_state` will be unhappy. + with: + ref: ${{ github.event.pull_request.head.sha }} + persist-credentials: false + - name: download filtermail + run: curl -L https://github.com/chatmail/filtermail/releases/download/v0.7.4/filtermail-x86_64 -o /usr/local/bin/filtermail && chmod +x /usr/local/bin/filtermail + - name: run chatmaild tests + working-directory: chatmaild + run: pipx run tox + diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d34f79b1..a0e53d44 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,4 +1,4 @@ -name: CI +name: cmdeploy CI on: # Triggers when a PR is merged into main or a direct push occurs @@ -18,24 +18,8 @@ concurrency: jobs: - tox: - name: isolated chatmaild tests - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - # Checkout pull request HEAD commit instead of merge commit - # Otherwise `test_deployed_state` will be unhappy. - with: - ref: ${{ github.event.pull_request.head.sha }} - persist-credentials: false - - name: download filtermail - run: curl -L https://github.com/chatmail/filtermail/releases/download/v0.7.4/filtermail-x86_64 -o /usr/local/bin/filtermail && chmod +x /usr/local/bin/filtermail - - name: run chatmaild tests - working-directory: chatmaild - run: pipx run tox - - scripts: - name: deploy-chatmail tests + cmdeploy: + name: cmdeploy tests runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 @@ -61,6 +45,10 @@ jobs: with: cmlxc_version: main cmlxc_commands: | + sudo apt-get update && sudo apt-get install -y musl-tools + rustup target add x86_64-unknown-linux-musl + export CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER=musl-gcc + cd repo/filtermail && RUSTFLAGS="-Ctarget-feature=+crt-static -Clink-self-contained=yes" cargo build --release --target x86_64-unknown-linux-musl cmlxc init # single cmdeploy relay test cmlxc -v deploy-cmdeploy --source ./repo cm0 diff --git a/filtermail/.github/workflows/ci.yml b/.github/workflows/filtermail-ci.yml similarity index 58% rename from filtermail/.github/workflows/ci.yml rename to .github/workflows/filtermail-ci.yml index 605333bc..97a18cc3 100644 --- a/filtermail/.github/workflows/ci.yml +++ b/.github/workflows/filtermail-ci.yml @@ -1,4 +1,4 @@ -name: CI +name: filtermail CI permissions: {} @@ -10,6 +10,8 @@ on: pull_request: branches: - main + paths: + - "filtermail/**" concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -27,11 +29,11 @@ jobs: with: toolchain: nightly components: rustfmt - - uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2 - - uses: taiki-e/install-action@2ca9b94c269419b7b0c711c09d0b21c4e1d51145 # v2 + - uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1 + - uses: taiki-e/install-action@2ca9b94c269419b7b0c711c09d0b21c4e1d51145 # v2.83.1 with: tool: taplo-cli - - run: taplo format --check && cargo fmt --check + - run: cd filtermail && taplo format --check && cargo fmt --check cargo-machete: name: Check Unused Dependencies @@ -58,8 +60,8 @@ jobs: with: toolchain: ${{ matrix.toolchain }} components: clippy - - uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2 - - run: cargo clippy + - uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1 + - run: cd filtermail && cargo clippy env: RUSTUP_TOOLCHAIN: ${{ matrix.toolchain }} @@ -73,35 +75,5 @@ jobs: - uses: dtolnay/rust-toolchain@2c7215f132e9ebf062739d9130488b56d53c060c # master with: toolchain: stable - - uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2 - - run: cargo test - - relay-test: - name: Test the relay with cmlxc and custom filtermail - uses: chatmail/cmlxc/.github/workflows/lxc-test.yml@main - with: - cmlxc_commands: | - sudo apt-get update && sudo apt-get install -y musl-tools - rustup target add x86_64-unknown-linux-musl - export CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER=musl-gcc - cd repo && RUSTFLAGS="-Ctarget-feature=+crt-static -Clink-self-contained=yes" cargo build --release --target x86_64-unknown-linux-musl - cmlxc init - cmlxc -v deploy-cmdeploy --filtermail repo/target/x86_64-unknown-linux-musl/release/filtermail cm0 - cmlxc -v deploy-cmdeploy --filtermail repo/target/x86_64-unknown-linux-musl/release/filtermail --type ipv4 cm1 - cmlxc -v deploy-madmail mad0 - - # single-relay tests - cmlxc -v test-cmdeploy cm0 - cmlxc -v test-cmdeploy cm1 - cmlxc -v test-mini cm0 - cmlxc -v test-mini cm1 - - # cross-relay tests (Standard <-> IP-only <-> Madmail) - cmlxc -v test-cmdeploy cm0 cm1 - cmlxc -v test-cmdeploy cm1 cm0 - cmlxc -v test-cmdeploy cm0 mad0 - cmlxc -v test-cmdeploy cm1 mad0 - cmlxc -v test-mini cm0 mad0 - cmlxc -v test-mini mad0 cm0 - cmlxc -v test-mini cm1 mad0 - cmlxc -v test-mini mad0 cm1 + - uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1 + - run: cd filtermail && cargo test diff --git a/filtermail/.github/workflows/release.yml b/.github/workflows/filtermail-release.yml similarity index 86% rename from filtermail/.github/workflows/release.yml rename to .github/workflows/filtermail-release.yml index af1825df..a3ec5b40 100644 --- a/filtermail/.github/workflows/release.yml +++ b/.github/workflows/filtermail-release.yml @@ -1,6 +1,9 @@ on: - release: - types: [published] + push: + tags: + - 'filtermail-*' + +permissions: {} jobs: build: @@ -14,12 +17,15 @@ jobs: with: toolchain: stable targets: aarch64-unknown-linux-musl,x86_64-unknown-linux-musl - - uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2 - - uses: taiki-e/install-action@2ca9b94c269419b7b0c711c09d0b21c4e1d51145 # v2 + - uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2.2.1 + with: + use-cache: false + - uses: taiki-e/install-action@2ca9b94c269419b7b0c711c09d0b21c4e1d51145 # v2.83.1 with: tool: cargo-zigbuild - name: Build run: | + cd filtermail RUSTFLAGS="-Ctarget-feature=+crt-static -Clink-self-contained=yes" \ cargo zigbuild \ --release \ @@ -29,26 +35,28 @@ jobs: uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: filtermail-x86_64 - path: target/x86_64-unknown-linux-musl/release/filtermail + path: filtermail/target/x86_64-unknown-linux-musl/release/filtermail if-no-files-found: error - name: Upload aarch64 binary uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: filtermail-aarch64 - path: target/aarch64-unknown-linux-musl/release/filtermail + path: filtermail/target/aarch64-unknown-linux-musl/release/filtermail if-no-files-found: error publish: name: Upload binaries to the release needs: ["build"] + permissions: + contents: write runs-on: ubuntu-latest steps: - - name: Download aarch64 binary + - name: Download x86_64 binary uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: name: filtermail-x86_64 path: filtermail-x86_64 - - name: Download x86_64 binary + - name: Download aarch64 binary uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: name: filtermail-aarch64 diff --git a/.gitignore b/.gitignore index c0f40b9b..24e6cbf1 100644 --- a/.gitignore +++ b/.gitignore @@ -78,6 +78,7 @@ docs/_build/ # PyBuilder .pybuilder/ target/ +filtermail/target/ # Jupyter Notebook .ipynb_checkpoints diff --git a/filtermail/contrib/filtermail.mtail b/cmdeploy/src/cmdeploy/mtail/filtermail.mtail similarity index 100% rename from filtermail/contrib/filtermail.mtail rename to cmdeploy/src/cmdeploy/mtail/filtermail.mtail diff --git a/filtermail/.gitignore b/filtermail/.gitignore deleted file mode 100644 index ea8c4bf7..00000000 --- a/filtermail/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/target diff --git a/filtermail/Cargo.toml b/filtermail/Cargo.toml index 2318673d..7b396676 100644 --- a/filtermail/Cargo.toml +++ b/filtermail/Cargo.toml @@ -6,7 +6,7 @@ license = "MIT" readme = "README.md" authors = ["Chatmail Developers"] description = "A mail filtering service used by chatmail relay" -repository = "https://github.com/chatmail/filtermail" +repository = "https://github.com/chatmail/relay/tree/main/filtermail" [dependencies] async-trait = "0.1.89"