CI #48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| schedule: | |
| - cron: "43 03 * * *" # Daily at 8:43 PM PDT, 7:43 PM PST. | |
| workflow_dispatch: | |
| permissions: {} | |
| env: | |
| CARGO_TERM_COLOR: always | |
| CARGO_INCREMENTAL: 0 | |
| defaults: | |
| run: | |
| shell: bash # default shell on windows is pwsh | |
| jobs: | |
| pre_job: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| should_skip: ${{ steps.skip_check.outputs.should_skip }} | |
| steps: | |
| - id: skip_check | |
| uses: fkirc/skip-duplicate-actions@f75f66ce1886f00957d99748a42c724f4330bdcf # v5.3.1 | |
| lint: | |
| name: All lints and compilation checks | |
| if: ${{ needs.pre_job.outputs.should_skip != 'true' || github.event_name != 'pull_request' }} | |
| timeout-minutes: 5 | |
| needs: pre_job | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| - run: cargo clippy --all-targets -- -D warnings | |
| - run: cargo clippy --all-targets --no-default-features -- -D warnings | |
| - run: cargo clippy --all-targets --all-features -- -D warnings | |
| - run: rustup component add --toolchain nightly rustfmt | |
| - run: cargo +nightly fmt --all -- --check | |
| test: | |
| name: All tests | |
| if: ${{ needs.pre_job.outputs.should_skip != 'true' || github.event_name != 'pull_request' }} | |
| timeout-minutes: 5 | |
| needs: pre_job | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| - uses: taiki-e/install-action@2b15ad09ca0f06a76791407e35ab20f0b712d615 # nextest | |
| - name: Run cargo nextest on all targets | |
| id: nextest | |
| env: | |
| RUST_BACKTRACE: "1" | |
| run: cargo nextest run --no-fail-fast --all-targets --all-features | |
| - name: Run doctests | |
| id: doctests | |
| continue-on-error: ${{ matrix.rust_release == 'latest-nightly' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') }} | |
| # Not supported by nextest: https://github.com/nextest-rs/nextest/issues/16 | |
| env: | |
| # note: no-capture is not supported by doctests, that's why the unstable is needed (nightly only). | |
| RUSTDOCFLAGS: ${{ matrix.rust_release == 'latest-nightly' && '-Zunstable-options --no-capture' || '' }} | |
| RUST_BACKTRACE: "1" | |
| run: cargo test --no-fail-fast --doc |