Skip to content

Commit 65fd654

Browse files
authored
Merge pull request #860 from jerrysxie/v0.2.0-to-main
Merge v0.2.0 into main
2 parents 6034c6b + b8b6e81 commit 65fd654

275 files changed

Lines changed: 25920 additions & 21352 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/copilot-instructions.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This is an embedded controller (EC) services workspace — a collection of `no_s
66

77
## Build, Test, and Lint
88

9-
Toolchain: Rust 1.88 (`rust-toolchain.toml`), edition 2024. Targets: `x86_64-unknown-linux-gnu` (std/testing) and `thumbv8m.main-none-eabihf` (ARM Cortex-M33).
9+
Toolchain: Rust 1.90 (`rust-toolchain.toml`), edition 2024. Targets: `x86_64-unknown-linux-gnu` (std/testing) and `thumbv8m.main-none-eabihf` (ARM Cortex-M33).
1010

1111
```shell
1212
# Format
@@ -196,3 +196,13 @@ Basic development tools (git, cargo, editors) should not be listed.
196196
AI agents **must** verify their own identity (agent name and model version) before composing the `Assisted-by` trailer — do not assume or hard-code a model name from a previous session.
197197

198198
AI agents **MUST NOT** add `Signed-off-by` tags. Only humans can certify the Developer Certificate of Origin.
199+
200+
## Rust PR Review Instructions
201+
CI overview:
202+
* CI will build the project and run `cargo test` and `cargo clippy`.
203+
* Feature combinations are checked with `cargo hack`.
204+
* Do not comment on compile errors, compiler warnings, or clippy warnings.
205+
206+
Pay special attention to...
207+
* code that uses async selection APIs such as `select`, `selectN`, `select_array`, `select_slice`, or is marked with a drop safety comment. These functions drop the futures that don't finish. Check that values are not lost when this happens.
208+
* code that could possibly panic or is marked with a panic safety comment.

.github/workflows/check.yml

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ concurrency:
3131
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
3232
cancel-in-progress: true
3333
name: check
34+
env:
35+
# Crates that require std and won't build on embedded-targets
36+
STD_CRATES: "fw-update-interface-mocks"
3437
jobs:
3538

3639
fmt:
@@ -93,6 +96,8 @@ jobs:
9396
# Get early warning of new lints which are regularly introduced in beta channels.
9497
toolchain: [stable, beta]
9598
target: [x86_64-unknown-linux-gnu, thumbv8m.main-none-eabihf]
99+
env:
100+
COMMON_HACK_ARGS: "--feature-powerset --mutually-exclusive-features=log,defmt,defmt-timestamp-uptime"
96101
steps:
97102
- uses: actions/checkout@v4
98103
with:
@@ -112,7 +117,11 @@ jobs:
112117
# intentionally no target specifier; see https://github.com/jonhoo/rust-ci-conf/pull/4
113118
# --feature-powerset runs for every combination of features
114119
- name: cargo hack
115-
run: cargo hack --feature-powerset --mutually-exclusive-features=log,defmt,defmt-timestamp-uptime clippy --locked --target ${{ matrix.target }}
120+
if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }}
121+
run: cargo hack $COMMON_HACK_ARGS clippy --locked --target ${{ matrix.target }}
122+
- name: cargo hack
123+
if: ${{ matrix.target != 'x86_64-unknown-linux-gnu' }}
124+
run: cargo hack $COMMON_HACK_ARGS clippy --exclude $STD_CRATES --locked --target ${{ matrix.target }}
116125

117126
deny:
118127
# cargo-deny checks licenses, advisories, sources, and bans for
@@ -148,17 +157,35 @@ jobs:
148157
submodules: true
149158
- name: Install stable
150159
uses: dtolnay/rust-toolchain@stable
160+
with:
161+
# For grcov
162+
components: llvm-tools
151163
- name: Download Cargo.lock files
152164
if: ${{ inputs.download-lockfiles }}
153165
uses: actions/download-artifact@v4
154166
with:
155167
name: updated-lock-files
156168
- name: cargo test
157169
run: cargo test --locked
170+
env:
171+
RUSTFLAGS: '-C instrument-coverage'
172+
CARGO_INCREMENTAL: '0'
158173
# After ensuring tests pass, finally ensure the test code itself contains no clippy warnings
159174
- name: cargo clippy
160175
run: |
161176
cargo clippy --locked --tests
177+
# Generate and upload test coverage report
178+
- name: Install grcov
179+
uses: taiki-e/install-action@grcov
180+
- name: Generate test coverage report
181+
run: |
182+
grcov . --binary-path ./target/debug/deps -s . --branch --ignore-not-existing --ignore "/home/runner/*" -t html -o ./target/debug/coverage
183+
grcov . --binary-path ./target/debug/deps -s . --branch --ignore-not-existing --ignore "/home/runner/*" -t markdown >> $GITHUB_STEP_SUMMARY
184+
- name: Upload test coverage report
185+
uses: actions/upload-artifact@v4
186+
with:
187+
name: test-coverage-report
188+
path: ./target/debug/coverage
162189

163190
msrv:
164191
# check that we can build using the minimal rust version that is specified by this crate
@@ -185,9 +212,15 @@ jobs:
185212
with:
186213
name: updated-lock-files
187214
- name: cargo +${{ matrix.msrv }} check
215+
if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }}
188216
run: |
189217
cargo check -F log --locked --target ${{ matrix.target }}
190218
cargo check -F defmt --locked --target ${{ matrix.target }}
219+
- name: cargo +${{ matrix.msrv }} check
220+
if: ${{ matrix.target != 'x86_64-unknown-linux-gnu' }}
221+
run: |
222+
cargo check -F log --locked --workspace --exclude $STD_CRATES --target ${{ matrix.target }}
223+
cargo check -F defmt --locked --workspace --exclude $STD_CRATES --target ${{ matrix.target }}
191224
192225
check-arm-examples:
193226
runs-on: ubuntu-latest
@@ -239,6 +272,31 @@ jobs:
239272
run: |
240273
cargo clippy --locked
241274
275+
check-pico-de-gallo-examples:
276+
runs-on: ubuntu-latest
277+
# we use a matrix here just because env can't be used in job names
278+
# https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability
279+
strategy:
280+
fail-fast: false
281+
matrix:
282+
example_directory: ["examples/pico-de-gallo"]
283+
name: ubuntu / check-examples
284+
steps:
285+
- uses: actions/checkout@v4
286+
with:
287+
submodules: true
288+
- name: Install stable
289+
uses: dtolnay/rust-toolchain@stable
290+
- name: Download Cargo.lock files
291+
if: ${{ inputs.download-lockfiles }}
292+
uses: actions/download-artifact@v4
293+
with:
294+
name: updated-lock-files
295+
- name: cargo clippy
296+
working-directory: ${{ matrix.example_directory }}
297+
run: |
298+
cargo clippy --locked
299+
242300
machete:
243301
# cargo-machete checks for unused dependencies in Cargo.toml files
244302
runs-on: ubuntu-latest

.vscode/settings.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"Cargo.toml",
1515
"examples/rt633/Cargo.toml",
1616
"examples/rt685s-evk/Cargo.toml",
17-
"examples/std/Cargo.toml"
17+
"examples/std/Cargo.toml",
18+
"examples/pico-de-gallo/Cargo.toml"
1819
]
19-
}
20+
}

0 commit comments

Comments
 (0)