ci: Don't rebuild cargo-rdme if present #17
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
| # We use `actions-rs` for most of our actions | |
| # | |
| # This file is for the main tests. clippy & rustfmt are separate workflows | |
| on: [push, pull_request] | |
| name: Cargo Test | |
| env: | |
| CARGO_TERM_COLOR: always | |
| # has a history of occasional bugs (especially on old versions) | |
| # | |
| # the ci is free so we might as well use it ;) | |
| CARGO_INCREMENTAL: 0 | |
| jobs: | |
| test: | |
| # Only run on PRs if the source branch is on someone else's repo | |
| if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false # Even if one job fails we still want to see the other ones | |
| matrix: | |
| rust: | |
| # Minimum Supported Rust Version | |
| # | |
| # This is hardcoded and needs to be in sync with Cargo.toml and the README | |
| # | |
| # If one of the features does not support this MSRV, | |
| # you need to remove this from the main list and manually add the desired | |
| # feature/version combinations to 'include' | |
| # This hack is not currently needed because serde-erased v0.3 supports our MSRV. | |
| - 1.63 | |
| # Intermediate Releases (between MSRV and latest stable) | |
| # Be careful not to add these needlessly; they hold up CI | |
| # The most recent version of stable rust (automatically updated) | |
| - stable | |
| - nightly | |
| # NOTE: Features to test must be specified manually. They are applied to all versions separately. | |
| features: | |
| - "std" | |
| - "std bytemuck slog serde" | |
| include: | |
| - rust: stable | |
| features: "std parking_lot" | |
| - rust: nightly | |
| features: "nightly" # no features except nightly | |
| - rust: nightly | |
| features: "nightly alloc" # no features except nightly + alloc | |
| - rust: nightly | |
| features: "std nightly" | |
| - rust: nightly | |
| features: "std unique-wrap-std nightly" | |
| - rust: nightly | |
| features: "std nightly parking_lot" | |
| - rust: nightly | |
| features: "std nightly parking_lot bytemuck slog serde" | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ matrix.rust }} | |
| - name: Cache Cargo Registry | |
| id: cache-index | |
| uses: actions/cache@v4 | |
| with: | |
| path: | |
| # Before the sparse index, updating the registry took forever | |
| ~/.cargo/registry/index/ | |
| key: ${{ runner.os }}-cargo-${{ matrix.rust }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo- | |
| continue-on-error: false | |
| - name: Test | |
| # NOTE: Running --all-targets does not include doc tests | |
| # Does not compile benchmarks because they break on MSRV. Still checked by clippy | |
| run: | | |
| cargo test --all --verbose --no-default-features --features "${{ matrix.features }}" --exclude "benchmarks" | |
| clippy: | |
| # Only run on PRs if the source branch is on someone else's repo | |
| if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| rust: | |
| # in hardcoded versions, warnings will fail the build | |
| - 1.89 | |
| # in auto-updated versions, warnings will not fail the build | |
| - stable | |
| - nightly | |
| features: | |
| # NOTE: Unfortunately, the benchmarks crate implicitly requires 'std' | |
| - "std parking_lot bytemuck slog serde" | |
| include: | |
| - rust: nightly | |
| features: "std slog bytemuck parking_lot serde nightly" | |
| - rust: nightly | |
| features: "std nightly unique-wrap-std" | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ matrix.rust }} | |
| components: clippy | |
| - name: Clippy | |
| run: | | |
| cargo clippy --all --all-targets --verbose --no-default-features --features "${{ matrix.features }}" -- -D warnings | |
| # When using hardcoded/pinned versions, warnings are forbidden. | |
| # | |
| # On automatically updated versions of rust (both stable & nightly) we allow clippy to fail. | |
| # This is because automatic updates can introduce new lints or change existing lints. | |
| continue-on-error: ${{ !contains(matrix.rust, '1.') }} | |
| docs: | |
| # Only run on PRs if the source branch is on someone else's repo | |
| if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }} | |
| runs-on: ubuntu-latest | |
| env: | |
| RUSTDOCFLAGS: "-D warnings" | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| rust: | |
| - nightly | |
| - stable | |
| features: | |
| - "std parking_lot bytemuck slog serde" | |
| include: | |
| - rust: nightly | |
| features: "std parking_lot bytemuck slog serde nightly nightly-docs" | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ matrix.rust }} | |
| - name: Docs | |
| run: | | |
| cargo doc --verbose --no-default-features --features "${{ matrix.features }}" | |
| cargo-rdme: | |
| # Only run on PRs if the source branch is on someone else's repo | |
| if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rust-src | |
| # need to cache cargo-rdme to avoid redundant install | |
| - name: Cache Binaries | |
| id: cache-binaries | |
| uses: actions/cache@v4 | |
| with: | |
| path: | |
| ~/.cargo/bin/cargo-rdme | |
| key: ${{ runner.os }}-binary-cargo-rdme | |
| - name: Install cargo-rdme | |
| shell: bash | |
| run: | | |
| if not test -f "~/.cargo/bin/cargo-rdme"; then | |
| cargo install cargo-rdme | |
| fi | |
| - name: Run cargo-rdme | |
| run: | | |
| cargo install cargo-rdme | |
| cargo rdme --check |