-
-
Notifications
You must be signed in to change notification settings - Fork 39
203 lines (192 loc) · 5.91 KB
/
ci.yml
File metadata and controls
203 lines (192 loc) · 5.91 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
name: CI
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
typos:
name: Check for typos
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: crate-ci/typos@master
markdown:
name: Check Markdown
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: DavidAnson/markdownlint-cli2-action@v23
with:
globs: "**/*.md,#CHANGELOG.md"
separator: ","
fmt:
name: Run fmt
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Check formatting
run: cargo fmt --check --all
clippy:
name: Run clippy (${{ matrix.project.name }})
runs-on: ubuntu-latest
permissions:
checks: write
strategy:
fail-fast: false
matrix:
project:
# Core no_std workspace (default host build)
- name: workspace
dir: .
target: ""
setup_xtensa: false
# ESP-IDF demo using Xtensa toolchain
- name: esp32-std-demo
dir: examples/esp32-std-demo
target: xtensa-esp32-espidf
setup_xtensa: true
# no-std demo
- name: esp32-no-std-demo
dir: examples/esp32-no-std-demo
target: ""
setup_xtensa: true
# EPD Waveshare demo
- name: epd-waveshare-demo
dir: examples/epd-waveshare-demo
target: ""
setup_xtensa: true
# STM32-Nucleo OLED Demo
- name: stm32-nucleo-oled-example
dir: examples/stm32-nucleo-oled-example
target: "thumbv7em-none-eabihf"
setup_xtensa: false
# Lilygo-epd47 demo
- name: lilygo-epd47-demo
dir: examples/lilygo-epd47-demo
target: ""
setup_xtensa: true
# RP2040-Zero EPD demo
- name: rp2040-1in54-epd-example
dir: examples/rp2040-1in54-epd-example
target: "thumbv6m-none-eabi"
setup_xtensa: false
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Rust (stable)
if: ${{ matrix.project.setup_xtensa == false }}
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rust-src
- name: Setup Xtensa toolchain (ESP-IDF)
if: ${{ matrix.project.setup_xtensa == true }}
uses: esp-rs/xtensa-toolchain@v1.6.0
with:
default: true
buildtargets: esp32
ldproxy: true
- name: Setup target
if: ${{ matrix.project.target != '' && matrix.project.setup_xtensa == false }}
run: rustup target add ${{ matrix.project.target }}
- name: Cache Cargo dependencies
uses: Swatinem/rust-cache@v2
- name: Run Clippy
working-directory: ${{ matrix.project.dir }}
run: |
if [ -n "${{ matrix.project.target }}" ]; then
cargo clippy --target "${{ matrix.project.target }}" -- -D warnings
else
cargo clippy -- -D warnings
fi
test:
runs-on: ubuntu-latest
name: Run tests
steps:
- uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo dependencies
uses: Swatinem/rust-cache@v2
- name: Run lib tests
run: cargo test --locked --lib --all-features
- name: Run doctests
run: cargo test --locked -p mousefood --doc
build-no-std:
name: build [no-std] ${{ matrix.target }} ${{ matrix.toolchain }}
strategy:
fail-fast: false
matrix:
target:
- arm-unknown-linux-gnueabi
- armv7-unknown-linux-gnueabihf
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
- thumbv7em-none-eabi
- thumbv7em-none-eabihf
- thumbv7m-none-eabi
toolchain: ["1.86.0", "stable"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
target: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- run: cargo build --release --target ${{ matrix.target }}
build-std:
name: build [build-std] ${{ matrix.example.target }} (${{ matrix.example.name }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
example:
- name: rp2040-example
dir: examples/rp2040-1in54-epd-example
target: thumbv6m-none-eabi
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
target: ${{ matrix.example.target }}
components: rust-src
- uses: Swatinem/rust-cache@v2
- name: Build ${{ matrix.example.name }}
working-directory: ${{ matrix.example.dir }}
run: cargo build --release
build-espidf-std:
name: build [std] ${{ matrix.target }}
strategy:
fail-fast: false
matrix:
target:
- riscv32imc-esp-espidf # esp32c2, esp32c3
- riscv32imac-esp-espidf # esp32c6, esp32h2
- xtensa-esp32-espidf
- xtensa-esp32s2-espidf
- xtensa-esp32s3-espidf
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: esp-rs/xtensa-toolchain@v1.6.0
with:
default: true
- uses: Swatinem/rust-cache@v2
- run: cargo build --release --features=std --target ${{ matrix.target }} -Zbuild-std=std,panic_abort
env:
RUSTFLAGS: "-Zunstable-options -Cpanic=immediate-abort"