|
| 1 | +name: Check, test, clippy |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + |
| 11 | +concurrency: |
| 12 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 13 | + cancel-in-progress: true |
| 14 | + |
| 15 | +env: |
| 16 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 17 | + CARGO_INCREMENTAL: 0 |
| 18 | + CARGO_TERM_COLOR: always |
| 19 | + |
| 20 | +jobs: |
| 21 | + check: |
| 22 | + runs-on: ${{ matrix.os }} |
| 23 | + strategy: |
| 24 | + matrix: |
| 25 | + os: [ubuntu-latest, macos-latest] |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@v4 |
| 28 | + - run: rustup update |
| 29 | + - uses: ./.github/actions/rust-cache |
| 30 | + with: |
| 31 | + cache-name: check |
| 32 | + - run: cargo check --all-targets |
| 33 | + test: |
| 34 | + runs-on: ${{ matrix.os }} |
| 35 | + strategy: |
| 36 | + matrix: |
| 37 | + os: [ubuntu-latest, macos-latest] |
| 38 | + steps: |
| 39 | + - uses: actions/checkout@v4 |
| 40 | + - run: rustup update |
| 41 | + - uses: ./.github/actions/rust-cache |
| 42 | + with: |
| 43 | + cache-name: test |
| 44 | + - name: Install cargo-binstall |
| 45 | + uses: cargo-bins/cargo-binstall@main |
| 46 | + - name: Install cargo-nextest |
| 47 | + run: cargo binstall --no-confirm cargo-nextest |
| 48 | + - run: cargo nextest run --profile ci --cargo-profile ci |
| 49 | + clippy: |
| 50 | + runs-on: ubuntu-latest |
| 51 | + steps: |
| 52 | + - uses: actions/checkout@v4 |
| 53 | + - run: rustup update |
| 54 | + - uses: ./.github/actions/rust-cache |
| 55 | + with: |
| 56 | + cache-name: clippy |
| 57 | + - run: cargo clippy --all-targets -- -D warnings |
| 58 | + fmt: |
| 59 | + runs-on: ubuntu-latest |
| 60 | + steps: |
| 61 | + - uses: actions/checkout@v4 |
| 62 | + - run: rustup toolchain install nightly |
| 63 | + - run: cargo +nightly fmt --check |
| 64 | + deny: |
| 65 | + runs-on: ubuntu-latest |
| 66 | + steps: |
| 67 | + - uses: actions/checkout@v4 |
| 68 | + - name: Install cargo-binstall |
| 69 | + uses: cargo-bins/cargo-binstall@main |
| 70 | + - name: Install cargo-deny |
| 71 | + run: cargo binstall --no-confirm cargo-deny |
| 72 | + - run: cargo deny check |
| 73 | + audit: |
| 74 | + runs-on: ubuntu-latest |
| 75 | + steps: |
| 76 | + - uses: actions/checkout@v4 |
| 77 | + - name: Install cargo-binstall |
| 78 | + uses: cargo-bins/cargo-binstall@main |
| 79 | + - name: Install cargo-audit |
| 80 | + run: cargo binstall --no-confirm cargo-audit |
| 81 | + - run: cargo audit |
| 82 | + # cross-build: |
| 83 | + # runs-on: ${{ matrix.target.runner }} |
| 84 | + # strategy: |
| 85 | + # matrix: |
| 86 | + # target: |
| 87 | + # - { arch: x86_64-linux, runner: ubuntu-latest } |
| 88 | + # - { arch: aarch64-linux, runner: ubuntu-latest } |
| 89 | + # - { arch: aarch64-darwin, runner: macos-latest } |
| 90 | + # - { arch: x86_64-darwin, runner: macos-latest } |
| 91 | + # steps: |
| 92 | + # - uses: actions/checkout@v4 |
| 93 | + # - name: Install nix |
| 94 | + # uses: nixbuild/nix-quick-install-action@v32 |
| 95 | + # - uses: ./.github/actions/rust-cache |
| 96 | + # with: |
| 97 | + # cache-name: cross-build |
| 98 | + # - name: Determine rust target |
| 99 | + # id: rust-target |
| 100 | + # run: | |
| 101 | + # case "${{ matrix.target.arch }}" in |
| 102 | + # "x86_64-linux") |
| 103 | + # echo "rust_target=x86_64-unknown-linux-musl" >> $GITHUB_OUTPUT |
| 104 | + # ;; |
| 105 | + # "aarch64-linux") |
| 106 | + # echo "rust_target=aarch64-unknown-linux-musl" >> $GITHUB_OUTPUT |
| 107 | + # ;; |
| 108 | + # "x86_64-darwin") |
| 109 | + # echo "rust_target=x86_64-apple-darwin" >> $GITHUB_OUTPUT |
| 110 | + # ;; |
| 111 | + # "aarch64-darwin") |
| 112 | + # echo "rust_target=aarch64-apple-darwin" >> $GITHUB_OUTPUT |
| 113 | + # ;; |
| 114 | + # esac |
| 115 | + # - name: Build binary |
| 116 | + # run: | |
| 117 | + # nix develop .#crossBuildShell-${{ matrix.target.arch }} -c \ |
| 118 | + # cargo build --locked --release |
0 commit comments