-
Notifications
You must be signed in to change notification settings - Fork 34
53 lines (44 loc) · 1.46 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
name: Rust
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
concurrency:
group: rust-${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
actions: read
jobs:
test:
strategy:
matrix:
toolchain:
- stable
- beta
- nightly
fail-fast: false
runs-on: ubuntu-22.04
name: "Rust ${{ matrix.toolchain }} tests"
# We ignore the possible error that could be present on nightly
continue-on-error: ${{ matrix.toolchain == 'nightly' }}
steps:
- name: Checkout the project
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Setup rust cache
uses: Swatinem/rust-cache@2656b87321093db1cb55fbd73183d195214fdfd1 # v2.5.0
with:
key: ${{ matrix.toolchain }}
- name: Install rust ${{ matrix.toolchain }} toolchain
# We add the `clippy` component only on `stable`
run: rustup toolchain add ${{ matrix.toolchain }} ${{ matrix.toolchain == 'stable' && '--component=clippy' || '' }}
- name: Check rust is formatted
if: ${{ matrix.toolchain == 'stable' }}
run: cargo fmt --check
- name: Check clippy
if: ${{ matrix.toolchain == 'stable' }}
run: cargo clippy --all-features --all-targets
- name: Execute cargo tests
run: cargo +${{ matrix.toolchain }} test --verbose --all-features