diff --git a/filtermail/.github/workflows/ci.yml b/filtermail/.github/workflows/ci.yml new file mode 100644 index 00000000..1d692c23 --- /dev/null +++ b/filtermail/.github/workflows/ci.yml @@ -0,0 +1,77 @@ +name: CI + +permissions: {} + +on: + workflow_dispatch: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + fmt: + name: Check Formatting + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + persist-credentials: false + - uses: dtolnay/rust-toolchain@6d653acede28d24f02e3cd41383119e8b1b35921 # master + with: + toolchain: nightly + components: rustfmt + - uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2 + - uses: taiki-e/install-action@44c6d64aa62cd779e873306675c7a58e86d6d532 # v2 + with: + tool: taplo-cli + - run: taplo format --check && cargo fmt --check + + cargo-machete: + name: Check Unused Dependencies + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + persist-credentials: false + - uses: bnjbvr/cargo-machete@7959c845782fed02ee69303126d4a12d64f1db18 # v0.9.1 + + lint-clippy: + name: Check Clippy + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + toolchain: ["stable", "beta"] + continue-on-error: ${{ matrix.toolchain == 'beta' }} + steps: + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + persist-credentials: false + - uses: dtolnay/rust-toolchain@6d653acede28d24f02e3cd41383119e8b1b35921 # master + with: + toolchain: ${{ matrix.toolchain }} + components: clippy + - uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2 + - run: cargo clippy + env: + RUSTUP_TOOLCHAIN: ${{ matrix.toolchain }} + + test: + name: Test on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + steps: + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + persist-credentials: false + - uses: dtolnay/rust-toolchain@6d653acede28d24f02e3cd41383119e8b1b35921 # master + with: + toolchain: stable + - uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2 + - run: cargo test