update #113
This file contains 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: Tests | |
on: [push, pull_request] | |
# Cancel already running jobs | |
concurrency: | |
group: testing_${{ github.head_ref }} | |
cancel-in-progress: true | |
env: | |
CARGO_TERM_COLOR: always | |
RUST_BACKTRACE: 1 | |
jobs: | |
build: | |
strategy: | |
matrix: | |
include: | |
- name: Ubuntu 20.04 - Release | |
runner: ubuntu-20.04 | |
cargo_profile: --release | |
- name: Ubuntu 20.04 - Debug | |
runner: ubuntu-20.04 | |
cargo_profile: | |
name: ${{ matrix.name }} | |
runs-on: ${{ matrix.runner }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: Swatinem/rust-cache@v1 | |
with: | |
# rust-cache already handles all the sane defaults for caching rust builds. | |
# However because we are running seperate debug/release builds in parallel, | |
# we also need to add Debug or Release to the key so that a seperate cache is used. | |
# Otherwise only the last build to finish would get saved to the cache. | |
key: ${{ matrix.name }} | |
- name: Install cargo-hack | |
run: cargo install cargo-hack --version 0.5.8 | |
- name: Check `cargo fmt` was run | |
run: cargo fmt --all -- --check | |
- name: Ensure that all crates compile and have no warnings under every possible combination of features | |
# some things to explicitly point out: | |
# * clippy also reports rustc warnings and errors | |
# * clippy --all-targets causes clippy to run against tests and examples which it doesnt do by default. | |
run: cargo hack --feature-powerset clippy --all-targets --locked ${{ matrix.cargo_profile }} -- -D warnings | |
- name: Ensure that tests pass | |
run: cargo hack --feature-powerset test ${{ matrix.cargo_profile }} -- --include-ignored --show-output | |
- name: Ensure that tests did not create or modify any files that arent .gitignore'd | |
run: | | |
if [ -n "$(git status --porcelain)" ]; then | |
git status | |
exit 1 | |
fi |