-
Notifications
You must be signed in to change notification settings - Fork 14
75 lines (70 loc) · 1.78 KB
/
ci.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
on:
push:
branches: master
pull_request:
merge_group:
name: Continuous integration
env:
CARGO_TERM_COLOR: always
TARGET: thumbv7em-none-eabihf
jobs:
ci:
name: CI
runs-on: ubuntu-latest
needs: [test, lint]
if: always()
steps:
- name: Done
run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
test:
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- 1.52.0 # MSRV
- stable
device_feature:
- fdcan_g0_g4_l5
- fdcan_h7
steps:
- uses: actions/checkout@v2
- name: Cache cargo registry and index
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
- name: Cache cargo build
uses: actions/cache@v2
with:
path: target
key: ${{ runner.os }}-target-${{ matrix.rust }}-${{ hashFiles('**/Cargo.toml') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
target: ${{ env.TARGET }}
override: true
- uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --verbose --release --target ${{ env.TARGET }} --features ${{ matrix.device_feature }}
- uses: actions-rs/cargo@v1
with:
use-cross: true
command: test
args: --verbose --features ${{ matrix.device_feature }}
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt
- name: Check code formatting
run: cargo fmt -- --check