HIL #575
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: HIL | |
on: | |
merge_group: | |
workflow_dispatch: | |
inputs: | |
repository: | |
description: "Owner and repository to test" | |
required: true | |
default: 'esp-rs/esp-hal' | |
branch: | |
description: "Branch, tag or SHA to checkout." | |
required: true | |
default: "main" | |
env: | |
CARGO_TERM_COLOR: always | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
build-tests: | |
name: HIL Test | ${{ matrix.target.soc }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
target: | |
# RISC-V devices: | |
- soc: esp32c2 | |
rust-target: riscv32imc-unknown-none-elf | |
- soc: esp32c3 | |
rust-target: riscv32imc-unknown-none-elf | |
- soc: esp32c6 | |
rust-target: riscv32imac-unknown-none-elf | |
- soc: esp32h2 | |
rust-target: riscv32imac-unknown-none-elf | |
# # Xtensa devices: | |
- soc: esp32s2 | |
rust-target: xtensa-esp32s2-none-elf | |
- soc: esp32s3 | |
rust-target: xtensa-esp32s3-none-elf | |
steps: | |
- uses: actions/checkout@v4 | |
if: github.event_name != 'workflow_dispatch' | |
- uses: actions/checkout@v4 | |
if: github.event_name == 'workflow_dispatch' | |
with: | |
repository: ${{ github.event.inputs.repository }} | |
ref: ${{ github.event.inputs.branch }} | |
# Install the Rust toolchain for RISC-V devices: | |
- if: ${{ !contains(fromJson('["esp32", "esp32s2", "esp32s3"]'), matrix.target.soc) }} | |
uses: dtolnay/rust-toolchain@v1 | |
with: | |
target: ${{ matrix.target.rust-target }} | |
toolchain: stable | |
components: rust-src | |
# Install the Rust toolchain for Xtensa devices: | |
- if: contains(fromJson('["esp32", "esp32s2", "esp32s3"]'), matrix.target.soc) | |
uses: esp-rs/xtensa-toolchain@v1.5 | |
with: | |
buildtargets: ${{ matrix.target.soc }} | |
default: true | |
ldproxy: false | |
- name: Build tests | |
run: cargo xtask build-tests ${{ matrix.target.soc }} | |
- name: Prepare artifact | |
run: | | |
# Create the 'tests' directory if it doesn't exist | |
mkdir -p tests | |
# Find ELF files in the specified path and move them to 'tests' | |
find "hil-test/target/${{ matrix.target.rust-target }}/release/deps/" -type f -exec file {} + | \ | |
grep ELF | \ | |
awk -F: '{print $1}' | \ | |
xargs -I {} mv {} tests | |
# Rename files in 'tests' by removing everything after the first dash | |
for file in tests/*-*; do | |
base_name="$(basename "$file" | cut -d'-' -f1)" | |
mv "$file" "tests/$base_name" | |
done | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: tests-${{ matrix.target.soc }} | |
path: /home/runner/work/esp-hal/esp-hal/tests | |
if-no-files-found: error | |
overwrite: true | |
hil: | |
name: HIL Test | ${{ matrix.target.soc }} | |
needs: build-tests | |
runs-on: | |
labels: [self-hosted, "${{ matrix.target.runner }}"] | |
strategy: | |
fail-fast: false | |
matrix: | |
target: | |
# RISC-V devices: | |
- soc: esp32c2 | |
runner: esp32c2-jtag | |
usb: USB2 | |
- soc: esp32c3 | |
runner: esp32c3-usb | |
usb: ACM0 | |
- soc: esp32c6 | |
runner: esp32c6-usb | |
usb: ACM0 | |
- soc: esp32h2 | |
runner: esp32h2-usb | |
usb: USB0 | |
# Xtensa devices: | |
- soc: esp32s2 | |
runner: esp32s2-jtag | |
usb: USB1 | |
- soc: esp32s3 | |
runner: esp32s3-usb | |
usb: USB0 | |
steps: | |
- uses: actions/checkout@v4 | |
if: github.event_name != 'workflow_dispatch' | |
- uses: actions/checkout@v4 | |
if: github.event_name == 'workflow_dispatch' | |
with: | |
repository: ${{ github.event.inputs.repository }} | |
ref: ${{ github.event.inputs.branch }} | |
- uses: actions/download-artifact@v4 | |
with: | |
name: tests-${{ matrix.target.soc }} | |
path: tests-${{ matrix.target.soc }} | |
- name: Run Tests | |
id: run-tests | |
run: | | |
export PATH=$PATH:/home/espressif/.cargo/bin | |
cargo xtask run-elfs ${{ matrix.target.soc }} tests-${{ matrix.target.soc }} | |
- name: Erase Flash on Failure | |
if: ${{ failure() && steps.run-tests.conclusion == 'failure' }} | |
env: | |
ESPFLASH_PORT: /dev/tty${{ matrix.target.usb }} | |
run: | | |
export PATH=$PATH:/home/espressif/.cargo/bin | |
espflash erase-flash |