-
Notifications
You must be signed in to change notification settings - Fork 54
198 lines (195 loc) · 9.34 KB
/
ci_cargo.yml
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
name: Cargo CI
on:
push:
paths:
- "cargo/**"
- ".github/workflows/ci_cargo.yml"
pull_request:
paths:
- "cargo/**"
- ".github/workflows/ci_cargo.yml"
schedule:
- cron: "50 7 * * *"
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
cargo-checks-v5:
name: "${{ matrix.target }} | ${{ matrix.esp-idf.version }} | std(hal):${{ matrix.std-config.std }}(${{ matrix.std-config.hal }})"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: ["esp32", "esp32c3", esp32c2, esp32c6, esp32h2, "esp32s2", "esp32s3"]
std-config:
- hal: false
std: false
- hal: true
std: true
- hal: true
std: false
esp-idf:
- version: v5.1
# - version: master
# name: master
steps:
- name: Setup | Rust (RISC-V)
if: matrix.target != 'esp32' && matrix.target != 'esp32s2' && matrix.target != 'esp32s3'
uses: dtolnay/rust-toolchain@v1
with:
toolchain: nightly
components: clippy, rustfmt, rust-src
- name: Setup | Rust (Xtensa)
if: matrix.target == 'esp32' || matrix.target == 'esp32s2' || matrix.target == 'esp32s3'
uses: esp-rs/[email protected]
with:
default: true
buildtargets: ${{ matrix.target }}
ldproxy: false
version: "1.69.0"
- uses: Swatinem/rust-cache@v2
- name: Setup | cargo-generate (binary)
id: cargo-generate-binary
continue-on-error: true
run: |
sudo curl -L "https://github.com/cargo-generate/cargo-generate/releases/latest/download/cargo-generate-$(git ls-remote --refs --sort="version:refname" --tags "https://github.com/cargo-generate/cargo-generate" | cut -d/ -f3- | tail -n1)-x86_64-unknown-linux-gnu.tar.gz" -o "/home/runner/.cargo/bin/cargo-generate.tar.gz"
tar xf "/home/runner/.cargo/bin/cargo-generate.tar.gz" -C /home/runner/.cargo/bin
chmod u+x /home/runner/.cargo/bin/cargo-generate
- name: Setup | cargo-generate (cargo)
if: steps.cargo-generate-binary.outcome != 'success'
run: cargo install cargo-generate
- name: Setup | ldproxy (binary)
id: ldproxy-binary
continue-on-error: true
run: |
sudo curl -L "https://github.com/esp-rs/embuild/releases/latest/download/ldproxy-x86_64-unknown-linux-gnu.zip" -o "/home/runner/.cargo/bin/ldproxy.zip"
unzip "/home/runner/.cargo/bin/ldproxy.zip" -d "/home/runner/.cargo/bin/"
chmod u+x /home/runner/.cargo/bin/ldproxy
- name: Setup | ldproxy (cargo)
if: steps.ldproxy-binary.outcome != 'success'
run: cargo install ldproxy
- uses: actions/checkout@v4
with:
path: /home/runner/work/esp-idf-template/esp-idf-template/github-esp-idf-template
- name: Generate
run: cargo generate --path /home/runner/work/esp-idf-template/esp-idf-template/github-esp-idf-template cargo --name test --vcs none --silent -d mcu=${{ matrix.target }} -d advanced=true -d espidfver=${{ matrix.esp-idf.version }} -d hal=${{ matrix.std-config.hal }} -d std=${{ matrix.std-config.std }} -d devcontainer=false -d wokwi=false -d ci=false
- name: Build | Fmt Check (RISC-V)
if: matrix.target != 'esp32' && matrix.target != 'esp32s2' && matrix.target != 'esp32s3'
run: cd test; cargo fmt -- --check
- name: Build | Clippy (RISC-V)
if: matrix.target != 'esp32' && matrix.target != 'esp32s2' && matrix.target != 'esp32s3'
run: cd test; cargo clippy --no-deps -- -Dwarnings
- name: Build | Compile
run: cd test; cargo build
cargo-checks-v4:
name: "${{ matrix.target }} | ${{ matrix.esp-idf.version }} | std(hal):${{ matrix.std-config.std }}(${{ matrix.std-config.hal }})"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: ["esp32", "esp32c3", "esp32s2", "esp32s3"]
std-config:
- hal: false
std: false
- hal: true
std: true
- hal: true
std: false
esp-idf:
- version: v4.4
steps:
- name: Setup | Rust (RISC-V)
if: matrix.target != 'esp32' && matrix.target != 'esp32s2' && matrix.target != 'esp32s3'
uses: dtolnay/rust-toolchain@v1
with:
toolchain: nightly
components: clippy, rustfmt, rust-src
- name: Setup | Rust (Xtensa)
if: matrix.target == 'esp32' || matrix.target == 'esp32s2' || matrix.target == 'esp32s3'
uses: esp-rs/[email protected]
with:
default: true
buildtargets: ${{ matrix.target }}
ldproxy: false
- uses: Swatinem/rust-cache@v2
- name: Setup | cargo-generate (binary)
id: cargo-generate-binary
continue-on-error: true
run: |
sudo curl -L "https://github.com/cargo-generate/cargo-generate/releases/latest/download/cargo-generate-$(git ls-remote --refs --sort="version:refname" --tags "https://github.com/cargo-generate/cargo-generate" | cut -d/ -f3- | tail -n1)-x86_64-unknown-linux-gnu.tar.gz" -o "/home/runner/.cargo/bin/cargo-generate.tar.gz"
tar xf "/home/runner/.cargo/bin/cargo-generate.tar.gz" -C /home/runner/.cargo/bin
chmod u+x /home/runner/.cargo/bin/cargo-generate
- name: Setup | cargo-generate (cargo)
if: steps.cargo-generate-binary.outcome != 'success'
run: cargo install cargo-generate
- name: Setup | ldproxy (binary)
id: ldproxy-binary
continue-on-error: true
run: |
sudo curl -L "https://github.com/esp-rs/embuild/releases/latest/download/ldproxy-x86_64-unknown-linux-gnu.zip" -o "/home/runner/.cargo/bin/ldproxy.zip"
unzip "/home/runner/.cargo/bin/ldproxy.zip" -d "/home/runner/.cargo/bin/"
chmod u+x /home/runner/.cargo/bin/ldproxy
- name: Setup | ldproxy (cargo)
if: steps.ldproxy-binary.outcome != 'success'
run: cargo install ldproxy
- uses: actions/checkout@v4
with:
path: /home/runner/work/esp-idf-template/esp-idf-template/github-esp-idf-template
- name: Generate
if: matrix.std-config.std == true
run: cargo generate --path /home/runner/work/esp-idf-template/esp-idf-template/github-esp-idf-template cargo --name test --vcs none --silent -d mcu=${{ matrix.target }} -d advanced=true -d espidfver=${{ matrix.esp-idf.version }} -d hal=${{ matrix.std-config.hal }} -d std=${{ matrix.std-config.std }} -d devcontainer=false -d wokwi=false -d ci=false
- name: Build | Fmt Check (RISC-V)
if: matrix.target != 'esp32' && matrix.target != 'esp32s2' && matrix.target != 'esp32s3'
run: cd test; cargo fmt -- --check
- name: Build | Clippy (RISC-V)
if: matrix.target != 'esp32' && matrix.target != 'esp32s2' && matrix.target != 'esp32s3'
run: cd test; cargo clippy --no-deps -- -Dwarnings
- name: Build | Compile
run: cd test; cargo build
container-check:
name: "Container Check: ${{ matrix.target }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: ["esp32", "esp32s2", "esp32s3", "esp32c3"]
steps:
- run: rustup toolchain install stable --profile minimal
- uses: Swatinem/rust-cache@v2
- name: Setup | cargo-generate (binary)
id: binaries
continue-on-error: true
run: |
sudo curl -L "https://github.com/cargo-generate/cargo-generate/releases/latest/download/cargo-generate-$(git ls-remote --refs --sort="version:refname" --tags "https://github.com/cargo-generate/cargo-generate" | cut -d/ -f3- | tail -n1)-x86_64-unknown-linux-gnu.tar.gz" -o "/home/runner/.cargo/bin/cargo-generate.tar.gz"
tar xf "/home/runner/.cargo/bin/cargo-generate.tar.gz" -C /home/runner/.cargo/bin
chmod u+x /home/runner/.cargo/bin/cargo-generate
- name: Setup | cargo-generate (cargo)
if: steps.binaries.outcome != 'success'
run: cargo install cargo-generate
- uses: Swatinem/rust-cache@v2
- uses: actions/checkout@v4
with:
path: /home/runner/work/esp-idf-template/esp-idf-template/github-esp-idf-template
- name: Generate
run: cargo generate --path /home/runner/work/esp-idf-template/esp-idf-template/github-esp-idf-template cargo --name test-${{ matrix.target }} --vcs none --silent -d mcu=${{ matrix.target }} -d advanced=true -d espidfver=v5.1 -d hal=true -d std=true -d devcontainer=false -d wokwi=false -d ci=false
- name: Update ownership
run: |
sudo chown 1000:1000 -R test-${{ matrix.target }}
- uses: docker/build-push-action@v5
with:
context: .
tags: test-${{ matrix.target }}:latest
build-args: |
ESP_BOARD=${{ matrix.target }}
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
file: test-${{ matrix.target }}/.devcontainer/Dockerfile
push: false
- name: Build project inside the container
uses: addnab/docker-run-action@v3
with:
image: test-${{ matrix.target }}:latest
options: -u esp -v ${{ github.workspace }}/test-${{ matrix.target }}:/home/esp/test-${{ matrix.target }}
run: |
cd /home/esp/test-${{ matrix.target }}
bash -c 'source /home/esp/export-esp.sh && cargo build'