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
name: CI
on:
push:
branches:
- main
pull_request_review:
types:
- submitted
workflow_dispatch:
env:
CARGO_INCREMENTAL: "0"
CARGO_TERM_COLOR: always
jobs:
fmt:
name: Format
runs-on: ubuntu-latest
if: github.event_name != 'pull_request_review' || (github.event.review.state == 'approved' && github.event.review.user.login == github.repository_owner)
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Check formatting
run: cargo fmt --all -- --check
clippy:
name: Clippy (${{ matrix.name }})
runs-on: ubuntu-latest
if: github.event_name != 'pull_request_review' || (github.event.review.state == 'approved' && github.event.review.user.login == github.repository_owner)
strategy:
fail-fast: false
matrix:
# Keep this explicit: --all-features would enable the optional loom dependency.
include:
- name: default
args: ""
- name: no-default-features
args: --no-default-features
- name: async-std
args: --features async-std
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Cache Rust builds
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
shared-key: clippy-${{ matrix.name }}
workspaces: . -> target
- name: Run clippy
run: cargo clippy --workspace ${{ matrix.args }} --lib --tests -- -D warnings
no-std:
name: No std (${{ matrix.name }})
runs-on: ubuntu-latest
if: github.event_name != 'pull_request_review' || (github.event.review.state == 'approved' && github.event.review.user.login == github.repository_owner)
strategy:
fail-fast: false
matrix:
include:
- name: core
target: thumbv7em-none-eabihf
features: ""
- name: async
target: thumbv7em-none-eabihf
features: --features async
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache Rust builds
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
shared-key: no-std-${{ matrix.name }}-${{ matrix.target }}
workspaces: . -> target
- name: Check no-std build
run: cargo check --workspace --no-default-features ${{ matrix.features }} --target ${{ matrix.target }} --lib
test:
name: Test (${{ matrix.name }})
runs-on: ubuntu-latest
if: github.event_name != 'pull_request_review' || (github.event.review.state == 'approved' && github.event.review.user.login == github.repository_owner)
strategy:
fail-fast: false
matrix:
# Keep this explicit: --all-features would enable the optional loom dependency.
include:
- name: default
args: ""
doc_tests: true
- name: no-default-features
args: --no-default-features
doc_tests: false
- name: async-std
args: --features async-std
doc_tests: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust builds
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
shared-key: test-${{ matrix.name }}
workspaces: . -> target
- name: Run unit tests
run: cargo test --workspace ${{ matrix.args }} --lib --tests
- name: Run doc tests
if: matrix.doc_tests
run: cargo test --workspace ${{ matrix.args }} --doc