mirror of
https://github.com/esp-rs/esp-hal.git
synced 2026-03-14 08:33:46 +00:00
529 lines
17 KiB
YAML
529 lines
17 KiB
YAML
name: HIL
|
|
|
|
run-name: >
|
|
${{ github.event_name == 'merge_group' && 'HIL (merge queue)' ||
|
|
|
|
github.event.inputs.pr_number != '' &&
|
|
format(
|
|
'HIL for PR #{0} ({1}{2})',
|
|
github.event.inputs.pr_number,
|
|
github.event.inputs.chips != '' && github.event.inputs.chips || github.event.inputs.matrix,
|
|
github.event.inputs.tests != '' && format('; tests: {0}', github.event.inputs.tests) || ''
|
|
) ||
|
|
|
|
format(
|
|
'HIL (manual dispatch, {0}{1})',
|
|
github.event.inputs.chips != '' && github.event.inputs.chips || github.event.inputs.matrix,
|
|
github.event.inputs.tests != '' && format('; tests: {0}', github.event.inputs.tests) || ''
|
|
)
|
|
}}
|
|
|
|
on:
|
|
# No automatic PR runs; we'll trigger via slash/label + keep merge queue
|
|
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"
|
|
# choose quick or full matrix
|
|
matrix:
|
|
description: "Test matrix size: quick|full|chips"
|
|
required: false
|
|
default: "quick"
|
|
pr_number:
|
|
description: "Pull request number (for slash-triggered runs)"
|
|
required: false
|
|
default: ""
|
|
chips:
|
|
description: "Space-separated list of SoCs to test (for per-chip runs)"
|
|
required: false
|
|
default: ""
|
|
tests:
|
|
description: "Optional list of test names to run (ELF basenames)"
|
|
required: false
|
|
default: ""
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
jobs:
|
|
get-labels:
|
|
uses: ./.github/workflows/get-labels.yml
|
|
build-xtasks:
|
|
needs: get-labels
|
|
if: >
|
|
!contains(needs.get-labels.outputs.labels, 'skip-ci')
|
|
name: Build xtasks
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
# merge_group checks out the merge commit implicitly
|
|
- uses: actions/checkout@v6
|
|
if: github.event_name == 'merge_group'
|
|
# workflow_dispatch: checkout requested repo+ref (prefer SHA when given)
|
|
- uses: actions/checkout@v6
|
|
if: github.event_name == 'workflow_dispatch'
|
|
with:
|
|
repository: ${{ github.event.inputs.repository }}
|
|
ref: ${{ github.event.inputs.branch }}
|
|
|
|
- name: Install target for cross-compilation
|
|
run: |
|
|
rustup target add aarch64-unknown-linux-gnu
|
|
rustup target add armv7-unknown-linux-gnueabihf
|
|
- name: Install cross
|
|
uses: taiki-e/install-action@v2
|
|
with:
|
|
tool: cross
|
|
|
|
- name: Cache Dependencies
|
|
uses: Swatinem/rust-cache@v2
|
|
|
|
- name: Build xtasks
|
|
run: |
|
|
cross build --release --target armv7-unknown-linux-gnueabihf -p xtask
|
|
cross build --release --target aarch64-unknown-linux-gnu -p xtask
|
|
|
|
- name: Upload artifact | armv7-unknown-linux-gnueabihf
|
|
uses: actions/upload-artifact@v6
|
|
with:
|
|
name: xtask-armv7
|
|
path: target/armv7-unknown-linux-gnueabihf/release/xtask
|
|
|
|
- name: Upload artifact | aarch64-unknown-linux-gnu
|
|
uses: actions/upload-artifact@v6
|
|
with:
|
|
name: xtask-aarch64
|
|
path: target/aarch64-unknown-linux-gnu/release/xtask
|
|
|
|
# NOTE:
|
|
# There is also a dummy job named 'build-tests-full' in `ci.yml` which runs
|
|
# only on non-merge-group events to satisfy branch protection required
|
|
# checks on PRs.
|
|
#
|
|
# This job is the *real* HIL test-build job, used on merge_group and when
|
|
# triggered via `/hil full`.
|
|
build-tests-full:
|
|
needs: get-labels
|
|
if: >
|
|
github.event_name == 'merge_group' ||
|
|
(github.event_name == 'workflow_dispatch' &&
|
|
github.event.inputs.matrix == 'full' &&
|
|
github.event.inputs.chips == '')
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
SKIP_CI: ${{ contains(needs.get-labels.outputs.labels, 'skip-ci-non-code-change') }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
target:
|
|
- soc: esp32c2
|
|
rust-target: riscv32imc-unknown-none-elf
|
|
runner: esp32c2-jtag
|
|
host: aarch64
|
|
- soc: esp32c3
|
|
rust-target: riscv32imc-unknown-none-elf
|
|
runner: esp32c3-usb
|
|
host: armv7
|
|
- soc: esp32c5
|
|
rust-target: riscv32imac-unknown-none-elf
|
|
runner: esp32c5-usb
|
|
host: aarch64
|
|
- soc: esp32c6
|
|
rust-target: riscv32imac-unknown-none-elf
|
|
runner: esp32c6-usb
|
|
host: armv7
|
|
- soc: esp32h2
|
|
rust-target: riscv32imac-unknown-none-elf
|
|
runner: esp32h2-usb
|
|
host: armv7
|
|
- soc: esp32
|
|
rust-target: xtensa-esp32-none-elf
|
|
runner: esp32-jtag
|
|
host: aarch64
|
|
- soc: esp32s2
|
|
rust-target: xtensa-esp32s2-none-elf
|
|
runner: esp32s2-jtag
|
|
host: armv7
|
|
- soc: esp32s3
|
|
rust-target: xtensa-esp32s3-none-elf
|
|
runner: esp32s3-usb
|
|
host: armv7
|
|
steps:
|
|
- name: Skip CI
|
|
if: env.SKIP_CI == 'true'
|
|
run: |
|
|
echo "skipping"
|
|
|
|
- uses: actions/checkout@v6
|
|
if: env.SKIP_CI != 'true'
|
|
|
|
- uses: ./.github/actions/build-tests
|
|
if: env.SKIP_CI != 'true'
|
|
with:
|
|
event_name: ${{ github.event_name }}
|
|
repository: ${{ github.event.inputs.repository || github.repository }}
|
|
branch: ${{ github.event.inputs.branch || 'main' }}
|
|
soc: ${{ matrix.target.soc }}
|
|
rust_target: ${{ matrix.target.rust-target }}
|
|
tests: ${{ github.event.inputs.tests || '' }}
|
|
|
|
build-tests-quick:
|
|
if: >
|
|
github.event_name == 'workflow_dispatch' &&
|
|
github.event.inputs.chips == '' &&
|
|
github.event.inputs.matrix != 'full'
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
target:
|
|
- soc: esp32c6
|
|
rust-target: riscv32imac-unknown-none-elf
|
|
runner: esp32c6-usb
|
|
host: armv7
|
|
- soc: esp32s3
|
|
rust-target: xtensa-esp32s3-none-elf
|
|
runner: esp32s3-usb
|
|
host: armv7
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: ./.github/actions/build-tests
|
|
with:
|
|
event_name: ${{ github.event_name }}
|
|
repository: ${{ github.event.inputs.repository || github.repository }}
|
|
branch: ${{ github.event.inputs.branch || 'main' }}
|
|
soc: ${{ matrix.target.soc }}
|
|
rust_target: ${{ matrix.target.rust-target }}
|
|
tests: ${{ github.event.inputs.tests || '' }}
|
|
|
|
build-tests-chips:
|
|
if: github.event_name == 'workflow_dispatch' && github.event.inputs.chips != ''
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
target:
|
|
- soc: esp32c2
|
|
rust-target: riscv32imc-unknown-none-elf
|
|
runner: esp32c2-jtag
|
|
host: aarch64
|
|
- soc: esp32c3
|
|
rust-target: riscv32imc-unknown-none-elf
|
|
runner: esp32c3-usb
|
|
host: armv7
|
|
- soc: esp32c5
|
|
rust-target: riscv32imac-unknown-none-elf
|
|
runner: esp32c5-usb
|
|
host: aarch64
|
|
- soc: esp32c6
|
|
rust-target: riscv32imac-unknown-none-elf
|
|
runner: esp32c6-usb
|
|
host: armv7
|
|
- soc: esp32h2
|
|
rust-target: riscv32imac-unknown-none-elf
|
|
runner: esp32h2-usb
|
|
host: armv7
|
|
- soc: esp32
|
|
rust-target: xtensa-esp32-none-elf
|
|
runner: esp32-jtag
|
|
host: aarch64
|
|
- soc: esp32s2
|
|
rust-target: xtensa-esp32s2-none-elf
|
|
runner: esp32s2-jtag
|
|
host: armv7
|
|
- soc: esp32s3
|
|
rust-target: xtensa-esp32s3-none-elf
|
|
runner: esp32s3-usb
|
|
host: armv7
|
|
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
repository: ${{ github.event.inputs.repository || github.repository }}
|
|
ref: ${{ github.event.inputs.branch || 'main' }}
|
|
|
|
- name: Decide if this SoC is requested
|
|
id: filter
|
|
run: |
|
|
CHIPS="${{ github.event.inputs.chips }}"
|
|
SOC="${{ matrix.target.soc }}"
|
|
if echo " $CHIPS " | grep -qw "$SOC"; then
|
|
echo "run=true" >> $GITHUB_OUTPUT
|
|
echo "Including $SOC in this per-chip run."
|
|
else
|
|
echo "run=false" >> $GITHUB_OUTPUT
|
|
echo "Skipping $SOC (not requested)."
|
|
fi
|
|
|
|
- uses: ./.github/actions/build-tests
|
|
if: steps.filter.outputs.run == 'true'
|
|
with:
|
|
event_name: ${{ github.event_name }}
|
|
repository: ${{ github.event.inputs.repository || github.repository }}
|
|
branch: ${{ github.event.inputs.branch || 'main' }}
|
|
soc: ${{ matrix.target.soc }}
|
|
rust_target: ${{ matrix.target.rust-target }}
|
|
tests: ${{ github.event.inputs.tests || '' }}
|
|
|
|
hil-quick:
|
|
if: >
|
|
github.event_name == 'workflow_dispatch' &&
|
|
github.event.inputs.chips == '' &&
|
|
github.event.inputs.matrix != 'full'
|
|
needs: [build-tests-quick, build-xtasks]
|
|
runs-on:
|
|
labels: [self-hosted, "${{ matrix.target.runner }}"]
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
target:
|
|
- soc: esp32c6
|
|
rust-target: riscv32imac-unknown-none-elf
|
|
runner: esp32c6-usb
|
|
host: armv7
|
|
- soc: esp32s3
|
|
rust-target: xtensa-esp32s3-none-elf
|
|
runner: esp32s3-usb
|
|
host: armv7
|
|
steps:
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
name: tests-${{ matrix.target.soc }}
|
|
path: tests-${{ matrix.target.soc }}
|
|
# In a quick run, some artifacts won't exist — job wouldn't fail because of that.
|
|
continue-on-error: true
|
|
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
name: xtask-${{ matrix.target.host }}
|
|
|
|
- name: Skip if this target wasn't built
|
|
id: guard
|
|
run: |
|
|
if [ ! -d "tests-${{ matrix.target.soc }}" ]; then
|
|
echo "skip=true" >> $GITHUB_OUTPUT
|
|
echo "No tests for ${{ matrix.target.soc }} in this run; skipping."
|
|
fi
|
|
|
|
- name: Compute tests arg
|
|
if: steps.guard.outputs.skip != 'true'
|
|
id: tests
|
|
run: |
|
|
if [ -n "${{ github.event.inputs.tests || '' }}" ]; then
|
|
echo "value=--elfs ${{ github.event.inputs.tests }}" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "value=" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Run Tests
|
|
if: steps.guard.outputs.skip != 'true'
|
|
id: run-tests
|
|
run: |
|
|
[ -f ~/setup.sh ] && source ~/setup.sh
|
|
|
|
export PATH=$PATH:/home/espressif/.cargo/bin
|
|
chmod +x xtask
|
|
./xtask run elfs ${{ matrix.target.soc }} tests-${{ matrix.target.soc }} ${{ steps.tests.outputs.value }}
|
|
|
|
- name: Clean up
|
|
if: always()
|
|
run: |
|
|
rm -rf tests-${{ matrix.target.soc }} || true
|
|
rm -f xtask || true
|
|
|
|
hil-full:
|
|
if: >
|
|
!contains(needs.get-labels.outputs.labels, 'skip-ci') &&
|
|
(
|
|
github.event_name == 'merge_group' ||
|
|
(github.event_name == 'workflow_dispatch' &&
|
|
github.event.inputs.matrix == 'full' &&
|
|
github.event.inputs.chips == '')
|
|
)
|
|
needs: [build-tests-full, build-xtasks, get-labels]
|
|
runs-on:
|
|
labels: [self-hosted, "${{ matrix.target.runner }}"]
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
target:
|
|
- soc: esp32c2
|
|
rust-target: riscv32imc-unknown-none-elf
|
|
runner: esp32c2-jtag
|
|
host: aarch64
|
|
- soc: esp32c3
|
|
rust-target: riscv32imc-unknown-none-elf
|
|
runner: esp32c3-usb
|
|
host: armv7
|
|
- soc: esp32c5
|
|
rust-target: riscv32imac-unknown-none-elf
|
|
runner: esp32c5-usb
|
|
host: aarch64
|
|
- soc: esp32c6
|
|
rust-target: riscv32imac-unknown-none-elf
|
|
runner: esp32c6-usb
|
|
host: armv7
|
|
- soc: esp32h2
|
|
rust-target: riscv32imac-unknown-none-elf
|
|
runner: esp32h2-usb
|
|
host: armv7
|
|
- soc: esp32
|
|
rust-target: xtensa-esp32-none-elf
|
|
runner: esp32-jtag
|
|
host: aarch64
|
|
- soc: esp32s2
|
|
rust-target: xtensa-esp32s2-none-elf
|
|
runner: esp32s2-jtag
|
|
host: armv7
|
|
- soc: esp32s3
|
|
rust-target: xtensa-esp32s3-none-elf
|
|
runner: esp32s3-usb
|
|
host: armv7
|
|
steps:
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
name: tests-${{ matrix.target.soc }}
|
|
path: tests-${{ matrix.target.soc }}
|
|
continue-on-error: true
|
|
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
name: xtask-${{ matrix.target.host }}
|
|
|
|
- name: Skip if this target wasn't built
|
|
id: guard
|
|
run: |
|
|
if [ ! -d "tests-${{ matrix.target.soc }}" ]; then
|
|
echo "skip=true" >> $GITHUB_OUTPUT
|
|
echo "No tests for ${{ matrix.target.soc }} in this run; skipping."
|
|
fi
|
|
|
|
- name: Compute tests arg
|
|
if: steps.guard.outputs.skip != 'true'
|
|
id: tests
|
|
run: |
|
|
if [ -n "${{ github.event.inputs.tests || '' }}" ]; then
|
|
echo "value=--elfs ${{ github.event.inputs.tests }}" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "value=" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Run Tests
|
|
if: steps.guard.outputs.skip != 'true'
|
|
id: run-tests
|
|
run: |
|
|
[ -f ~/setup.sh ] && source ~/setup.sh
|
|
|
|
export PATH=$PATH:/home/espressif/.cargo/bin
|
|
chmod +x xtask
|
|
./xtask run elfs ${{ matrix.target.soc }} tests-${{ matrix.target.soc }} ${{ steps.tests.outputs.value }}
|
|
|
|
- name: Clean up
|
|
if: always()
|
|
run: |
|
|
rm -rf tests-${{ matrix.target.soc }} || true
|
|
rm -f xtask || true
|
|
|
|
hil-chips:
|
|
if: github.event_name == 'workflow_dispatch' && github.event.inputs.chips != ''
|
|
needs: [build-tests-chips, build-xtasks]
|
|
runs-on:
|
|
labels: [self-hosted, "${{ matrix.target.runner }}"]
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
target:
|
|
- soc: esp32c2
|
|
rust-target: riscv32imc-unknown-none-elf
|
|
runner: esp32c2-jtag
|
|
host: aarch64
|
|
- soc: esp32c3
|
|
rust-target: riscv32imc-unknown-none-elf
|
|
runner: esp32c3-usb
|
|
host: armv7
|
|
- soc: esp32c5
|
|
rust-target: riscv32imac-unknown-none-elf
|
|
runner: esp32c5-usb
|
|
host: aarch64
|
|
- soc: esp32c6
|
|
rust-target: riscv32imac-unknown-none-elf
|
|
runner: esp32c6-usb
|
|
host: armv7
|
|
- soc: esp32h2
|
|
rust-target: riscv32imac-unknown-none-elf
|
|
runner: esp32h2-usb
|
|
host: armv7
|
|
- soc: esp32
|
|
rust-target: xtensa-esp32-none-elf
|
|
runner: esp32-jtag
|
|
host: aarch64
|
|
- soc: esp32s2
|
|
rust-target: xtensa-esp32s2-none-elf
|
|
runner: esp32s2-jtag
|
|
host: armv7
|
|
- soc: esp32s3
|
|
rust-target: xtensa-esp32s3-none-elf
|
|
runner: esp32s3-usb
|
|
host: armv7
|
|
steps:
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
name: tests-${{ matrix.target.soc }}
|
|
path: tests-${{ matrix.target.soc }}
|
|
continue-on-error: true
|
|
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
name: xtask-${{ matrix.target.host }}
|
|
|
|
- name: Skip if this target wasn't built
|
|
id: guard
|
|
run: |
|
|
if [ ! -d "tests-${{ matrix.target.soc }}" ]; then
|
|
echo "skip=true" >> $GITHUB_OUTPUT
|
|
echo "No tests for ${{ matrix.target.soc }} in this per-chip run; skipping."
|
|
fi
|
|
|
|
- name: Compute tests arg
|
|
if: steps.guard.outputs.skip != 'true'
|
|
id: tests
|
|
run: |
|
|
if [ -n "${{ github.event.inputs.tests || '' }}" ]; then
|
|
echo "value=--elfs ${{ github.event.inputs.tests }}" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "value=" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Run Tests
|
|
if: steps.guard.outputs.skip != 'true'
|
|
id: run-tests
|
|
run: |
|
|
[ -f ~/setup.sh ] && source ~/setup.sh
|
|
|
|
export PATH=$PATH:/home/espressif/.cargo/bin
|
|
chmod +x xtask
|
|
./xtask run elfs ${{ matrix.target.soc }} tests-${{ matrix.target.soc }} ${{ steps.tests.outputs.value }}
|
|
|
|
- name: Clean up
|
|
if: always()
|
|
run: |
|
|
rm -rf tests-${{ matrix.target.soc }} || true
|
|
rm -f xtask || true
|
|
|
|
required:
|
|
needs: get-labels
|
|
if: >
|
|
github.event_name == 'merge_group' &&
|
|
!contains(needs.get-labels.outputs.labels, 'skip-ci')
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- run: echo "All HIL matrix jobs passed on merge_group."
|