summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2025-12-03 00:08:45 +0700
committerhathach <[email protected]>2025-12-03 00:44:12 +0700
commit3d190475ad2b71d913e059dfc6f5cc5dafe6555d (patch)
treed40c16749ee71c710b457eecf7456f0128541893
parent09e1113aaf1b2618ffe42e9638d68e6047b6f1ef (diff)
upload metrics.json, test ci
-rw-r--r--.github/workflows/build.yml374
-rw-r--r--.github/workflows/build_util.yml9
-rw-r--r--examples/CMakeLists.txt1
-rwxr-xr-xtools/get_deps.py2
4 files changed, 197 insertions, 189 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index f1b134b8a..7d7901c3a 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -83,190 +83,190 @@ jobs:
# ---------------------------------------
# Build Make: only build on push with one-per-family
# ---------------------------------------
- make:
- if: github.event_name == 'push'
- needs: set-matrix
- uses: ./.github/workflows/build_util.yml
- strategy:
- fail-fast: false
- matrix:
- toolchain:
- - 'aarch64-gcc'
- #- 'arm-clang'
- - 'arm-gcc'
- - 'msp430-gcc'
- - 'riscv-gcc'
- - 'rx-gcc'
- with:
- build-system: 'make'
- toolchain: ${{ matrix.toolchain }}
- build-args: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain]) }}
- one-per-family: true
-
- # ---------------------------------------
- # Build IAR
- # Since IAR Token secret is not passed to forked PR, only build non-forked PR with make.
- # cmake is built by circle-ci. Due to IAR limit capacity, only build oe per family
- # ---------------------------------------
- arm-iar:
- if: false # disable for now since we got reach capacity limit too often
- #if: github.event_name == 'push' && github.repository_owner == 'hathach'
- needs: set-matrix
- uses: ./.github/workflows/build_util.yml
- secrets: inherit
- strategy:
- fail-fast: false
- matrix:
- build-system:
- - 'make'
- with:
- build-system: ${{ matrix.build-system }}
- toolchain: 'arm-iar'
- build-args: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)['arm-iar']) }}
- one-per-family: true
-
- # ---------------------------------------
- # Build Make/CMake on Windows/MacOS
- # ---------------------------------------
- build-os:
- if: github.event_name == 'pull_request'
- uses: ./.github/workflows/build_util.yml
- strategy:
- fail-fast: false
- matrix:
- os: [windows-latest, macos-latest]
- build-system: [ 'make', 'cmake' ]
- with:
- os: ${{ matrix.os }}
- build-system: ${{ matrix.build-system }}
- toolchain: 'arm-gcc-${{ matrix.os }}'
- build-args: '["stm32h7"]'
- one-per-family: true
-
- # ---------------------------------------
- # Zephyr
- # ---------------------------------------
- zephyr:
- if: github.event_name == 'push'
- runs-on: ubuntu-latest
- steps:
- - name: Checkout TinyUSB
- uses: actions/checkout@v4
-
- - name: Setup Zephyr project
- uses: zephyrproject-rtos/action-zephyr-setup@v1
- with:
- app-path: examples
- toolchains: arm-zephyr-eabi
-
- - name: Build
- run: |
- west build -b nrf52840dk -d examples/device/cdc_msc/build examples/device/cdc_msc -- -DRTOS=zephyr
- west build -b nrf52840dk -d examples/device/msc_dual_lun/build examples/device/msc_dual_lun -- -DRTOS=zephyr
-
- # ---------------------------------------
- # Hardware in the loop (HIL)
- # Run on PR only (hil-tinyusb), hil-hfp only run on non-forked PR
- # ---------------------------------------
- hil-build:
- if: |
- github.repository_owner == 'hathach' &&
- (github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch')
- needs: set-matrix
- uses: ./.github/workflows/build_util.yml
- strategy:
- fail-fast: false
- matrix:
- toolchain:
- - 'arm-gcc'
- - 'esp-idf'
- with:
- build-system: 'cmake'
- toolchain: ${{ matrix.toolchain }}
- build-args: ${{ toJSON(fromJSON(needs.set-matrix.outputs.hil_json)[matrix.toolchain]) }}
- one-per-family: true
- upload-artifacts: true
-
- # ---------------------------------------
- # Hardware in the loop (HIL)
- # self-hosted on local VM, for attached hardware checkout HIL_JSON
- # ---------------------------------------
- hil-tinyusb:
- if: |
- github.repository_owner == 'hathach' &&
- (github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch')
- needs: hil-build
- runs-on: [self-hosted, X64, hathach, hardware-in-the-loop]
- steps:
- - name: Get Skip Boards from previous run
- if: github.run_attempt != '1'
- run: |
- if [ -f "${{ env.HIL_JSON }}.skip" ]; then
- SKIP_BOARDS=$(cat "${{ env.HIL_JSON }}.skip")
- else
- SKIP_BOARDS=""
- fi
- echo "SKIP_BOARDS=$SKIP_BOARDS"
- echo "SKIP_BOARDS=$SKIP_BOARDS" >> $GITHUB_ENV
-
- - name: Clean workspace
- run: |
- echo "Cleaning up for the first run"
- rm -rf "${{ github.workspace }}"
- mkdir -p "${{ github.workspace }}"
-
- - name: Checkout TinyUSB
- uses: actions/checkout@v4
-
- - name: Download Artifacts
- uses: actions/download-artifact@v5
- with:
- path: cmake-build
- merge-multiple: true
-
- - name: Test on actual hardware
- run: |
- python3 test/hil/hil_test.py ${{ env.HIL_JSON }} $SKIP_BOARDS
-
- # ---------------------------------------
- # Hardware in the loop (HIL)
- # self-hosted by HFP, build with IAR toolchain, for attached hardware checkout test/hil/hfp.json
- # Since IAR Token secret is not passed to forked PR, only build non-forked PR
- # ---------------------------------------
- hil-hfp:
- if: |
- github.repository_owner == 'hathach' &&
- github.event.pull_request.head.repo.fork == false &&
- (github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch')
- runs-on: [self-hosted, Linux, X64, hifiphile]
- env:
- IAR_LMS_BEARER_TOKEN: ${{ secrets.IAR_LMS_BEARER_TOKEN }}
- steps:
- - name: Clean workspace
- run: |
- echo "Cleaning up previous run"
- rm -rf "${{ github.workspace }}"3
- mkdir -p "${{ github.workspace }}"
-
- - name: Toolchain version
- run: |
- iccarm --version
-
- - name: Checkout TinyUSB
- uses: actions/checkout@v4
-
- - name: Get build boards
- run: |
- MATRIX_JSON=$(python test/hil/hil_ci_set_matrix.py test/hil/hfp.json)
- BUILD_ARGS=$(echo $MATRIX_JSON | jq -r '.["arm-gcc"] | join(" ")')
- echo "BUILD_ARGS=$BUILD_ARGS"
- echo "BUILD_ARGS=$BUILD_ARGS" >> $GITHUB_ENV
-
- - name: Get Dependencies
- run: python3 tools/get_deps.py $BUILD_ARGS
-
- - name: Build
- run: python3 tools/build.py -j 4 --toolchain iar $BUILD_ARGS
-
- - name: Test on actual hardware (hardware in the loop)
- run: python3 test/hil/hil_test.py hfp.json
+# make:
+# if: github.event_name == 'push'
+# needs: set-matrix
+# uses: ./.github/workflows/build_util.yml
+# strategy:
+# fail-fast: false
+# matrix:
+# toolchain:
+# - 'aarch64-gcc'
+# #- 'arm-clang'
+# - 'arm-gcc'
+# - 'msp430-gcc'
+# - 'riscv-gcc'
+# - 'rx-gcc'
+# with:
+# build-system: 'make'
+# toolchain: ${{ matrix.toolchain }}
+# build-args: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain]) }}
+# one-per-family: true
+#
+# # ---------------------------------------
+# # Build IAR
+# # Since IAR Token secret is not passed to forked PR, only build non-forked PR with make.
+# # cmake is built by circle-ci. Due to IAR limit capacity, only build oe per family
+# # ---------------------------------------
+# arm-iar:
+# if: false # disable for now since we got reach capacity limit too often
+# #if: github.event_name == 'push' && github.repository_owner == 'hathach'
+# needs: set-matrix
+# uses: ./.github/workflows/build_util.yml
+# secrets: inherit
+# strategy:
+# fail-fast: false
+# matrix:
+# build-system:
+# - 'make'
+# with:
+# build-system: ${{ matrix.build-system }}
+# toolchain: 'arm-iar'
+# build-args: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)['arm-iar']) }}
+# one-per-family: true
+#
+# # ---------------------------------------
+# # Build Make/CMake on Windows/MacOS
+# # ---------------------------------------
+# build-os:
+# if: github.event_name == 'pull_request'
+# uses: ./.github/workflows/build_util.yml
+# strategy:
+# fail-fast: false
+# matrix:
+# os: [windows-latest, macos-latest]
+# build-system: [ 'make', 'cmake' ]
+# with:
+# os: ${{ matrix.os }}
+# build-system: ${{ matrix.build-system }}
+# toolchain: 'arm-gcc-${{ matrix.os }}'
+# build-args: '["stm32h7"]'
+# one-per-family: true
+#
+# # ---------------------------------------
+# # Zephyr
+# # ---------------------------------------
+# zephyr:
+# if: github.event_name == 'push'
+# runs-on: ubuntu-latest
+# steps:
+# - name: Checkout TinyUSB
+# uses: actions/checkout@v4
+#
+# - name: Setup Zephyr project
+# uses: zephyrproject-rtos/action-zephyr-setup@v1
+# with:
+# app-path: examples
+# toolchains: arm-zephyr-eabi
+#
+# - name: Build
+# run: |
+# west build -b nrf52840dk -d examples/device/cdc_msc/build examples/device/cdc_msc -- -DRTOS=zephyr
+# west build -b nrf52840dk -d examples/device/msc_dual_lun/build examples/device/msc_dual_lun -- -DRTOS=zephyr
+#
+# # ---------------------------------------
+# # Hardware in the loop (HIL)
+# # Run on PR only (hil-tinyusb), hil-hfp only run on non-forked PR
+# # ---------------------------------------
+# hil-build:
+# if: |
+# github.repository_owner == 'hathach' &&
+# (github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch')
+# needs: set-matrix
+# uses: ./.github/workflows/build_util.yml
+# strategy:
+# fail-fast: false
+# matrix:
+# toolchain:
+# - 'arm-gcc'
+# - 'esp-idf'
+# with:
+# build-system: 'cmake'
+# toolchain: ${{ matrix.toolchain }}
+# build-args: ${{ toJSON(fromJSON(needs.set-matrix.outputs.hil_json)[matrix.toolchain]) }}
+# one-per-family: true
+# upload-artifacts: true
+#
+# # ---------------------------------------
+# # Hardware in the loop (HIL)
+# # self-hosted on local VM, for attached hardware checkout HIL_JSON
+# # ---------------------------------------
+# hil-tinyusb:
+# if: |
+# github.repository_owner == 'hathach' &&
+# (github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch')
+# needs: hil-build
+# runs-on: [self-hosted, X64, hathach, hardware-in-the-loop]
+# steps:
+# - name: Get Skip Boards from previous run
+# if: github.run_attempt != '1'
+# run: |
+# if [ -f "${{ env.HIL_JSON }}.skip" ]; then
+# SKIP_BOARDS=$(cat "${{ env.HIL_JSON }}.skip")
+# else
+# SKIP_BOARDS=""
+# fi
+# echo "SKIP_BOARDS=$SKIP_BOARDS"
+# echo "SKIP_BOARDS=$SKIP_BOARDS" >> $GITHUB_ENV
+#
+# - name: Clean workspace
+# run: |
+# echo "Cleaning up for the first run"
+# rm -rf "${{ github.workspace }}"
+# mkdir -p "${{ github.workspace }}"
+#
+# - name: Checkout TinyUSB
+# uses: actions/checkout@v4
+#
+# - name: Download Artifacts
+# uses: actions/download-artifact@v5
+# with:
+# path: cmake-build
+# merge-multiple: true
+#
+# - name: Test on actual hardware
+# run: |
+# python3 test/hil/hil_test.py ${{ env.HIL_JSON }} $SKIP_BOARDS
+#
+# # ---------------------------------------
+# # Hardware in the loop (HIL)
+# # self-hosted by HFP, build with IAR toolchain, for attached hardware checkout test/hil/hfp.json
+# # Since IAR Token secret is not passed to forked PR, only build non-forked PR
+# # ---------------------------------------
+# hil-hfp:
+# if: |
+# github.repository_owner == 'hathach' &&
+# github.event.pull_request.head.repo.fork == false &&
+# (github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch')
+# runs-on: [self-hosted, Linux, X64, hifiphile]
+# env:
+# IAR_LMS_BEARER_TOKEN: ${{ secrets.IAR_LMS_BEARER_TOKEN }}
+# steps:
+# - name: Clean workspace
+# run: |
+# echo "Cleaning up previous run"
+# rm -rf "${{ github.workspace }}"3
+# mkdir -p "${{ github.workspace }}"
+#
+# - name: Toolchain version
+# run: |
+# iccarm --version
+#
+# - name: Checkout TinyUSB
+# uses: actions/checkout@v4
+#
+# - name: Get build boards
+# run: |
+# MATRIX_JSON=$(python test/hil/hil_ci_set_matrix.py test/hil/hfp.json)
+# BUILD_ARGS=$(echo $MATRIX_JSON | jq -r '.["arm-gcc"] | join(" ")')
+# echo "BUILD_ARGS=$BUILD_ARGS"
+# echo "BUILD_ARGS=$BUILD_ARGS" >> $GITHUB_ENV
+#
+# - name: Get Dependencies
+# run: python3 tools/get_deps.py $BUILD_ARGS
+#
+# - name: Build
+# run: python3 tools/build.py -j 4 --toolchain iar $BUILD_ARGS
+#
+# - name: Test on actual hardware (hardware in the loop)
+# run: python3 test/hil/hil_test.py hfp.json
diff --git a/.github/workflows/build_util.yml b/.github/workflows/build_util.yml
index 55901b838..848694597 100644
--- a/.github/workflows/build_util.yml
+++ b/.github/workflows/build_util.yml
@@ -69,11 +69,18 @@ jobs:
fi
shell: bash
+ - name: Upload Artifacts for Metrics
+ if: inputs.build-system == 'cmake'
+ uses: actions/upload-artifact@v4
+ with:
+ name: ${{ matrix.arg }}-metrics
+ path: cmake-build/cmake-build-*/metrics.json
+
- name: Upload Artifacts for Hardware Testing
if: ${{ inputs.upload-artifacts }}
uses: actions/upload-artifact@v4
with:
- name: ${{ matrix.arg }}
+ name: ${{ matrix.arg }}-binaries
path: |
cmake-build/cmake-build-*/*/*/*.elf
cmake-build/cmake-build-*/*/*/*.bin
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index d9f97d598..694681467 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -19,6 +19,7 @@ foreach (example ${EXAMPLES_LIST})
endforeach ()
# Post-build: run metrics.py on all map.json files
+find_package(Python3 REQUIRED COMPONENTS Interpreter)
add_custom_target(tinyusb_examples_metrics
COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../tools/metrics.py
-f tinyusb/src -j -o ${CMAKE_BINARY_DIR}/metrics
diff --git a/tools/get_deps.py b/tools/get_deps.py
index 029c33607..fe2f51e01 100755
--- a/tools/get_deps.py
+++ b/tools/get_deps.py
@@ -15,7 +15,7 @@ deps_mandatory = {
'159e31b689577dbf69cf0683bbaffbd71fa5ee10',
'all'],
'tools/linkermap': ['https://github.com/hathach/linkermap.git',
- '75d9d2c9e0f83297ddbc0da899f6cc0ab21076f0',
+ '87f94869f9ff828812f4551138f82c3bfcaf2620',
'all'],
'tools/uf2': ['https://github.com/microsoft/uf2.git',
'c594542b2faa01cc33a2b97c9fbebc38549df80a',