make all python files executable and standardize interpreter #336
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: Hardware Test | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: [ master ] | |
paths: | |
- 'src/**' | |
- 'examples/**' | |
- 'lib/**' | |
- 'hw/**' | |
- 'test/hil/**' | |
- 'tools/get_deps.py' | |
- '.github/actions/**' | |
- '.github/workflows/hil_test.yml' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
HIL_JSON: test/hil/rpi.json | |
jobs: | |
set-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
json: ${{ steps.set-matrix-json.outputs.matrix }} | |
steps: | |
- name: Checkout TinyUSB | |
uses: actions/checkout@v4 | |
- name: Generate matrix json | |
id: set-matrix-json | |
run: | | |
MATRIX_JSON=$(jq -c '{ "arm-gcc": [.boards[] | select(.flasher != "esptool" and .flasher != "openocd_wch") | .name] }' ${{ env.HIL_JSON }}) | |
echo "matrix=$MATRIX_JSON" | |
echo "matrix=$MATRIX_JSON" >> $GITHUB_OUTPUT | |
# --------------------------------------- | |
# Build arm-gcc | |
# --------------------------------------- | |
build: | |
if: github.repository_owner == 'hathach' | |
needs: set-matrix | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
board: ${{ fromJSON(needs.set-matrix.outputs.json)['arm-gcc'] }} | |
steps: | |
- name: Checkout TinyUSB | |
uses: actions/checkout@v4 | |
- name: Setup arm-gcc toolchain | |
uses: ./.github/actions/setup_toolchain | |
with: | |
toolchain: 'arm-gcc' | |
- name: Get Dependencies | |
uses: ./.github/actions/get_deps | |
with: | |
arg: -b${{ matrix.board }} | |
- name: Build | |
run: python tools/build.py -b${{ matrix.board }} | |
- name: Upload Artifacts for Hardware Testing | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.board }} | |
path: | | |
cmake-build/cmake-build-*/*/*/*.elf | |
cmake-build/cmake-build-*/*/*/*.bin | |
# --------------------------------------- | |
# Hardware in the loop (HIL) | |
# self-hosted running on an RPI. For attached hardware checkout test/hil/rpi.json | |
# --------------------------------------- | |
hil-rpi: | |
if: github.repository_owner == 'hathach' | |
needs: build | |
runs-on: [self-hosted, ARM64, rpi, hardware-in-the-loop] | |
steps: | |
- name: Clean workspace | |
run: | | |
echo "Cleaning up previous run" | |
rm -rf "${{ github.workspace }}" | |
mkdir -p "${{ github.workspace }}" | |
# USB bus on rpi is not stable, reset it before testing | |
# - name: Reset USB bus | |
# run: | | |
# echo "1-2" | sudo tee /sys/bus/usb/drivers/usb/unbind | |
# sleep 5 | |
# echo "1-2" | sudo tee /sys/bus/usb/drivers/usb/bind | |
- name: Checkout TinyUSB | |
uses: actions/checkout@v4 | |
with: | |
sparse-checkout: test/hil | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: cmake-build | |
merge-multiple: true | |
- name: Test on actual hardware | |
run: python3 test/hil/hil_test.py ${{ env.HIL_JSON }} |