Skip to content

Commit ecb5ebc

Browse files
committed
ci: testexamples can use the same template
1 parent aa19006 commit ecb5ebc

File tree

1 file changed

+38
-140
lines changed

1 file changed

+38
-140
lines changed

.github/workflows/build.yml

Lines changed: 38 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ jobs:
210210
run: |
211211
cd qemu-${{ env.QEMU_VERSION }}
212212
ninja -C build
213-
213+
214214
- name: Download ESP32 QEMU
215215
run: wget "${{ env.QEMU_ESP_URL }}" --output-document=${{ env.QEMU_ESP}}.tar.xz
216216

@@ -230,150 +230,51 @@ jobs:
230230
name: qemu
231231
path: qemu.tar
232232

233-
# Platform lm3s6965: verify the example output with run-pass tests
234-
testexampleslm3s6965:
235-
name: QEMU run (lm3s6965)
233+
# Verify the example output with run-pass tests
234+
testexamples:
235+
name: QEMU run
236236
needs: buildqemu
237237
runs-on: ubuntu-22.04
238238
strategy:
239239
matrix:
240-
backend:
241-
- thumbv7
242-
- thumbv6
243-
toolchain:
244-
- stable
245-
steps:
246-
- name: Checkout
247-
uses: actions/checkout@v4
248-
249-
- name: Install Rust ${{ matrix.toolchain }}
250-
run: |
251-
rustup set profile minimal
252-
rustup override set ${{ matrix.toolchain }}
253-
254-
- name: Configure Rust target (v6, v7)
255-
run: |
256-
rustup target add thumbv7m-none-eabi
257-
rustup target add thumbv6m-none-eabi
258-
259-
- name: Add Rust component llvm-tools-preview
260-
run: rustup component add llvm-tools-preview
261-
262-
# Use precompiled binutils
263-
- name: Install cargo-binutils
264-
uses: taiki-e/install-action@v2
265-
with:
266-
tool: cargo-binutils
267-
268-
- name: Cache Dependencies
269-
uses: Swatinem/rust-cache@v2
270-
271-
- name: Install QEMU to get dependencies
272-
run: |
273-
sudo apt update
274-
sudo apt install -y qemu-system-arm
275-
276-
- name: Download built QEMU
277-
uses: actions/download-artifact@v4
278-
with:
279-
name: qemu
280-
281-
- name: Extract QEMU into local path
282-
run: tar -xf qemu.tar -C /usr/local/bin
283-
284-
- name: Check which QEMU is used
285-
run: |
286-
which qemu-system-arm
287-
which qemu-system-riscv32
288-
289-
- name: Run-pass tests
290-
run: cargo xtask --deny-warnings --platform lm3s6965 --backend ${{ matrix.backend }} qemu
291-
292-
# Platform hifive1: verify the example output with run-pass tests
293-
testexampleshifive1:
294-
name: QEMU run (hifive1)
295-
needs: buildqemu
296-
runs-on: ubuntu-22.04
297-
strategy:
298-
matrix:
299-
backend:
300-
- riscv32-imc-clint
301-
- riscv32-imc-mecall
302-
toolchain:
303-
- stable
304-
steps:
305-
- name: Checkout
306-
uses: actions/checkout@v4
307-
308-
- name: Install Rust ${{ matrix.toolchain }}
309-
run: |
310-
rustup set profile minimal
311-
rustup override set ${{ matrix.toolchain }}
312-
313-
- name: Configure Rust target
314-
run: |
315-
rustup target add riscv32imc-unknown-none-elf
316-
317-
- name: Add Rust component llvm-tools-preview
318-
run: rustup component add llvm-tools-preview
240+
input:
241+
- backend: thumbv7
242+
platform: lm3s6965
243+
rustup-target: thumbv7m-none-eabi
244+
qemu-system: arm
319245

320-
# Use precompiled binutils
321-
- name: Install cargo-binutils
322-
uses: taiki-e/install-action@v2
323-
with:
324-
tool: cargo-binutils
246+
- backend: thumbv6
247+
platform: lm3s6965
248+
rustup-target: thumbv6m-none-eabi
249+
qemu-system: arm
325250

326-
- name: Cache Dependencies
327-
uses: Swatinem/rust-cache@v2
328-
329-
- name: Install QEMU to get dependencies
330-
run: |
331-
sudo apt update
332-
sudo apt install -y qemu-system-riscv32
251+
- backend: riscv32-imc-clint
252+
platform: hifive1
253+
rustup-target: riscv32imc-unknown-none-elf
254+
qemu-system: riscv32
333255

