-
Notifications
You must be signed in to change notification settings - Fork 0
219 lines (204 loc) · 7.15 KB
/
Copy pathci.yml
File metadata and controls
219 lines (204 loc) · 7.15 KB
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# Shared CI template. Keep jobs in sync; customize only the env block per repo.
name: CI
on:
push:
branches: [main, master]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: "0"
CARGO_BUILD_JOBS: "1"
MSRV: "1.93"
NO_STD_TARGET: thumbv7em-none-eabihf
NO_STD_CARGO_ARGS: "--no-default-features"
CLIPPY_ARGS: "--lib --all-features"
DOCS_ARGS: "--lib --no-deps --all-features"
CHECK_ARGS: "--lib --all-features"
CI_HOST_TARGET: ""
CI_UNIT_TEST_ARGS: "--lib --all-features"
CI_INTEGRATION_TEST_ARGS: "--all-features"
CI_INTEGRATION_CHECK: "false"
CI_EXTRA_TEST_COMMANDS: "cargo test --test fm --features fm\ncargo test --test preview --features std"
NEEDS_SDL: "false"
jobs:
fmt:
name: Formatting
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --all
- uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: "style: auto-format code with cargo fmt"
commit_user_name: "github-actions[bot]"
commit_user_email: "github-actions[bot]@users.noreply.github.com"
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Install system dependencies (ALSA, udev)
run: sudo apt-get update && sudo apt-get install -y libasound2-dev libudev-dev
- run: |
if [ -n "${{ env.CI_HOST_TARGET }}" ]; then
cargo check ${{ env.CHECK_ARGS }} --target ${{ env.CI_HOST_TARGET }}
else
cargo check ${{ env.CHECK_ARGS }}
fi
check-no-std:
name: Check (no_std - ${{ matrix.target }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target:
- thumbv6m-none-eabi
- thumbv7em-none-eabihf
- riscv32imc-unknown-none-elf
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- run: cargo check -p embedded-audio-core --lib ${{ env.NO_STD_CARGO_ARGS }} --target ${{ matrix.target }}
msrv:
name: MSRV check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.MSRV }}
- uses: Swatinem/rust-cache@v2
- name: Install system dependencies (ALSA, udev)
run: sudo apt-get update && sudo apt-get install -y libasound2-dev libudev-dev
- run: |
if [ -n "${{ env.CI_HOST_TARGET }}" ]; then
cargo check ${{ env.CHECK_ARGS }} --target ${{ env.CI_HOST_TARGET }}
else
cargo check ${{ env.CHECK_ARGS }}
fi
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- name: Install system dependencies (ALSA, udev)
run: sudo apt-get update && sudo apt-get install -y libasound2-dev libudev-dev
- run: cargo clippy ${{ env.CLIPPY_ARGS }} -- -W clippy::all
- run: rustup target add ${{ env.NO_STD_TARGET }}
- run: cargo clippy -p embedded-audio-core --lib ${{ env.NO_STD_CARGO_ARGS }} --target ${{ env.NO_STD_TARGET }} -- -W clippy::all
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Install system dependencies (ALSA, udev)
run: sudo apt-get update && sudo apt-get install -y libasound2-dev libudev-dev
- name: Install SDL2
if: ${{ env.NEEDS_SDL == 'true' }}
run: sudo apt-get update && sudo apt-get install -y libsdl2-dev
- run: bash .github/scripts/ci_test.sh
docs:
name: Docs & GitHub Pages
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Install system dependencies (ALSA, udev)
run: sudo apt-get update && sudo apt-get install -y libasound2-dev libudev-dev
- run: bash .github/scripts/ci_docs.sh
- name: Deploy Docs to GitHub Pages
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: target/doc
branch: gh-pages
publish-dry-run:
name: Publish dry-run
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo publish -p embedded-audio-core --dry-run
audit:
name: Security & License Audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: EmbarkStudios/cargo-deny-action@v2
with:
command: check
arguments: --all-features
coverage:
name: Code Coverage
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- uses: taiki-e/install-action@cargo-llvm-cov
- uses: Swatinem/rust-cache@v2
- name: Install system dependencies (ALSA, udev)
run: sudo apt-get update && sudo apt-get install -y libasound2-dev libudev-dev
- name: Measure code coverage
run: |
echo "### 📊 Code Coverage Report" >> "$GITHUB_STEP_SUMMARY"
echo '```text' >> "$GITHUB_STEP_SUMMARY"
cargo llvm-cov --workspace --summary-only | tee -a "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
cargo llvm-cov --workspace --lcov --output-path lcov-all.info
cargo llvm-cov -p embedded-audio-core --no-default-features --features fm,dsp --lcov --output-path lcov-nostd.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v7
with:
files: lcov-all.info,lcov-nostd.info
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
slug: leftger/embedded-audio
- name: Install nextest
if: ${{ !cancelled() }}
uses: taiki-e/install-action@nextest
- name: Run tests with JUnit report
if: ${{ !cancelled() }}
run: |
set +e
cargo nextest run --workspace --all-features --profile ci
status=$?
cp target/nextest/ci/junit.xml junit.xml
exit $status
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/codecov-action@v7
with:
files: junit.xml
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
slug: leftger/embedded-audio
report_type: test_results