summaryrefslogtreecommitdiff
path: root/.github/workflows
diff options
context:
space:
mode:
authorMichael Fischer <[email protected]>2024-02-04 10:55:34 +0100
committerGitHub <[email protected]>2024-02-04 10:55:34 +0100
commitea30041168d19a9239b700b745e7d7f17c760a8d (patch)
treeff30e202d98c29ef0df73e30ea75ed136f827f80 /.github/workflows
parent9063ede25f4a013dae8edccc2d953ba2de7ed684 (diff)
parentf918406a12cabbc66a6c297b2fd27f8eda357fcd (diff)
Merge branch 'hathach:master' into nxp_k64
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/build_aarch64.yml20
-rw-r--r--.github/workflows/build_arm.yml34
-rw-r--r--.github/workflows/build_esp.yml83
-rw-r--r--.github/workflows/build_iar.yml8
-rw-r--r--.github/workflows/build_msp430.yml23
-rw-r--r--.github/workflows/build_renesas.yml23
-rw-r--r--.github/workflows/build_riscv.yml23
-rw-r--r--.github/workflows/build_win_mac.yml6
-rw-r--r--.github/workflows/cmake_arm.yml119
-rw-r--r--.github/workflows/codeql-buildscript.sh5
-rw-r--r--.github/workflows/codeql.yml137
-rwxr-xr-x.github/workflows/fail_on_error.py34
-rw-r--r--.github/workflows/pre-commit.yml4
-rw-r--r--.github/workflows/trigger.yml2
14 files changed, 338 insertions, 183 deletions
diff --git a/.github/workflows/build_aarch64.yml b/.github/workflows/build_aarch64.yml
index 6ac7ad015..e5dbf9494 100644
--- a/.github/workflows/build_aarch64.yml
+++ b/.github/workflows/build_aarch64.yml
@@ -36,18 +36,12 @@ jobs:
- 'broadcom_64bit'
steps:
- name: Setup Python
- uses: actions/setup-python@v4
+ uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Checkout TinyUSB
- uses: actions/checkout@v3
-
- - name: Checkout hathach/linkermap
- uses: actions/checkout@v3
- with:
- repository: hathach/linkermap
- path: linkermap
+ uses: actions/checkout@v4
- name: Set Toolchain URL
run: echo >> $GITHUB_ENV TOOLCHAIN_URL=https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz
@@ -73,12 +67,4 @@ jobs:
run: python3 tools/get_deps.py ${{ matrix.family }}
- name: Build
- run: python3 tools/build_family.py ${{ matrix.family }}
-
- - name: Linker Map
- run: |
- pip install linkermap/
- for ex in `ls -d examples/device/*/`; do \
- find ${ex} -name *.map -print -quit | \
- xargs -I % sh -c 'echo "::group::%"; linkermap -v %; echo "::endgroup::"'; \
- done
+ run: python3 tools/build_make.py ${{ matrix.family }}
diff --git a/.github/workflows/build_arm.yml b/.github/workflows/build_arm.yml
index 2621e7372..9f3270c91 100644
--- a/.github/workflows/build_arm.yml
+++ b/.github/workflows/build_arm.yml
@@ -8,6 +8,7 @@ on:
- 'examples/**'
- 'lib/**'
- 'hw/**'
+ - 'tools/get_deps.py'
- '.github/workflows/build_arm.yml'
pull_request:
branches: [ master ]
@@ -16,6 +17,7 @@ on:
- 'examples/**'
- 'lib/**'
- 'hw/**'
+ - 'tools/get_deps.py'
- '.github/workflows/build_arm.yml'
concurrency:
@@ -35,19 +37,16 @@ jobs:
# Alphabetical order
- 'broadcom_32bit'
- 'kinetis_k32l2'
- - 'lpc11 lpc13 lpc15 lpc17'
- - 'lpc51 lpc54'
+ - 'lpc11 lpc13 lpc15'
+ - 'lpc51'
- 'mm32 msp432e4'
- - 'nrf'
- - 'samd11 samd21'
- - 'samd51 same5x'
- - 'saml2x'
+ - 'samd11 same5x saml2x'
- 'stm32f2 stm32f3'
- - 'stm32l0 stm32u5 stm32wb'
+ - 'stm32l0 stm32wb'
- 'tm4c123 xmc4000'
steps:
- name: Setup Python
- uses: actions/setup-python@v4
+ uses: actions/setup-python@v5
with:
python-version: '3.x'
@@ -57,25 +56,10 @@ jobs:
release: '11.2-2022.02'
- name: Checkout TinyUSB
- uses: actions/checkout@v3
-
- - name: Checkout hathach/linkermap
- uses: actions/checkout@v3
- with:
- repository: hathach/linkermap
- path: linkermap
+ uses: actions/checkout@v4
- name: Get Dependencies
run: python3 tools/get_deps.py ${{ matrix.family }}
- name: Build
- run: python3 tools/build_family.py ${{ matrix.family }}
-
- - name: Linker Map
- run: |
- pip install linkermap/
- # find -quit to only print linkermap of 1 board per example
- for ex in `ls -d examples/*/*/`
- do
- find ${ex} -name *.map -print -quit | xargs -I % sh -c 'echo "::group::%"; linkermap -v %; echo "::endgroup::"'
- done
+ run: python3 tools/build_make.py ${{ matrix.family }}
diff --git a/.github/workflows/build_esp.yml b/.github/workflows/build_esp.yml
index 29585cb36..8fbdb31ff 100644
--- a/.github/workflows/build_esp.yml
+++ b/.github/workflows/build_esp.yml
@@ -8,6 +8,7 @@ on:
- 'examples/**'
- 'lib/**'
- 'hw/**'
+ - 'test/hil/**'
- '.github/workflows/build_esp.yml'
pull_request:
branches: [ master ]
@@ -16,6 +17,7 @@ on:
- 'examples/**'
- 'lib/**'
- 'hw/**'
+ - 'test/hil/**'
- '.github/workflows/build_esp.yml'
concurrency:
@@ -29,16 +31,13 @@ jobs:
fail-fast: false
matrix:
board:
- # Alphabetical order
# ESP32-S2
- - 'espressif_saola_1'
+ - 'espressif_kaluga_1'
# ESP32-S3
- #- 'espressif_s3_devkitm'
- # S3 compile error with "dangerous relocation: call8: call target out of range: memcpy"
-
+ - 'espressif_s3_devkitc'
steps:
- name: Setup Python
- uses: actions/setup-python@v4
+ uses: actions/setup-python@v5
with:
python-version: '3.x'
@@ -46,22 +45,64 @@ jobs:
run: docker pull espressif/idf:latest
- name: Checkout TinyUSB
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
+
+ - name: Build
+ run: docker run --rm -v $PWD:/project -w /project espressif/idf:v5.1.1 python3 tools/build_esp32.py ${{ matrix.board }}
- - name: Checkout hathach/linkermap
- uses: actions/checkout@v3
+ - name: Upload Artifacts for Hardware Testing
+ if: matrix.board == 'espressif_s3_devkitc' && github.repository_owner == 'hathach'
+ uses: actions/upload-artifact@v3
with:
- repository: hathach/linkermap
- path: linkermap
+ name: ${{ matrix.board }}
+ path: |
+ cmake-build/cmake-build-${{ matrix.board }}/*/*/bootloader/bootloader.bin
+ cmake-build/cmake-build-${{ matrix.board }}/*/*/*.bin
+ cmake-build/cmake-build-${{ matrix.board }}/*/*/partition_table/partition-table.bin
+ cmake-build/cmake-build-${{ matrix.board }}/*/*/config.env
+ cmake-build/cmake-build-${{ matrix.board }}/*/*/flash_args
- - name: Build
- run: docker run --rm -v $PWD:/project -w /project espressif/idf:latest python3 tools/build_esp32.py ${{ matrix.board }}
+ # ---------------------------------------
+ # Hardware in the loop (HIL)
+ # Current self-hosted instance is running on an RPI4. For attached hardware checkout hil_pi4.json
+ # ---------------------------------------
+ hil-test:
+ # run only with hathach's commit due to limited resource on RPI4
+ if: github.repository_owner == 'hathach'
+ needs: build-esp
+ runs-on: [self-hosted, esp32s3, hardware-in-the-loop]
+ strategy:
+ fail-fast: false
+ matrix:
+ board:
+ - 'espressif_s3_devkitc'
+ 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: |
+ for port in $(lspci | grep USB | cut -d' ' -f1); do
+ echo -n "0000:${port}"| sudo tee /sys/bus/pci/drivers/xhci_hcd/unbind;
+ sleep 0.1;
+ echo -n "0000:${port}" | sudo tee /sys/bus/pci/drivers/xhci_hcd/bind;
+ done
+
+ - name: Checkout test/hil
+ uses: actions/checkout@v4
+ with:
+ sparse-checkout: test/hil
+
+ - name: Download Artifacts
+ uses: actions/download-artifact@v3
+ with:
+ name: ${{ matrix.board }}
+ path: cmake-build/cmake-build-${{ matrix.board }}
- - name: Linker Map
- run: |
- pip install linkermap/
- # find -quit to only print linkermap of 1 board per example
- for ex in `ls -d examples/device/*/`
- do
- find ${ex} -maxdepth 3 -name *.map -print -quit | xargs -I % sh -c 'echo "::group::%"; linkermap -v %; echo "::endgroup::"'
- done
+ - name: Test on actual hardware
+ run: |
+ python3 test/hil/hil_test.py --board ${{ matrix.board }} hil_pi4.json
diff --git a/.github/workflows/build_iar.yml b/.github/workflows/build_iar.yml
index 1eacf90c9..a0a022ecc 100644
--- a/.github/workflows/build_iar.yml
+++ b/.github/workflows/build_iar.yml
@@ -8,6 +8,8 @@ on:
- 'examples/**'
- 'lib/**'
- 'hw/**'
+ - 'tools/get_deps.py'
+ - 'test/hil/**'
- '.github/workflows/build_iar.yml'
pull_request:
branches: [ master ]
@@ -16,6 +18,8 @@ on:
- 'examples/**'
- 'lib/**'
- 'hw/**'
+ - 'tools/get_deps.py'
+ - 'test/hil/**'
- '.github/workflows/build_iar.yml'
concurrency:
@@ -32,7 +36,7 @@ jobs:
# Alphabetical order
# Note: bundle multiple families into a matrix since there is only one self-hosted instance can
# run IAR build. Too many matrix can hurt due to setup/teardown overhead.
- - 'lpc43 stm32f0 stm32f1 stm32f4 stm32f7 stm32g0 stm32g4 stm32h7 stm32l4'
+ - 'lpc43 stm32f0 stm32f1 stm32f7 stm32g0 stm32g4 stm32l4'
steps:
- name: Clean workspace
run: |
@@ -41,7 +45,7 @@ jobs:
mkdir -p "${{ github.workspace }}"
- name: Checkout TinyUSB
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Get Dependencies
run: python3 tools/get_deps.py ${{ matrix.family }}
diff --git a/.github/workflows/build_msp430.yml b/.github/workflows/build_msp430.yml
index c62056940..f913df913 100644
--- a/.github/workflows/build_msp430.yml
+++ b/.github/workflows/build_msp430.yml
@@ -8,6 +8,7 @@ on:
- 'examples/**'
- 'lib/**'
- 'hw/**'
+ - 'tools/get_deps.py'
- '.github/workflows/build_msp430.yml'
pull_request:
branches: [ master ]
@@ -16,6 +17,7 @@ on:
- 'examples/**'
- 'lib/**'
- 'hw/**'
+ - 'tools/get_deps.py'
- '.github/workflows/build_msp430.yml'
concurrency:
@@ -34,18 +36,12 @@ jobs:
steps:
- name: Setup Python
- uses: actions/setup-python@v4
+ uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Checkout TinyUSB
- uses: actions/checkout@v3
-
- - name: Checkout hathach/linkermap
- uses: actions/checkout@v3
- with:
- repository: hathach/linkermap
- path: linkermap
+ uses: actions/checkout@v4
- name: Set Toolchain URL
run: echo >> $GITHUB_ENV TOOLCHAIN_URL=http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPGCC/9_2_0_0/export/msp430-gcc-9.2.0.50_linux64.tar.bz2
@@ -71,13 +67,4 @@ jobs:
run: python3 tools/get_deps.py ${{ matrix.family }}
- name: Build
- run: python3 tools/build_family.py ${{ matrix.family }}
-
- - name: Linker Map
- run: |
- pip install linkermap/
- # find -quit to only print linkermap of 1 board per example
- for ex in `ls -d examples/device/*/`
- do
- find ${ex} -name *.map -print -quit | xargs -I % sh -c 'echo "::group::%"; linkermap -v %; echo "::endgroup::"'
- done
+ run: python3 tools/build_make.py ${{ matrix.family }}
diff --git a/.github/workflows/build_renesas.yml b/.github/workflows/build_renesas.yml
index 66b98a71b..ec06c9426 100644
--- a/.github/workflows/build_renesas.yml
+++ b/.github/workflows/build_renesas.yml
@@ -8,6 +8,7 @@ on:
- 'examples/**'
- 'lib/**'
- 'hw/**'
+ - 'tools/get_deps.py'
- '.github/workflows/build_renesas.yml'
pull_request:
branches: [ master ]
@@ -16,6 +17,7 @@ on:
- 'examples/**'
- 'lib/**'
- 'hw/**'
+ - 'tools/get_deps.py'
- '.github/workflows/build_renesas.yml'
concurrency:
@@ -33,18 +35,12 @@ jobs:
- 'rx'
steps:
- name: Setup Python
- uses: actions/setup-python@v4
+ uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Checkout TinyUSB
- uses: actions/checkout@v3
-
- - name: Checkout hathach/linkermap
- uses: actions/checkout@v3
- with:
- repository: hathach/linkermap
- path: linkermap
+ uses: actions/checkout@v4
- name: Set Toolchain URL
run: echo >> $GITHUB_ENV TOOLCHAIN_URL=http://gcc-renesas.com/downloads/get.php?f=rx/8.3.0.202004-gnurx/gcc-8.3.0.202004-GNURX-ELF.run
@@ -71,13 +67,4 @@ jobs:
run: python3 tools/get_deps.py ${{ matrix.family }}
- name: Build
- run: python3 tools/build_family.py ${{ matrix.family }}
-
- - name: Linker Map
- run: |
- pip install linkermap/
- # find -quit to only print linkermap of 1 board per example
- for ex in `ls -d examples/device/*/`
- do
- find ${ex} -name *.map -print -quit | xargs -I % sh -c 'echo "::group::%"; linkermap -v %; echo "::endgroup::"'
- done
+ run: python3 tools/build_make.py ${{ matrix.family }}
diff --git a/.github/workflows/build_riscv.yml b/.github/workflows/build_riscv.yml
index 8ec549072..e891a3a51 100644
--- a/.github/workflows/build_riscv.yml
+++ b/.github/workflows/build_riscv.yml
@@ -8,6 +8,7 @@ on:
- 'examples/**'
- 'lib/**'
- 'hw/**'
+ - 'tools/get_deps.py'
- '.github/workflows/build_riscv.yml'
pull_request:
branches: [ master ]
@@ -16,6 +17,7 @@ on:
- 'examples/**'
- 'lib/**'
- 'hw/**'
+ - 'tools/get_deps.py'
- '.github/workflows/build_riscv.yml'
concurrency:
@@ -35,18 +37,12 @@ jobs:
- 'gd32vf103'
steps:
- name: Setup Python
- uses: actions/setup-python@v4
+ uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Checkout TinyUSB
- uses: actions/checkout@v3
-
- - name: Checkout hathach/linkermap
- uses: actions/checkout@v3
- with:
- repository: hathach/linkermap
- path: linkermap
+ uses: actions/checkout@v4
- name: Set Toolchain URL
run: echo >> $GITHUB_ENV TOOLCHAIN_URL=https://github.com/xpack-dev-tools/riscv-none-embed-gcc-xpack/releases/download/v10.1.0-1.1/xpack-riscv-none-embed-gcc-10.1.0-1.1-linux-x64.tar.gz
@@ -72,13 +68,4 @@ jobs:
run: python3 tools/get_deps.py ${{ matrix.family }}
- name: Build
- run: python3 tools/build_family.py ${{ matrix.family }}
-
- - name: Linker Map
- run: |
- pip install linkermap/
- # find -quit to only print linkermap of 1 board per example
- for ex in `ls -d examples/device/*/`
- do
- find ${ex} -name *.map -print -quit | xargs -I % sh -c 'echo "::group::%"; linkermap -v %; echo "::endgroup::"'
- done
+ run: python3 tools/build_make.py ${{ matrix.family }}
diff --git a/.github/workflows/build_win_mac.yml b/.github/workflows/build_win_mac.yml
index cb879a705..b33b5b593 100644
--- a/.github/workflows/build_win_mac.yml
+++ b/.github/workflows/build_win_mac.yml
@@ -35,7 +35,7 @@ jobs:
steps:
- name: Setup Python
- uses: actions/setup-python@v4
+ uses: actions/setup-python@v5
with:
python-version: '3.x'
@@ -45,10 +45,10 @@ jobs:
release: '10.3-2021.10'
- name: Checkout TinyUSB
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Get Dependencies
run: python3 tools/get_deps.py stm32f4
- name: Build
- run: python3 tools/build_family.py stm32f4 stm32f411disco
+ run: python3 tools/build_make.py stm32f4 stm32f411disco
diff --git a/.github/workflows/cmake_arm.yml b/.github/workflows/cmake_arm.yml
index 8eeae928c..f97645ad1 100644
--- a/.github/workflows/cmake_arm.yml
+++ b/.github/workflows/cmake_arm.yml
@@ -8,6 +8,8 @@ on:
- 'examples/**'
- 'lib/**'
- 'hw/**'
+ - 'test/hil/**'
+ - 'tools/get_deps.py'
- '.github/workflows/cmake_arm.yml'
pull_request:
branches: [ master ]
@@ -16,6 +18,8 @@ on:
- 'examples/**'
- 'lib/**'
- 'hw/**'
+ - 'test/hil/**'
+ - 'tools/get_deps.py'
- '.github/workflows/cmake_arm.yml'
concurrency:
@@ -35,22 +39,27 @@ jobs:
# Alphabetical order
- 'imxrt'
- 'kinetis_kl'
- - 'lpc18 lpc40 lpc43'
- - 'lpc55'
+ - 'lpc17 lpc18 lpc40 lpc43'
+ - 'lpc54 lpc55'
- 'mcx'
+ - 'nrf'
- 'ra'
- 'rp2040'
+ - 'samd21'
+ - 'samd51'
- 'stm32f0'
- 'stm32f1'
- 'stm32f4'
- 'stm32f7'
- 'stm32g0'
- 'stm32g4'
+ - 'stm32h5'
- 'stm32h7'
- 'stm32l4'
+ - 'stm32u5'
steps:
- name: Setup Python
- uses: actions/setup-python@v4
+ uses: actions/setup-python@v5
with:
python-version: '3.x'
@@ -63,11 +72,11 @@ jobs:
run: sudo apt install -y ninja-build
- name: Checkout TinyUSB
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Checkout pico-sdk for rp2040
if: matrix.family == 'rp2040'
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
with:
repository: raspberrypi/pico-sdk
ref: develop
@@ -82,35 +91,46 @@ jobs:
# for rp2040, there is no harm if defined for other families
PICO_SDK_PATH: ${{ github.workspace }}/pico-sdk
- # Upload binaries for hardware test with self-hosted
- - name: Prepare rp2040 Artifacts
- if: contains(matrix.family, 'rp2040') && github.repository_owner == 'hathach'
- working-directory: ${{github.workspace}}/cmake-build/cmake-build-raspberry_pi_pico
- run: |
- find device/ -name "*.elf" -exec mv {} ../../ \;
- # find host/ -name "*.elf" -exec mv {} ../../ \;
- # find dual/ -name "*.elf" -exec mv {} ../../ \;
+ - name: Upload Artifacts for Hardware Testing (rp2040)
+ if: matrix.family == 'rp2040' && github.repository_owner == 'hathach'
+ uses: actions/upload-artifact@v3
+ with:
+ name: raspberry_pi_pico
+ path: |
+ cmake-build/cmake-build-raspberry_pi_pico/*/*/*.elf
- - name: Upload Artifacts for rp2040
- if: contains(matrix.family,'rp2040') && github.repository_owner == 'hathach'
+ - name: Upload Artifacts for Hardware Testing (nRF)
+ if: matrix.family == 'nrf' && github.repository_owner == 'hathach'
uses: actions/upload-artifact@v3
with:
- name: rp2040
+ name: feather_nrf52840_express
path: |
- *.elf
+ cmake-build/cmake-build-feather_nrf52840_express/*/*/*.elf
+
+ - name: Upload Artifacts for Hardware Testing (samd51)
+ if: matrix.family == 'samd51' && github.repository_owner == 'hathach'
+ uses: actions/upload-artifact@v3
+ 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 with
- # - pico + pico-probe connected via USB
- # - pico-probe is /dev/ttyACM0
+ # Current self-hosted instance is running on an RPI4. For attached hardware checkout hil_pi4.json
# ---------------------------------------
- hw-rp2040-test:
+ hil-test:
# run only with hathach's commit due to limited resource on RPI4
if: github.repository_owner == 'hathach'
needs: build-arm
- runs-on: [self-hosted, Linux, ARM64, rp2040]
-
+ 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: |
@@ -118,43 +138,26 @@ jobs:
rm -rf "${{ github.workspace }}"
mkdir -p "${{ github.workspace }}"
- - name: Download rp2040 Artifacts
- uses: actions/download-artifact@v3
- with:
- name: rp2040
-
- - name: Create flash.sh
- run: |
- echo > flash.sh 'cmdout=$(openocd -f "interface/cmsis-dap.cfg" -f "target/rp2040.cfg" -c "adapter speed 5000" -c "program $1 reset exit")'
- echo >> flash.sh 'if (( $? )) ; then echo $cmdout ; fi'
- chmod +x flash.sh
-
- - name: Test cdc_dual_ports
+ # USB bus on rpi4 is not stable, reset it before testing
+ - name: Reset USB bus
run: |
- ./flash.sh cdc_dual_ports.elf
- while (! ([ -e /dev/ttyACM1 ] && [ -e /dev/ttyACM2 ])) && [ $SECONDS -le 10 ]; do :; done
- test -e /dev/ttyACM1 && echo "ttyACM1 exists"
- test -e /dev/ttyACM2 && echo "ttyACM2 exists"
+ for port in $(lspci | grep USB | cut -d' ' -f1); do
+ echo -n "0000:${port}"| sudo tee /sys/bus/pci/drivers/xhci_hcd/unbind;
+ sleep 0.1;
+ echo -n "0000:${port}" | sudo tee /sys/bus/pci/drivers/xhci_hcd/bind;
+ done
- - name: Test cdc_msc
- run: |
- ./flash.sh cdc_msc.elf
- readme='/media/pi/TinyUSB MSC/README.TXT'
- while (! ([ -e /dev/ttyACM1 ] && [ -f "$readme" ])) && [ $SECONDS -le 10 ]; do :; done
- test -e /dev/ttyACM1 && echo "ttyACM1 exists"
- test -f "$readme" && echo "$readme exists"
- cat "$readme"
+ - name: Checkout test/hil
+ uses: actions/checkout@v4
+ with:
+ sparse-checkout: test/hil
- - name: Test dfu
- run: |
- ./flash.sh dfu.elf
- while (! (dfu-util -l | grep "Found DFU")) && [ $SECONDS -le 10 ]; do :; done
- dfu-util -d cafe -a 0 -U dfu0
- dfu-util -d cafe -a 1 -U dfu1
- grep "TinyUSB DFU! - Partition 0" dfu0
- grep "TinyUSB DFU! - Partition 1" dfu1
+ - name: Download Artifacts
+ uses: actions/download-artifact@v3
+ with:
+ name: ${{ matrix.board }}
+ path: cmake-build/cmake-build-${{ matrix.board }}
- - name: Test dfu_runtime
+ - name: Test on actual hardware
run: |
- ./flash.sh dfu_runtime.elf
- while (! (dfu-util -l | grep "Found Runtime")) && [ $SECONDS -le 10 ]; do :; done
+ python3 test/hil/hil_test.py --board ${{ matrix.board }} hil_pi4.json
diff --git a/.github/workflows/codeql-buildscript.sh b/.github/workflows/codeql-buildscript.sh
new file mode 100644
index 000000000..35e029922
--- /dev/null
+++ b/.github/workflows/codeql-buildscript.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+
+FAMILY=stm32l4
+python3 tools/get_deps.py $FAMILY
+python3 tools/build_make.py $FAMILY
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
new file mode 100644
index 000000000..3d51fc5b7
--- /dev/null
+++ b/.github/workflows/codeql.yml
@@ -0,0 +1,137 @@
+# For most projects, this workflow file will not need changing; you simply need
+# to commit it to your repository.
+#
+# You may wish to alter this file to override the set of languages analyzed,
+# or to provide custom queries or build logic.
+#
+# ******** NOTE ********
+# We have attempted to detect the languages in your repository. Please check
+# the `language` matrix defined below to confirm you have the correct set of
+# supported CodeQL languages.
+#
+name: "CodeQL"
+
+on:
+ push:
+ branches: [ 'master' ]
+ paths:
+ - 'src/**'
+ - 'examples/**'
+ - 'lib/**'
+ - 'hw/**'
+ - '.github/workflows/codeql.yml'
+ pull_request:
+ branches: [ 'master' ]
+ paths:
+ - 'src/**'
+ - 'examples/**'
+ - 'lib/**'
+ - 'hw/**'
+ - '.github/workflows/codeql.yml'
+ schedule:
+ - cron: '0 0 * * *'
+
+jobs:
+ analyze:
+ name: Analyze
+ # Runner size impacts CodeQL analysis time. To learn more, please see:
+ # - https://gh.io/recommended-hardware-resources-for-running-codeql
+ # - https://gh.io/supported-runners-and-hardware-resources
+ # - https://gh.io/using-larger-runners
+ # Consider using larger runners for possible analysis time improvements.
+ runs-on: ubuntu-latest
+ timeout-minutes: 360
+ permissions:
+ actions: read
+ contents: read
+ security-events: write
+
+ strategy:
+ fail-fast: false
+ matrix:
+ language: [ 'c-cpp' ]
+ # CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ]
+ # Use only 'java-kotlin' to analyze code written in Java, Kotlin or both
+ # Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
+ # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+
+ - name: Install ARM GCC
+ uses: carlosperate/arm-none-eabi-gcc-action@v1
+ with:
+ release: '11.2-2022.02'
+
+ # Initializes the CodeQL tools for scanning.
+ - name: Initialize CodeQL
+ uses: github/codeql-action/init@v2
+ with:
+ languages: ${{ matrix.language }}
+ # If you wish to specify custom queries, you can do so here or in a config file.
+ # By default, queries listed here will override any specified in a config file.
+ # Prefix the list here with "+" to use these queries and those in the config file.
+
+ # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
+ # queries: security-extended,security-and-quality
+ queries: security-and-quality
+
+
+ # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
+ # If this step fails, then you should remove it and run the build manually (see below)
+ #- name: Autobuild
+ # uses: github/codeql-action/autobuild@v2
+
+ # â„šī¸ Command-line programs to run using the OS shell.
+ # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
+
+ # If the Autobuild fails above, remove it and uncomment the following three lines.
+ # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
+
+ - run: |
+ ./.github/workflows/codeql-buildscript.sh
+
+ - name: Perform CodeQL Analysis
+ uses: github/codeql-action/analyze@v2
+ with:
+ category: "/language:${{matrix.language}}"
+ upload: false
+ id: step1
+
+ # Filter out rules with low severity or high false positive rate
+ # Also filter out warnings in third-party code
+ - name: Filter out unwanted errors and warnings
+ uses: advanced-security/filter-sarif@v1
+ with:
+ patterns: |
+ -**:cpp/path-injection
+ -**:cpp/world-writable-file-creation
+ -**:cpp/poorly-documented-function
+ -**:cpp/potentially-dangerous-function
+ -**:cpp/use-of-goto
+ -**:cpp/integer-multiplication-cast-to-long
+ -**:cpp/comparison-with-wider-type
+ -**:cpp/leap-year/*
+ -**:cpp/ambiguously-signed-bit-field
+ -**:cpp/suspicious-pointer-scaling
+ -**:cpp/suspicious-pointer-scaling-void
+ -**:cpp/unsigned-comparison-zero
+ -**/third*party/**
+ -**/3rd*party/**
+ -**/external/**
+ input: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif
+ output: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif
+
+ - name: Upload SARIF
+ uses: github/codeql-action/upload-sarif@v2
+ with:
+ sarif_file: ${{ steps.step1.outputs.sarif-output }}
+ category: "/language:${{matrix.language}}"
+
+ - name: Archive CodeQL results
+ uses: actions/upload-artifact@v3
+ with:
+ name: codeql-results
+ path: ${{ steps.step1.outputs.sarif-output }}
+ retention-days: 5
diff --git a/.github/workflows/fail_on_error.py b/.github/workflows/fail_on_error.py
new file mode 100755
index 000000000..29791742b
--- /dev/null
+++ b/.github/workflows/fail_on_error.py
@@ -0,0 +1,34 @@
+#!/usr/bin/env python3
+
+import json
+import sys
+
+# Return whether SARIF file contains error-level results
+def codeql_sarif_contain_error(filename):
+ with open(filename, 'r') as f:
+ s = json.load(f)
+
+ for run in s.get('runs', []):
+ rules_metadata = run['tool']['driver']['rules']
+ if not rules_metadata:
+ rules_metadata = run['tool']['extensions'][0]['rules']
+
+ for res in run.get('results', []):
+ if 'ruleIndex' in res:
+ rule_index = res['ruleIndex']
+ elif 'rule' in res and 'index' in res['rule']:
+ rule_index = res['rule']['index']
+ else:
+ continue
+ try:
+ rule_level = rules_metadata[rule_index]['defaultConfiguration']['level']
+ except IndexError as e:
+ print(e, rule_index, len(rules_metadata))
+ else:
+ if rule_level == 'error':
+ return True
+ return False
+
+if __name__ == "__main__":
+ if codeql_sarif_contain_error(sys.argv[1]):
+ sys.exit(1)
diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml
index f984954d9..e36259daa 100644
--- a/.github/workflows/pre-commit.yml
+++ b/.github/workflows/pre-commit.yml
@@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Setup Python
- uses: actions/setup-python@v4
+ uses: actions/setup-python@v5
with:
python-version: '3.x'
@@ -25,7 +25,7 @@ jobs:
ruby-version: '3.0'
- name: Checkout TinyUSB
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Get Dependencies
run: |
diff --git a/.github/workflows/trigger.yml b/.github/workflows/trigger.yml
index 33e3db859..cf40ac955 100644
--- a/.github/workflows/trigger.yml
+++ b/.github/workflows/trigger.yml
@@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Push to tinyusb_src
run: |