diff options
| author | tobozo <[email protected]> | 2023-03-30 19:30:24 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-03-30 19:30:24 +0000 |
| commit | 290f18a1fe4551cb0376d356627bda595c621518 (patch) | |
| tree | 789f93ee268cb9c9cccc03702f8a1769ae4a3d9d /.github/workflows | |
| parent | 9e38b4cc68d9eeeb055349a97caf30d1cf4000e0 (diff) | |
| parent | 5add4c97fa834004e6a3b267345a13c6d3c9514a (diff) | |
Merge branch 'hathach:master' into master
Diffstat (limited to '.github/workflows')
| -rw-r--r-- | .github/workflows/build_aarch64.yml | 38 | ||||
| -rw-r--r-- | .github/workflows/build_arm.yml | 288 | ||||
| -rw-r--r-- | .github/workflows/build_esp.yml | 37 | ||||
| -rw-r--r-- | .github/workflows/build_iar.yml | 49 | ||||
| -rw-r--r-- | .github/workflows/build_msp430.yml | 48 | ||||
| -rw-r--r-- | .github/workflows/build_renesas.yml | 45 | ||||
| -rw-r--r-- | .github/workflows/build_riscv.yml | 46 | ||||
| -rw-r--r-- | .github/workflows/build_win_mac.yml | 53 | ||||
| -rw-r--r-- | .github/workflows/cifuzz.yml | 33 | ||||
| -rw-r--r-- | .github/workflows/pre-commit.yml | 47 | ||||
| -rw-r--r-- | .github/workflows/trigger.yml | 9 |
11 files changed, 521 insertions, 172 deletions
diff --git a/.github/workflows/build_aarch64.yml b/.github/workflows/build_aarch64.yml index 8cf7852b9..cc8ddb070 100644 --- a/.github/workflows/build_aarch64.yml +++ b/.github/workflows/build_aarch64.yml @@ -1,11 +1,25 @@ name: Build AArch64 on: - pull_request: push: - release: - types: - - created + paths: + - 'src/**' + - 'examples/**' + - 'lib/**' + - 'hw/**' + - '.github/workflows/build_aarch64.yml' + pull_request: + branches: [ master ] + paths: + - 'src/**' + - 'examples/**' + - 'lib/**' + - 'hw/**' + - '.github/workflows/build_aarch64.yml' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true jobs: # --------------------------------------- @@ -21,16 +35,15 @@ jobs: - 'broadcom_64bit' steps: - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 + with: + python-version: '3.x' - name: Checkout TinyUSB - uses: actions/checkout@v2 - - - name: Checkout common submodules in lib - run: git submodule update --init lib/FreeRTOS-Kernel lib/lwip lib/sct_neopixel + uses: actions/checkout@v3 - name: Checkout hathach/linkermap - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: hathach/linkermap path: linkermap @@ -39,7 +52,7 @@ jobs: 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 - name: Cache Toolchain - uses: actions/cache@v2 + uses: actions/cache@v3 id: cache-toolchain with: path: ~/cache/ @@ -55,6 +68,9 @@ jobs: - name: Set Toolchain Path run: echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin` + - name: Get Dependencies + run: python3 tools/get_family_deps.py ${{ matrix.family }} + - name: Build run: python3 tools/build_family.py ${{ matrix.family }} diff --git a/.github/workflows/build_arm.yml b/.github/workflows/build_arm.yml index 177f1076e..b60d12a98 100644 --- a/.github/workflows/build_arm.yml +++ b/.github/workflows/build_arm.yml @@ -1,34 +1,27 @@ name: Build ARM on: - pull_request: push: - release: - types: - - created - -jobs: - # --------------------------------------- - # Unit testing with Ceedling - # --------------------------------------- - unit-test: - runs-on: ubuntu-latest - steps: - - name: Setup Ruby - uses: actions/setup-ruby@v1 - with: - ruby-version: '2.7' - - - name: Checkout TinyUSB - uses: actions/checkout@v2 + paths: + - 'src/**' + - 'examples/**' + - 'lib/**' + - 'hw/**' + - '.github/workflows/build_arm.yml' + pull_request: + branches: [ master ] + paths: + - 'src/**' + - 'examples/**' + - 'lib/**' + - 'hw/**' + - '.github/workflows/build_arm.yml' - - name: Unit Tests - run: | - # Install Ceedling - gem install ceedling - cd test - ceedling test:all +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true +jobs: # --------------------------------------- # Build ARM family # --------------------------------------- @@ -41,67 +34,50 @@ jobs: # Alphabetical order - 'broadcom_32bit' - 'imxrt' - - 'lpc15' - - 'lpc18' - - 'lpc54' - - 'lpc55' - - 'mm32' - - 'msp432e4' + - 'kinetis_k32 kinetis_kl' + - 'lpc11 lpc13 lpc15 lpc17 lpc18' + - 'lpc51 lpc54 lpc55' + - 'mm32 msp432e4' - 'nrf' + - 'ra' - 'rp2040' - - 'samd11' - - 'samd21' - - 'samd51' + - 'samd11 samd21' + - 'samd51 same5x' - 'saml2x' - - 'stm32f0' - - 'stm32f1' + - 'stm32f0 stm32f1 stm32f2 stm32f3' - 'stm32f4' - 'stm32f7' - - 'stm32h7' - - 'stm32l4' - - 'tm4c123' - - 'xmc4000' + - 'stm32g4 stm32h7' + - 'stm32l0 stm32l4 stm32u5 stm32wb' + - 'tm4c123 xmc4000' steps: - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 + with: + python-version: '3.x' - - name: Checkout TinyUSB - uses: actions/checkout@v2 + - name: Install ARM GCC + uses: carlosperate/arm-none-eabi-gcc-action@v1 + with: + release: '11.2-2022.02' - - name: Checkout common submodules in lib - run: git submodule update --init lib/FreeRTOS-Kernel lib/lwip lib/sct_neopixel + - name: Checkout TinyUSB + uses: actions/checkout@v3 - name: Checkout hathach/linkermap - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: hathach/linkermap path: linkermap - - name: Checkout pico-sdk + - name: Checkout pico-sdk for rp2040 if: matrix.family == 'rp2040' run: | git clone --depth 1 -b develop https://github.com/raspberrypi/pico-sdk ~/pico-sdk echo >> $GITHUB_ENV PICO_SDK_PATH=~/pico-sdk - - name: Set Toolchain URL - run: echo >> $GITHUB_ENV TOOLCHAIN_URL=https://github.com/xpack-dev-tools/arm-none-eabi-gcc-xpack/releases/download/v10.2.1-1.1/xpack-arm-none-eabi-gcc-10.2.1-1.1-linux-x64.tar.gz - - - name: Cache Toolchain - uses: actions/cache@v2 - id: cache-toolchain - with: - path: ~/cache/ - key: ${{ runner.os }}-21-03-04-${{ env.TOOLCHAIN_URL }} - - - name: Install Toolchain - if: steps.cache-toolchain.outputs.cache-hit != 'true' - run: | - mkdir -p ~/cache/toolchain - wget --progress=dot:mega $TOOLCHAIN_URL -O toolchain.tar.gz - tar -C ~/cache/toolchain -xaf toolchain.tar.gz - - - name: Set Toolchain Path - run: echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin` + - name: Get Dependencies + run: python3 tools/get_family_deps.py ${{ matrix.family }} - name: Build run: python3 tools/build_family.py ${{ matrix.family }} @@ -109,56 +85,160 @@ jobs: - 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::"'; \ + # 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 + # Upload binaries for rp2040/stm32l412nucleo hardware test with self-hosted + + - name: Prepare rp2040 Artifacts + if: contains(matrix.family, 'rp2040') && github.repository_owner == 'hathach' + run: find examples/ -name "*.elf" -exec mv {} . \; + + - name: Prepare stm32l412nucleo Artifacts + if: contains(matrix.family, 'stm32l4') + run: find examples/ -path "*stm32l412nucleo/*.elf" -exec mv {} . \; + + - name: Upload Artifacts for rp2040 + if: contains(matrix.family,'rp2040') && github.repository_owner == 'hathach' + uses: actions/upload-artifact@v3 + with: + name: rp2040 + path: | + *.elf + + - name: Upload Artifacts for stm32l412nucleo + if: contains(matrix.family, 'stm32l4') && github.repository_owner == 'hathach' + uses: actions/upload-artifact@v3 + with: + name: stm32l4 + path: | + *.elf + # --------------------------------------- - # Build all no-family (orphaned) boards + # 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 # --------------------------------------- - build-board: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - example: - # Alphabetical order, a group of 4 - - 'device/audio_test device/board_test device/cdc_dual_ports device/cdc_msc' - - 'device/cdc_msc_freertos device/dfu_runtime device/hid_composite device/hid_composite_freertos' - - 'device/hid_generic_inout device/hid_multiple_interface device/midi_test device/msc_dual_lun' - - 'device/net_lwip_webserver' - - 'device/uac2_headset device/usbtmc device/webusb_serial host/cdc_msc_hid' + hw-rp2040-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] steps: - - name: Setup Python - uses: actions/setup-python@v2 + - name: Clean workspace + run: | + echo "Cleaning up previous run" + rm -rf "${{ github.workspace }}" + mkdir -p "${{ github.workspace }}" - - name: Checkout TinyUSB - uses: actions/checkout@v2 + - name: Download rp2040 Artifacts + uses: actions/download-artifact@v3 + with: + name: rp2040 - - name: Checkout common submodules in lib - run: git submodule update --init lib/FreeRTOS-Kernel lib/lwip + - name: Create flash.sh + run: | + #echo > flash.sh 'cmdout=$(openocd -f "interface/picoprobe.cfg" -f "target/rp2040.cfg" -c "program $1 reset exit")' + echo > flash.sh 'pyocd flash -t rp2040 $1' + echo >> flash.sh 'if (( $? )) ; then echo $cmdout ; fi' + chmod +x flash.sh + + - name: Test cdc_dual_ports + 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" - - name: Set Toolchain URL - run: echo >> $GITHUB_ENV TOOLCHAIN_URL=https://github.com/xpack-dev-tools/arm-none-eabi-gcc-xpack/releases/download/v10.2.1-1.1/xpack-arm-none-eabi-gcc-10.2.1-1.1-linux-x64.tar.gz + - 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: Cache Toolchain - uses: actions/cache@v2 - id: cache-toolchain + - 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: Test dfu_runtime + run: | + ./flash.sh dfu_runtime.elf + while (! (dfu-util -l | grep "Found Runtime")) && [ $SECONDS -le 10 ]; do :; done + + # --------------------------------------- + # Hardware in the loop (HIL) + # Current self-hosted instance is running on an EPYC 7232 server hosted by HiFiPhile user + # - STM32L412 Nucleo with on-board jlink as ttyACM0 + # --------------------------------------- + hw-stm32l412nucleo-test: + needs: build-arm + runs-on: [self-hosted, Linux, X64, hifiphile] + + steps: + - name: Clean workspace + run: | + echo "Cleaning up previous run" + rm -rf "${{ github.workspace }}" + mkdir -p "${{ github.workspace }}" + + - name: Download stm32l4 Artifacts + uses: actions/download-artifact@v3 with: - path: ~/cache/ - key: ${{ runner.os }}-21-03-04-${{ env.TOOLCHAIN_URL }} + name: stm32l4 - - name: Install Toolchain - if: steps.cache-toolchain.outputs.cache-hit != 'true' + - name: Create flash.sh run: | - mkdir -p ~/cache/toolchain - wget --progress=dot:mega $TOOLCHAIN_URL -O toolchain.tar.gz - tar -C ~/cache/toolchain -xaf toolchain.tar.gz + echo > flash.sh 'echo halt > flash.jlink' + echo >> flash.sh 'echo r >> flash.jlink' + echo >> flash.sh 'echo loadfile $1 >> flash.jlink' + echo >> flash.sh 'echo r >> flash.jlink' + echo >> flash.sh 'echo go >> flash.jlink' + echo >> flash.sh 'echo exit >> flash.jlink' + echo >> flash.sh 'cmdout=$(JLinkExe -device stm32l412kb -if swd -JTAGConf -1,-1 -speed auto -NoGui 1 -ExitOnError 1 -CommandFile flash.jlink)' + echo >> flash.sh 'if (( $? )) ; then echo $cmdout ; fi' + chmod +x flash.sh - - name: Set Toolchain Path - run: echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin` + - name: Test cdc_dual_ports + 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" - - name: Build - run: python3 tools/build_board.py ${{ matrix.example }} + # Debian does not auto mount usb drive. skip this test for now + - name: Test cdc_msc + if: false + 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: 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: Test dfu_runtime + run: | + ./flash.sh dfu_runtime.elf + while (! (dfu-util -l | grep "Found Runtime")) && [ $SECONDS -le 10 ]; do :; done diff --git a/.github/workflows/build_esp.yml b/.github/workflows/build_esp.yml index 1ed76ef4d..dbc51a60f 100644 --- a/.github/workflows/build_esp.yml +++ b/.github/workflows/build_esp.yml @@ -1,11 +1,25 @@ name: Build ESP on: - pull_request: push: - release: - types: - - created + paths: + - 'src/**' + - 'examples/**' + - 'lib/**' + - 'hw/**' + - '.github/workflows/build_esp.yml' + pull_request: + branches: [ master ] + paths: + - 'src/**' + - 'examples/**' + - 'lib/**' + - 'hw/**' + - '.github/workflows/build_esp.yml' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true jobs: build-esp: @@ -23,16 +37,18 @@ jobs: steps: - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 + with: + python-version: '3.x' - name: Pull ESP-IDF docker run: docker pull espressif/idf:latest - name: Checkout TinyUSB - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Checkout hathach/linkermap - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: hathach/linkermap path: linkermap @@ -43,7 +59,8 @@ jobs: - name: Linker Map run: | pip install linkermap/ - 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::"'; \ + # 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 diff --git a/.github/workflows/build_iar.yml b/.github/workflows/build_iar.yml new file mode 100644 index 000000000..a5d24892f --- /dev/null +++ b/.github/workflows/build_iar.yml @@ -0,0 +1,49 @@ +name: Build IAR + +on: + push: + paths: + - 'src/**' + - 'examples/**' + - 'lib/**' + - 'hw/**' + - '.github/workflows/build_iar.yml' + pull_request: + branches: [ master ] + paths: + - 'src/**' + - 'examples/**' + - 'lib/**' + - 'hw/**' + - '.github/workflows/build_iar.yml' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + build-arm: + runs-on: [self-hosted, Linux, X64, hifiphile] + strategy: + fail-fast: false + matrix: + family: + # 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. + - 'stm32f0 stm32f1 stm32f4 stm32f7 stm32g4 stm32h7 stm32l4' + steps: + - name: Clean workspace + run: | + echo "Cleaning up previous run" + rm -rf "${{ github.workspace }}" + mkdir -p "${{ github.workspace }}" + + - name: Checkout TinyUSB + uses: actions/checkout@v3 + + - name: Get Dependencies + run: python3 tools/get_family_deps.py ${{ matrix.family }} + + - name: Build + run: python3 tools/build_family.py ${{ matrix.family }} CC=iccarm diff --git a/.github/workflows/build_msp430.yml b/.github/workflows/build_msp430.yml index 98dc36cd9..7cb60dceb 100644 --- a/.github/workflows/build_msp430.yml +++ b/.github/workflows/build_msp430.yml @@ -1,13 +1,27 @@ name: Build MSP430 on: - pull_request: push: - release: - types: - - created + paths: + - 'src/**' + - 'examples/**' + - 'lib/**' + - 'hw/**' + - '.github/workflows/build_msp430.yml' + pull_request: + branches: [ master ] + paths: + - 'src/**' + - 'examples/**' + - 'lib/**' + - 'hw/**' + - '.github/workflows/build_msp430.yml' -jobs: +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: build-msp430: runs-on: ubuntu-latest strategy: @@ -16,18 +30,18 @@ jobs: family: # Alphabetical order - 'msp430' + steps: - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 + with: + python-version: '3.x' - name: Checkout TinyUSB - uses: actions/checkout@v2 - - - name: Checkout common submodules in lib - run: git submodule update --init lib/FreeRTOS-Kernel lib/lwip + uses: actions/checkout@v3 - name: Checkout hathach/linkermap - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: hathach/linkermap path: linkermap @@ -36,7 +50,7 @@ jobs: 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 - name: Cache Toolchain - uses: actions/cache@v2 + uses: actions/cache@v3 id: cache-toolchain with: path: ~/cache/ @@ -52,13 +66,17 @@ jobs: - name: Set Toolchain Path run: echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin` + - name: Get Dependencies + run: python3 tools/get_family_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::"'; \ + # 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 diff --git a/.github/workflows/build_renesas.yml b/.github/workflows/build_renesas.yml index 6eb042d72..ffdeedb71 100644 --- a/.github/workflows/build_renesas.yml +++ b/.github/workflows/build_renesas.yml @@ -1,11 +1,25 @@ name: Build Renesas on: - pull_request: push: - release: - types: - - created + paths: + - 'src/**' + - 'examples/**' + - 'lib/**' + - 'hw/**' + - '.github/workflows/build_renesas.yml' + pull_request: + branches: [ master ] + paths: + - 'src/**' + - 'examples/**' + - 'lib/**' + - 'hw/**' + - '.github/workflows/build_renesas.yml' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true jobs: build-rx: @@ -18,16 +32,15 @@ jobs: - 'rx' steps: - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 + with: + python-version: '3.x' - name: Checkout TinyUSB - uses: actions/checkout@v2 - - - name: Checkout common submodules in lib - run: git submodule update --init lib/FreeRTOS-Kernel lib/lwip + uses: actions/checkout@v3 - name: Checkout hathach/linkermap - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: hathach/linkermap path: linkermap @@ -36,7 +49,7 @@ jobs: 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 - name: Cache Toolchain - uses: actions/cache@v2 + uses: actions/cache@v3 id: cache-toolchain with: path: ~/cache/ @@ -53,13 +66,17 @@ jobs: - name: Set Toolchain Path run: echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin` + - name: Get Dependencies + run: python3 tools/get_family_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::"'; \ + # 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 diff --git a/.github/workflows/build_riscv.yml b/.github/workflows/build_riscv.yml index 0c7b2d154..87c7b522e 100644 --- a/.github/workflows/build_riscv.yml +++ b/.github/workflows/build_riscv.yml @@ -1,11 +1,25 @@ name: Build RISC-V on: - pull_request: push: - release: - types: - - created + paths: + - 'src/**' + - 'examples/**' + - 'lib/**' + - 'hw/**' + - '.github/workflows/build_riscv.yml' + pull_request: + branches: [ master ] + paths: + - 'src/**' + - 'examples/**' + - 'lib/**' + - 'hw/**' + - '.github/workflows/build_riscv.yml' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true jobs: build-riscv: @@ -15,20 +29,20 @@ jobs: matrix: family: # Alphabetical order + - 'ch32v307' - 'fomu' - 'gd32vf103' steps: - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 + with: + python-version: '3.x' - name: Checkout TinyUSB - uses: actions/checkout@v2 - - - name: Checkout common submodules in lib - run: git submodule update --init lib/FreeRTOS-Kernel lib/lwip + uses: actions/checkout@v3 - name: Checkout hathach/linkermap - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: hathach/linkermap path: linkermap @@ -37,7 +51,7 @@ jobs: 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 - name: Cache Toolchain - uses: actions/cache@v2 + uses: actions/cache@v3 id: cache-toolchain with: path: ~/cache/ @@ -53,13 +67,17 @@ jobs: - name: Set Toolchain Path run: echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin` + - name: Get Dependencies + run: python3 tools/get_family_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::"'; \ + # 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 diff --git a/.github/workflows/build_win_mac.yml b/.github/workflows/build_win_mac.yml new file mode 100644 index 000000000..4b743a686 --- /dev/null +++ b/.github/workflows/build_win_mac.yml @@ -0,0 +1,53 @@ +name: Build Windows/MacOS + +on: + push: + paths: + - 'src/**' + - 'examples/**' + - 'lib/**' + - 'hw/**' + - '.github/workflows/build_win_mac.yml' + pull_request: + branches: [ master ] + paths: + - 'src/**' + - 'examples/**' + - 'lib/**' + - 'hw/**' + - '.github/workflows/build_win_mac.yml' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + # --------------------------------------- + # Build ARM family + # --------------------------------------- + build-arm: + strategy: + fail-fast: false + matrix: + os: [windows-latest, macos-latest] + runs-on: ${{ matrix.os }} + + steps: + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install ARM GCC + uses: carlosperate/arm-none-eabi-gcc-action@v1 + with: + release: '10.3-2021.10' + + - name: Checkout TinyUSB + uses: actions/checkout@v3 + + - name: Get Dependencies + run: python3 tools/get_family_deps.py stm32f4 + + - name: Build + run: python3 tools/build_family.py stm32f4 stm32f411disco diff --git a/.github/workflows/cifuzz.yml b/.github/workflows/cifuzz.yml new file mode 100644 index 000000000..7314fd9e6 --- /dev/null +++ b/.github/workflows/cifuzz.yml @@ -0,0 +1,33 @@ +name: CIFuzz +on: + pull_request: + branches: + - master + paths: + - '**.c' + - '**.cc' + - '**.cpp' + - '**.cxx' + - '**.h' +jobs: + Fuzzing: + runs-on: ubuntu-latest + steps: + - name: Build Fuzzers + id: build + uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master + with: + oss-fuzz-project-name: 'tinyusb' + language: c++ + - name: Run Fuzzers + uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master + with: + oss-fuzz-project-name: 'tinyusb' + language: c++ + fuzz-seconds: 600 + - name: Upload Crash + uses: actions/upload-artifact@v3 + if: failure() && steps.build.outcome == 'success' + with: + name: artifacts + path: ./out/artifacts diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 000000000..ab416bc52 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,47 @@ +name: pre-commit + +on: + push: + pull_request: + branches: [ master ] + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.0' + + - name: Checkout TinyUSB + uses: actions/checkout@v3 + + - name: Get Dependencies + run: | + gem install ceedling + #cd test/unit-test + #ceedling test:all + + - name: Run pre-commit + uses: pre-commit/[email protected] + + - name: Build Fuzzer + run: | + export CC=clang + export CXX=clang++ + fuzz_harness=$(ls -d test/fuzz/device/*/) + for h in $fuzz_harness + do + make -C $h get-deps + make -C $h all + done diff --git a/.github/workflows/trigger.yml b/.github/workflows/trigger.yml index 40750a2f9..86c699dac 100644 --- a/.github/workflows/trigger.yml +++ b/.github/workflows/trigger.yml @@ -22,7 +22,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Push to tinyusb_src run: | @@ -43,7 +43,7 @@ jobs: if [ -n "$(git status --porcelain)" ]; then git add . git commit --message "Update from https://github.com/$GITHUB_REPOSITORY/commit/$GITHUB_SHA" - git push + git push fi - name: Create tinyusb_src Release @@ -53,6 +53,7 @@ jobs: cd tinyusb_src git tag ${{ github.event.release.tag_name }} git push origin ${{ github.event.release.tag_name }} - + # Send POST reqwuest to release https://docs.github.com/en/rest/reference/repos#create-a-release - curl -X POST -H "Authorization: token ${{ secrets.API_TOKEN_GITHUB }}" -H "Accept: application/vnd.github.v3+json" --data '{"tag_name": "${{ github.event.release.tag_name }}", "name": "${{ github.event.release.name }}", "body": "${{ github.event.release.body }}", "draft": ${{ github.event.release.draft }}, "prerelease": ${{ github.event.release.prerelease }}}' https://api.github.com/repos/hathach/tinyusb_src/releases + bb="For release note, please checkout https://github.com/hathach/tinyusb/releases/tag/${{ github.event.release.tag_name }}" + curl -X POST -H "Authorization: token ${{ secrets.API_TOKEN_GITHUB }}" -H "Accept: application/vnd.github.v3+json" --data '{"tag_name": "${{ github.event.release.tag_name }}", "name": "${{ github.event.release.name }}", "body": "$bb", "draft": ${{ github.event.release.draft }}, "prerelease": ${{ github.event.release.prerelease }}}' https://api.github.com/repos/hathach/tinyusb_src/releases |
