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