-
-
Notifications
You must be signed in to change notification settings - Fork 23
60 lines (52 loc) · 1.43 KB
/
rust.yml
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
name: Rust
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
jobs:
test:
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
rust:
- stable
- msrv
include:
- os: ubuntu-latest
rust: stable
lint: 1
- rust: stable
rust-args: --all-features
runs-on: ${{ matrix.os }}
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Install toolchain
shell: bash
run: |
ver="${{ matrix.rust }}"
if [ "$ver" = msrv ]; then
ver=$(cargo metadata --format-version 1 --no-deps | \
jq -r '.packages[0].rust_version')
fi
rustup toolchain install "$ver" --profile minimal --no-self-update
rustup default "$ver"
echo "Installed:"
cargo --version
rustc --version --verbose
- uses: Swatinem/rust-cache@v2
- name: cargo test
run: cargo test --workspace ${{ matrix.rust-args }}
- name: rustfmt
if: github.event_name == 'pull_request' && matrix.lint
run: cargo fmt --all -- --check
- name: clippy
if: github.event_name == 'pull_request' && matrix.lint
run: cargo clippy --all --tests --all-features -- -D warnings