test an integration with our CI #5
Workflow file for this run
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: | ||
| branches: [ main ] | ||
| workflow_dispatch: | ||
| defaults: | ||
| run: | ||
| shell: bash | ||
| jobs: | ||
| test: | ||
| name: Test | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: { submodules: recursive } | ||
| - if: github.event_name != 'release' && github.event_name != 'workflow_dispatch' | ||
| uses: Swatinem/rust-cache@v2 | ||
| - uses: taiki-e/install-action@v2 | ||
| with: { tool: 'just,cargo-binstall' } | ||
| - run: just ci-test | ||
| test-nightly: | ||
| name: Nightly-specific tests | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: { submodules: recursive } | ||
| - if: github.event_name != 'release' && github.event_name != 'workflow_dispatch' | ||
| uses: Swatinem/rust-cache@v2 | ||
| - uses: taiki-e/install-action@v2 | ||
| with: { tool: 'just' } | ||
| - run: rustup install nightly --profile minimal | ||
| - run: just test-publish | ||
| test-msrv: | ||
| name: Test MSRV | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: { submodules: recursive } | ||
| - if: github.event_name != 'release' && github.event_name != 'workflow_dispatch' | ||
| uses: Swatinem/rust-cache@v2 | ||
| - uses: taiki-e/install-action@v2 | ||
| with: { tool: 'just' } | ||
| - name: Read MSRV | ||
| id: msrv | ||
| run: echo "value=$(just get-msrv)" >> $GITHUB_OUTPUT | ||
| - name: Install MSRV Rust ${{ steps.msrv.outputs.value }} | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| toolchain: ${{ steps.msrv.outputs.value }} | ||
| components: rustfmt | ||
| - run: just ci_mode=0 ci-test-msrv # Ignore warnings in MSRV | ||
| fuzz: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| # The number of seconds to run the fuzz target. | ||
| FUZZ_TIME: 60 | ||
| strategy: | ||
| matrix: | ||
| include: | ||
| - fuzz_target: fastpfor_cpp | ||
| - fuzz_target: fastpfor_rust | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| # Install the nightly Rust channel. | ||
| - run: rustup toolchain install nightly | ||
| - run: rustup default nightly | ||
| # Install and cache `cargo-fuzz`. | ||
| - uses: taiki-e/install-action@v2 | ||
| with: | ||
| tool: cargo-binstall | ||
| - run: cargo binstall cargo-fuzz@0.13.1 # Pinned to avoid breakage. | ||
| # Build and then run the fuzz target. | ||
| - run: cargo fuzz build ${{ matrix.fuzz_target }} | ||
| - run: cargo fuzz run ${{ matrix.fuzz_target }} -- -max_total_time=${{ env.FUZZ_TIME }} | ||
| # Upload fuzzing artifacts on failure for post-mortem debugging. | ||
| - uses: actions/upload-artifact@v4 | ||
| if: failure() | ||
| with: | ||
| name: fuzzing-artifacts-${{ matrix.fuzz_target }}-${{ github.sha }} | ||
| path: fuzz/artifacts | ||
| yxx | ||
| coverage: | ||
| name: Code Coverage | ||
| if: github.event_name != 'release' | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: { submodules: recursive } | ||
| - uses: Swatinem/rust-cache@v2 | ||
| - uses: taiki-e/install-action@v2 | ||
| with: { tool: 'just,cargo-llvm-cov' } | ||
| - name: Generate code coverage | ||
| run: just ci-coverage | ||
| - name: Upload coverage to Codecov | ||
| uses: codecov/codecov-action@v5 | ||
| with: | ||
| token: ${{ secrets.CODECOV_TOKEN }} | ||
| files: target/llvm-cov/codecov.info | ||
| # This job checks if any of the previous jobs failed or were canceled. | ||
| # This approach also allows some jobs to be skipped if they are not needed. | ||
| ci-passed: | ||
| needs: [ test, test-nightly, test-msrv, fuzz ] | ||
| if: always() | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Result of the needed steps | ||
| run: echo "${{ toJSON(needs) }}" | ||
| - if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }} | ||
| run: exit 1 | ||
| release: | ||
| # Some dependencies of the `ci-passed` job might be skipped, but we still want to run if the `ci-passed` job succeeded. | ||
| if: always() && startsWith(github.ref, 'refs/tags/') && needs.ci-passed.result == 'success' | ||
| name: Publish to crates.io | ||
| needs: [ ci-passed ] | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: { submodules: recursive } | ||
| - name: Publish to crates.io | ||
| run: cargo publish | ||
| env: | ||
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | ||