Skip to content

Commit

Permalink
fix hil test
Browse files Browse the repository at this point in the history
  • Loading branch information
hathach committed May 9, 2024
1 parent d2080f8 commit d40edbb
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 102 deletions.
101 changes: 4 additions & 97 deletions .github/workflows/build_cmake.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build CMake
name: Build

on:
workflow_dispatch:
Expand Down Expand Up @@ -51,9 +51,9 @@ jobs:
echo "matrix=$MATRIX_JSON" >> $GITHUB_OUTPUT
# ---------------------------------------
# Build
# Build CMake
# ---------------------------------------
build:
cmake:
needs: set-matrix
uses: ./.github/workflows/build_family.yml
strategy:
Expand All @@ -70,98 +70,5 @@ jobs:
build-json: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain]) }}

# ---------------------------------------
# Build ARM with GCC
# Build Make
# ---------------------------------------
arm-gcc:
if: false
needs: set-matrix
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
family: ${{ fromJSON(needs.set-matrix.outputs.json).arm-gcc.family }}
steps:
- name: Checkout TinyUSB
uses: actions/checkout@v4

- name: Install ARM GCC
uses: carlosperate/arm-none-eabi-gcc-action@v1
with:
release: '12.3.Rel1'

- name: Prepare to build
uses: ./.github/actions/prepare_build
with:
family: ${{ matrix.family }}

- name: Build
run: python tools/build_cmake.py ${{ matrix.family }}

- name: Upload Artifacts for Hardware Testing (rp2040)
if: contains(matrix.family, 'rp2040') && github.repository_owner == 'hathach'
uses: actions/upload-artifact@v4
with:
name: raspberry_pi_pico
path: |
cmake-build/cmake-build-raspberry_pi_pico/*/*/*.elf
- name: Upload Artifacts for Hardware Testing (nRF)
if: contains(matrix.family, 'nrf') && github.repository_owner == 'hathach'
uses: actions/upload-artifact@v4
with:
name: feather_nrf52840_express
path: |
cmake-build/cmake-build-feather_nrf52840_express/*/*/*.elf
- name: Upload Artifacts for Hardware Testing (samd51)
if: contains(matrix.family, 'samd5x_e5x') && github.repository_owner == 'hathach'
uses: actions/upload-artifact@v4
with:
name: itsybitsy_m4
path: |
cmake-build/cmake-build-itsybitsy_m4/*/*/*.bin
# ---------------------------------------
# Hardware in the loop (HIL)
# Current self-hosted instance is running on an RPI4. For attached hardware checkout hil_pi4.json
# ---------------------------------------
hil-test:
if: github.repository_owner == 'hathach' && false
needs: arm-gcc
runs-on: [self-hosted, rp2040, nrf52840, hardware-in-the-loop]
strategy:
fail-fast: false
matrix:
board:
- 'feather_nrf52840_express'
- 'itsybitsy_m4'
- 'raspberry_pi_pico'
steps:
- name: Clean workspace
run: |
echo "Cleaning up previous run"
rm -rf "${{ github.workspace }}"
mkdir -p "${{ github.workspace }}"
# USB bus on rpi4 is not stable, reset it before testing
- name: Reset USB bus
run: |
lsusb
lsusb -t
# reset VIA Labs 2.0 hub
sudo usbreset 001/002
- name: Checkout test/hil
uses: actions/checkout@v4
with:
sparse-checkout: test/hil

- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: ${{ matrix.board }}
path: cmake-build/cmake-build-${{ matrix.board }}

- name: Test on actual hardware
run: |
python3 test/hil/hil_test.py --board ${{ matrix.board }} hil_pi4.json
2 changes: 1 addition & 1 deletion .github/workflows/build_iar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ jobs:

- name: Test on actual hardware (hardware in the loop)
run: |
python3 test/hil/hil_test.py hil_hfp.json
python3 test/hil/hil_test.py hfp.json
2 changes: 1 addition & 1 deletion .github/workflows/hil_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
id: parse_hil_json
run: |
sudo apt install -y jq
BOARD_LIST=$(jq -r '.boards[] | "-b " + .name' test/hil/hil_pi4.json | tr '\n' ' ')
BOARD_LIST=$(jq -r '.boards[] | "-b " + .name' test/hil/pi4.json | tr '\n' ' ')
echo "BOARD_LIST=$BOARD_LIST"
echo >> $GITHUB_ENV "BOARD_LIST=$BOARD_LIST"
echo >> $GITHUB_OUTPUT "BOARD_LIST=$BOARD_LIST"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:

- name: Build Fuzzer
run: |
pip install click
export CC=clang
export CXX=clang++
fuzz_harness=$(ls -d test/fuzz/device/*/)
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions tools/build_cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def build_family(family, toolchain):
def main(family, board, toolchain):
if len(family) == 0 and len(board) == 0:
print("Please specify family or board to build")
return
return 1

print(build_separator)
print(build_utils.build_format.format('Example', 'Board', '\033[39mResult\033[0m', 'Time', 'Flash', 'SRAM'))
Expand Down Expand Up @@ -111,8 +111,8 @@ def main(family, board, toolchain):
print(build_separator)
print(f"Build Summary: {total_result[0]} {SUCCEEDED}, {total_result[1]} {FAILED} and took {total_time:.2f}s")
print(build_separator)
sys.exit(total_result[1])
return total_result[1]


if __name__ == '__main__':
main()
sys.exit(main())

0 comments on commit d40edbb

Please sign in to comment.