|
| 1 | +# We use `actions-rs` for most of our actions |
| 2 | +# |
| 3 | +# This file is for the main tests, it is based on test.yml in the main slog repo. |
| 4 | +# If we want to add clippy & rustfmt, they should be separate workflows. |
| 5 | +on: [push, pull_request] |
| 6 | +name: Cargo Test |
| 7 | + |
| 8 | +env: |
| 9 | + CARGO_TERM_COLOR: always |
| 10 | + # has a history of occasional bugs (especially on old versions) |
| 11 | + # |
| 12 | + # the ci is free so we might as well use it ;) |
| 13 | + CARGO_INCREMENTAL: 0 |
| 14 | + |
| 15 | + |
| 16 | +# Tested versions: |
| 17 | +# 1. stable |
| 18 | +# 2. nightly |
| 19 | +# 3. Minimum Supported Rust Version (MSRV) |
| 20 | + |
| 21 | +jobs: |
| 22 | + test: |
| 23 | + # Only run on PRs if the source branch is on someone else's repo |
| 24 | + if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }} |
| 25 | + |
| 26 | + runs-on: ubuntu-latest |
| 27 | + strategy: |
| 28 | + fail-fast: false # Even if one job fails we still want to see the other ones |
| 29 | + matrix: |
| 30 | + # 1.59 is MSRV |
| 31 | + rust: [1.59, stable, nightly] |
| 32 | + # NOTE: Features to test must be specified manually. They are applied to all versions separately. |
| 33 | + # |
| 34 | + # This has the advantage of being more flexibile and thorough |
| 35 | + # This has the disadvantage of being more vebrose |
| 36 | + # |
| 37 | + # Specific feature combos can be overridden per-version with 'include' and 'ecclude' |
| 38 | + features: ["", "nested-values", "dynamic-keys", "nested-values dynamic-keys"] |
| 39 | + |
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v2 |
| 42 | + - uses: actions-rs/toolchain@v1 |
| 43 | + with: |
| 44 | + toolchain: ${{ matrix.rust }} |
| 45 | + override: true |
| 46 | + - name: Check |
| 47 | + # A failing `cargo check` always ends the build |
| 48 | + run: | |
| 49 | + cargo check --verbose --features "${{ matrix.features }}" |
| 50 | + # A failing `cargo check` always fails the build |
| 51 | + continue-on-error: false |
| 52 | + - name: Test |
| 53 | + run: | |
| 54 | + cargo test --verbose --features "${{ matrix.features }}" |
| 55 | +
|
| 56 | + # NOTE: Upstream slog has a hack here for continue-on-error |
| 57 | + # |
| 58 | + # We don't appear to need it. |
| 59 | + # continue-on-error: ${{ matrix.features == '' }} |
0 commit comments