-
Notifications
You must be signed in to change notification settings - Fork 1
67 lines (61 loc) · 2.28 KB
/
build_and_test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: Build and Test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Cancel already running jobs
concurrency:
group: build_and_test_${{ github.head_ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
build_and_test:
strategy:
matrix:
include:
- name: Ubuntu 20.04 - Release
runner: ubuntu-20.04
cargo_flags: --release
test_flags: --skip cassandra_int_tests
- name: Ubuntu 20.04 - Debug
runner: ubuntu-20.04
cargo_flags:
test_flags: --skip cassandra_int_tests
name: ${{ matrix.name }}
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
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 the runner and cargo_flags to the key so that a seperate cache is used.
# Otherwise only the last build to finish would get saved to the cache.
# We allow different test_flags to share a cache as they should have identical build outputs
key: ${{ matrix.runner }} - ${{ matrix.cargo_flags }}
- name: Install cargo-hack
run: cargo install cargo-hack --version 0.5.8
- name: Check `cargo fmt` was run
run: |
cd tests
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: |
cd tests
cargo hack --feature-powerset clippy --all-targets --locked ${{ matrix.cargo_flags }} -- -D warnings
- name: Ensure that tests pass
run: |
cd tests
cargo test ${{ matrix.cargo_flags }} --all-features -- --include-ignored --show-output --nocapture
- 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