ci: testexamples can use the same template

This commit is contained in:
datdenkikniet 2025-03-22 21:24:19 +01:00
parent 9d2b359db5
commit 8559a0c059

View file

@ -210,7 +210,7 @@ jobs:
run: |
cd qemu-${{ env.QEMU_VERSION }}
ninja -C build
- name: Download ESP32 QEMU
run: wget "${{ env.QEMU_ESP_URL }}" --output-document=${{ env.QEMU_ESP}}.tar.xz
@ -230,150 +230,51 @@ jobs:
name: qemu
path: qemu.tar
# Platform lm3s6965: verify the example output with run-pass tests
testexampleslm3s6965:
name: QEMU run (lm3s6965)
# Verify the example output with run-pass tests
testexamples:
name: QEMU run
needs: buildqemu
runs-on: ubuntu-22.04
strategy:
matrix:
backend:
- thumbv7
- thumbv6
toolchain:
- stable
input:
- backend: thumbv7
platform: lm3s6965
rustup-target: thumbv7m-none-eabi
qemu-system: arm
- backend: thumbv6
platform: lm3s6965
rustup-target: thumbv6m-none-eabi
qemu-system: arm
- backend: riscv32-imc-clint
platform: hifive1
rustup-target: riscv32imc-unknown-none-elf
qemu-system: riscv32
- backend: riscv32-imc-mecall
platform: hifive1
rustup-target: riscv32imc-unknown-none-elf
qemu-system: riscv32
- backend: riscv-esp32-c3
platform: esp32-c3
rustup-target: riscv32imc-unknown-none-elf
qemu-system: riscv32
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust ${{ matrix.toolchain }}
run: |
rustup set profile minimal
rustup override set ${{ matrix.toolchain }}
- name: Configure Rust target (v6, v7)
run: |
rustup target add thumbv7m-none-eabi
rustup target add thumbv6m-none-eabi
- name: Add Rust component llvm-tools-preview
run: rustup component add llvm-tools-preview
# Use precompiled binutils
- name: Install cargo-binutils
uses: taiki-e/install-action@v2
with:
tool: cargo-binutils
- name: Cache Dependencies
uses: Swatinem/rust-cache@v2
- name: Install QEMU to get dependencies
run: |
sudo apt update
sudo apt install -y qemu-system-arm
- name: Download built QEMU
uses: actions/download-artifact@v4
with:
name: qemu
- name: Extract QEMU into local path
run: tar -xf qemu.tar -C /usr/local/bin
- name: Check which QEMU is used
run: |
which qemu-system-arm
which qemu-system-riscv32
- name: Run-pass tests
run: cargo xtask --deny-warnings --platform lm3s6965 --backend ${{ matrix.backend }} qemu
# Platform hifive1: verify the example output with run-pass tests
testexampleshifive1:
name: QEMU run (hifive1)
needs: buildqemu
runs-on: ubuntu-22.04
strategy:
matrix:
backend:
- riscv32-imc-clint
- riscv32-imc-mecall
toolchain:
- stable
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust ${{ matrix.toolchain }}
run: |
rustup set profile minimal
rustup override set ${{ matrix.toolchain }}
- name: Configure Rust target
run: |
rustup target add riscv32imc-unknown-none-elf
run: rustup target add ${{ matrix.input.rustup-target }}
- name: Add Rust component llvm-tools-preview
run: rustup component add llvm-tools-preview
# Use precompiled binutils
- name: Install cargo-binutils
uses: taiki-e/install-action@v2
with:
tool: cargo-binutils
- name: Cache Dependencies
uses: Swatinem/rust-cache@v2
- name: Install QEMU to get dependencies
run: |
sudo apt update
sudo apt install -y qemu-system-riscv32
- name: Download built QEMU
uses: actions/download-artifact@v4
with:
name: qemu
- name: Extract QEMU into local path
run: tar -xf qemu.tar -C /usr/local/bin
- name: Check which QEMU is used
run: |
which qemu-system-arm
which qemu-system-riscv32
- name: Run-pass tests
run: cargo xtask --deny-warnings --platform hifive1 --backend ${{ matrix.backend }} qemu
# Platform esp32c3: verify the example output with run-pass tests
testexamplesesp32c3:
name: QEMU run (esp32c3)
needs: buildqemu
runs-on: ubuntu-22.04
strategy:
matrix:
toolchain:
- stable
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust ${{ matrix.toolchain }}
run: |
rustup set profile minimal
rustup override set ${{ matrix.toolchain }}
- name: Configure Rust target
run: |
rustup target add riscv32imac-unknown-none-elf
rustup target add riscv32imc-unknown-none-elf
- name: Add Rust component llvm-tools-preview
run: rustup component add llvm-tools-preview
- name: Install libudev espflash dependency
- name: Install lubudev espflash dependency
if: ${{ matrix.input.platform == 'esp32-c3' }}
run: |
sudo apt update
sudo apt install -y libudev-dev
@ -386,12 +287,11 @@ jobs:
# Use precompiled if possible
- name: Install espflash
if: ${{ matrix.input.platform == 'esp32-c3' }}
run: cargo install espflash --version 3.1.0 --force
# uses: taiki-e/install-action@v2
# with:
# tool: espflash
- name: Install esptool.py
if: ${{ matrix.input.platform == 'esp32-c3' }}
run: pip install esptool
- name: Cache Dependencies
@ -400,22 +300,22 @@ jobs:
- name: Install QEMU to get dependencies
run: |
sudo apt update
sudo apt install -y qemu-system-riscv32
sudo apt install -y qemu-system-${{ matrix.input.qemu-system }}
- name: Download built QEMU
uses: actions/download-artifact@v4
with:
name: qemu
- name: Extract ESP32 QEMU into local path
run: sudo tar --strip-components=1 -xf qemu.tar -C /usr/local/ esp32/
- name: Extract QEMU into local path
run: tar -xf qemu.tar -C /usr/local/bin
- name: Check which QEMU is used
run: |
which qemu-system-riscv32
which qemu-system-${{ matrix.input.qemu-system }}
- name: Run-pass tests
run: cargo xtask -v --platform esp32-c3 qemu
run: cargo xtask --deny-warnings --platform ${{ matrix.input.platform }} --backend ${{ matrix.input.backend }} qemu
# Run test suite
tests:
@ -852,9 +752,7 @@ jobs:
- clippylm3s6965
# - clippyhifive1 # TODO
- checkexamples
- testexampleslm3s6965
- testexampleshifive1
- testexamplesesp32c3
- testexamples
- tests
- docs
- mdbook