Respect the NO_COLOR environment variable #38
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 | |
| # | |
| # It is mostly copied from slog-rs/slog | |
| 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 | |
| # Tested versions: | |
| # 1. stable | |
| # 2. nightly | |
| # 3. Minimum Supported Rust Version (MSRV) | |
| 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: | |
| # 1.63 is MSRV. Keep in sync with Cargo.toml | |
| # NOTE: Currently need to pin a specific `time` version for MSRV | |
| rust: [1.63, stable, nightly] | |
| # NOTE: Features to test must be specified manually. They are applied to all versions separately. | |
| # | |
| # This has the advantage of being more flexible and thorough | |
| # This has the disadvantage of being more verbose | |
| # | |
| # Specific feature combos can be overridden per-version with 'include' and 'exclude' | |
| features: ["", "nested-values"] | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - 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- | |
| - run: cargo update | |
| # Pin a time version with a compatible MSRV | |
| - name: Pin time version | |
| if: ${{ matrix.rust != 'nightly' && matrix.rust != 'stable' }} | |
| run: | | |
| cargo update --package time --precise 0.3.20 | |
| # NOTE: We only run `cargo test`. No need for a separate `cargo check` | |
| - name: Test | |
| run: | | |
| cargo test --all --verbose --locked --features "${{ matrix.features }}" | |