|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + - feature/** |
| 8 | + pull_request: |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +jobs: |
| 12 | + pre_job: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + outputs: |
| 15 | + should_skip: ${{ steps.skip_check.outputs.should_skip }} |
| 16 | + steps: |
| 17 | + - id: skip_check |
| 18 | + uses: fkirc/skip-duplicate-actions@v5.3.0 |
| 19 | + with: |
| 20 | + cancel_others: "true" |
| 21 | + |
| 22 | + check: |
| 23 | + name: Lint and Check |
| 24 | + if: ${{ needs.pre_job.outputs.should_skip != 'true' || github.event_name != 'pull_request' }} |
| 25 | + timeout-minutes: 10 |
| 26 | + needs: pre_job |
| 27 | + runs-on: ubuntu-latest |
| 28 | + strategy: |
| 29 | + fail-fast: false |
| 30 | + |
| 31 | + env: |
| 32 | + CARGO_TERM_COLOR: always |
| 33 | + CARGO_INCREMENTAL: 0 |
| 34 | + CARGO_PROFILE_DEV_STRIP: "debuginfo" |
| 35 | + CARGO_PROFILE_TEST_STRIP: "debuginfo" |
| 36 | + CARGO_PROFILE_RELEASE_STRIP: "debuginfo" |
| 37 | + |
| 38 | + steps: |
| 39 | + - name: Checkout sources |
| 40 | + uses: actions/checkout@v3 |
| 41 | + |
| 42 | + - name: Install stable toolchain |
| 43 | + uses: actions-rs/toolchain@v1 |
| 44 | + with: |
| 45 | + profile: minimal |
| 46 | + toolchain: stable |
| 47 | + components: rustfmt, clippy |
| 48 | + |
| 49 | + - name: Run cargo fmt |
| 50 | + run: cargo fmt --all -- --check |
| 51 | + |
| 52 | + - name: Run cargo clippy |
| 53 | + run: cargo clippy --all-targets --features python -- -D warnings |
| 54 | + |
| 55 | + - name: Run cargo check |
| 56 | + run: cargo check --all-targets --features python |
| 57 | + |
| 58 | + - name: Run cargo check (no default features) |
| 59 | + run: cargo check --all-targets --no-default-features |
| 60 | + |
| 61 | + test: |
| 62 | + name: Test Suite |
| 63 | + if: ${{ needs.pre_job.outputs.should_skip != 'true' || github.event_name != 'pull_request' }} |
| 64 | + timeout-minutes: 10 |
| 65 | + needs: pre_job |
| 66 | + runs-on: ubuntu-latest |
| 67 | + strategy: |
| 68 | + fail-fast: false |
| 69 | + |
| 70 | + env: |
| 71 | + CARGO_TERM_COLOR: always |
| 72 | + CARGO_INCREMENTAL: 0 |
| 73 | + CARGO_PROFILE_DEV_STRIP: "debuginfo" |
| 74 | + CARGO_PROFILE_TEST_STRIP: "debuginfo" |
| 75 | + CARGO_PROFILE_RELEASE_STRIP: "debuginfo" |
| 76 | + |
| 77 | + steps: |
| 78 | + - name: Checkout sources |
| 79 | + uses: actions/checkout@v3 |
| 80 | + |
| 81 | + - name: Install nightly toolchain |
| 82 | + uses: actions-rs/toolchain@v1 |
| 83 | + with: |
| 84 | + profile: minimal |
| 85 | + toolchain: nightly |
| 86 | + override: ${{ matrix.rust_release == 'latest-nightly' }} |
| 87 | + |
| 88 | + - name: Install cargo-nextest (linux) |
| 89 | + run: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin |
| 90 | + |
| 91 | + - name: Run cargo nextest on all targets |
| 92 | + run: cargo nextest run --no-fail-fast --all-targets |
| 93 | + |
| 94 | + - name: Run doctests |
| 95 | + run: cargo test --no-fail-fast --doc |
0 commit comments