143 lines (133 loc) · 4.19 KB
/
ci.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
name: CI
on:
push:
branches:
- 'main'
- 'ci'
paths-ignore:
- '.github/workflows/devcontainer.yaml'
- '.github/workflows/pages.yaml'
- '.github/renovate.json'
pull_request:
merge_group:
types: [checks_requested]
permissions:
contents: read
jobs:
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install cargo-cranky
run: cargo install --locked cargo-cranky
- name: no_std
run: cargo cranky --target thumbv7em-none-eabihf --no-default-features
- name: std
run: cargo cranky --no-default-features -F std
- name: no_std + serde
run: cargo cranky --target thumbv7em-none-eabihf --no-default-features -F _serde
- name: All features
run: cargo cranky --all-features
- name: Check fuzz tests
run: cargo cranky -p fuzz --all-targets
- name: Check code generator
run: cargo cranky -p codegen
min-dependencies:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Use minimal versions Cargo.toml & Cargo.lock
run: |
mv Cargo.min.toml Cargo.toml
mv Cargo.min.lock Cargo.lock
- run: cargo check --locked --lib
codegen:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: rustup toolchain install nightly --profile minimal --component rustfmt
- run: cargo run -p codegen
- run: git diff --exit-code src/generated/
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
toolchain:
- msrv
- beta
- nightly
include:
- os: macos-latest
toolchain: msrv
- os: windows-latest
toolchain: msrv
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.toolchain == 'nightly' }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install toolchain (MSRV)
uses: actions-rust-lang/setup-rust-toolchain@v1
if: ${{ matrix.toolchain == 'msrv' }}
- name: Remove rust-toolchain file (non-MSRV)
run: rm rust-toolchain*
if: ${{ matrix.toolchain != 'msrv' }}
- name: Install toolchain (non-MSRV)
uses: actions-rust-lang/setup-rust-toolchain@v1
if: ${{ matrix.toolchain != 'msrv' }}
with:
toolchain: ${{ matrix.toolchain }}
- name: Install nextest
uses: taiki-e/install-action@nextest
- name: Replace symlinks with copies
if: ${{ runner.os == 'windows' }}
run: |
cd tests/logs
mv fc-blackbox fc-blackbox~
mv gimbal-ghost gimbal-ghost~
cp -r "$(readlink fc-blackbox~)" fc-blackbox
cp -r "$(readlink gimbal-ghost~)" gimbal-ghost
rm -r fc-blackbox~
rm -r gimbal-ghost~
- name: Run tests
run: cargo nextest run --all-features --profile=ci
- name: Run doctests
run: cargo test --doc
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install nextest
uses: taiki-e/install-action@nextest
- name: Install llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate coverage
run: cargo llvm-cov --all-features --lcov --output-path=coverage.lcov --ignore-filename-regex generated nextest --profile=ci --run-ignored=all
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
files: coverage.lcov
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rm rust-toolchain*
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly
components: rustfmt
- name: Check rustfmt
run: cargo +nightly fmt --all --check
typos:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: crate-ci/typos@master