334-
- name: Download built QEMU
335-
uses: actions/download-artifact@v4
336-
with:
337-
name: qemu
338-
339-
- name: Extract QEMU into local path
340-
run: tar -xf qemu.tar -C /usr/local/bin
256+
- backend: riscv32-imc-mecall
257+
platform: hifive1
258+
rustup-target: riscv32imc-unknown-none-elf
259+
qemu-system: riscv32
341260

342-
- name: Check which QEMU is used
343-
run: |
344-
which qemu-system-arm
345-
which qemu-system-riscv32
346-
347-
- name: Run-pass tests
348-
run: cargo xtask --deny-warnings --platform hifive1 --backend ${{ matrix.backend }} qemu
261+
- backend: riscv-esp32-c3
262+
platform: esp32-c3
263+
rustup-target: riscv32imc-unknown-none-elf
264+
qemu-system: riscv32
349265

350-
# Platform esp32c3: verify the example output with run-pass tests
351-
testexamplesesp32c3:
352-
name: QEMU run (esp32c3)
353-
needs: buildqemu
354-
runs-on: ubuntu-22.04
355-
strategy:
356-
matrix:
357-
toolchain:
358-
- stable
359266
steps:
360267
- name: Checkout
361268
uses: actions/checkout@v4
362269

363-
- name: Install Rust ${{ matrix.toolchain }}
364-
run: |
365-
rustup set profile minimal
366-
rustup override set ${{ matrix.toolchain }}
367-
368270
- name: Configure Rust target
369-
run: |
370-
rustup target add riscv32imac-unknown-none-elf
371-
rustup target add riscv32imc-unknown-none-elf
271+
run: rustup target add ${{ matrix.input.rustup-target }}
372272

373273
- name: Add Rust component llvm-tools-preview
374274
run: rustup component add llvm-tools-preview
375275

376-
- name: Install libudev espflash dependency
276+
- name: Install lubudev espflash dependency
277+
if: ${{ matrix.input.platform == 'esp32-c3' }}
377278
run: |
378279
sudo apt update
379280
sudo apt install -y libudev-dev
@@ -386,12 +287,11 @@ jobs:
386287

387288
# Use precompiled if possible
388289
- name: Install espflash
290+
if: ${{ matrix.input.platform == 'esp32-c3' }}
389291
run: cargo install espflash --version 3.1.0 --force
390-
# uses: taiki-e/install-action@v2
391-
# with:
392-
# tool: espflash
393292

394293
- name: Install esptool.py
294+
if: ${{ matrix.input.platform == 'esp32-c3' }}
395295
run: pip install esptool
396296

397297
- name: Cache Dependencies
@@ -400,22 +300,22 @@ jobs:
400300
- name: Install QEMU to get dependencies
401301
run: |
402302
sudo apt update
403-
sudo apt install -y qemu-system-riscv32
303+
sudo apt install -y qemu-system-${{ matrix.input.qemu-system }}
404304
405305
- name: Download built QEMU
406306
uses: actions/download-artifact@v4
407307
with:
408308
name: qemu
409-
410-
- name: Extract ESP32 QEMU into local path
411-
run: sudo tar --strip-components=1 -xf qemu.tar -C /usr/local/ esp32/
309+
310+
- name: Extract QEMU into local path
311+
run: tar -xf qemu.tar -C /usr/local/bin
412312

413313
- name: Check which QEMU is used
414314
run: |
415-
which qemu-system-riscv32
416-
315+
which qemu-system-${{ matrix.input.qemu-system }}
316+
417317
- name: Run-pass tests
418-
run: cargo xtask -v --platform esp32-c3 qemu
318+
run: cargo xtask --deny-warnings --platform ${{ matrix.input.platform }} --backend ${{ matrix.backend }} qemu
419319

420320
# Run test suite
421321
tests:
@@ -852,9 +752,7 @@ jobs:
852752
- clippylm3s6965
853753
# - clippyhifive1 # TODO
854754
- checkexamples
855-
- testexampleslm3s6965
856-
- testexampleshifive1
857-
- testexamplesesp32c3
755+
- testexamples
858756
- tests
859757
- docs
860758
- mdbook

0 commit comments

Comments
 (0)