summaryrefslogtreecommitdiff
path: root/.github/workflows
diff options
context:
space:
mode:
authorhathach <[email protected]>2026-02-11 16:34:28 +0700
committerhathach <[email protected]>2026-02-11 16:46:27 +0700
commit2e8e33f28494307276d7a5417569461fe6584b80 (patch)
treec6163fcd2d0fc61471a9dd44cb2af76a4a8248e1 /.github/workflows
parent07a3b3b34f67b12cbbe7865923341d9746a1e8fc (diff)
add build target argument to improve flexibility of build scripts and workflows
membrowse-upload upload with --identical if elf file does not exist
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/build.yml23
-rw-r--r--.github/workflows/build_util.yml38
2 files changed, 39 insertions, 22 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 2b0c38c4f..412d52bb8 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -47,8 +47,6 @@ jobs:
- '.github/workflows/ci_set_matrix.py'
set-matrix:
- needs: [ check-paths ]
- if: needs.check-paths.outputs.code_changed == 'true'
runs-on: ubuntu-latest
outputs:
json: ${{ steps.set-matrix-json.outputs.matrix }}
@@ -75,7 +73,7 @@ jobs:
# For Make and IAR build: will be done on CircleCI only (one random per family as well)
# ------------------------------------------------------------------------------
cmake:
- needs: set-matrix
+ needs: [ check-paths, set-matrix ]
uses: ./.github/workflows/build_util.yml
strategy:
fail-fast: false
@@ -95,10 +93,12 @@ jobs:
upload-metrics: true
upload-artifacts: false
upload-membrowse: true
+ code-changed: ${{ needs.check-paths.outputs.code_changed == 'true' }}
secrets: inherit
code-metrics:
- needs: cmake
+ needs: [ check-paths, cmake ]
+ if: needs.check-paths.outputs.code_changed == true
runs-on: ubuntu-latest
permissions:
pull-requests: write
@@ -196,17 +196,18 @@ jobs:
# ---------------------------------------
build-os:
needs: [ check-paths ]
- if: needs.check-paths.outputs.code_changed == 'true'
+ if: needs.check-paths.outputs.code_changed == true
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: 'cmake-make'
+ build-system: ${{ matrix.build-system }}
toolchain: 'arm-gcc-${{ matrix.os }}'
- build-args: '["stm32h7"]'
+ build-args: '["stm32h7rs"]'
build-options: '--one-random'
# ---------------------------------------
@@ -215,7 +216,8 @@ jobs:
zephyr:
needs: [ check-paths ]
# skip zephyr build due to failed build, fix later
- if: false && needs.check-paths.outputs.code_changed == 'true'
+ if: false
+ #if: needs.check-paths.outputs.code_changed == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout TinyUSB
@@ -237,8 +239,8 @@ jobs:
# Run on PR only (hil-tinyusb), hil-hfp only run on non-forked PR
# ---------------------------------------
hil-build:
- needs: set-matrix
- if: github.repository_owner == 'hathach'
+ needs: [ check-paths, set-matrix ]
+ if: needs.check-paths.outputs.code_changed == true && github.repository_owner == 'hathach'
uses: ./.github/workflows/build_util.yml
strategy:
fail-fast: false
@@ -299,6 +301,7 @@ jobs:
hil-hfp:
needs: [ check-paths ]
if: |
+ needs.check-paths.outputs.code_changed == true &&
github.repository_owner == 'hathach' &&
!(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == true)
runs-on: [ self-hosted, Linux, X64, hifiphile ]
diff --git a/.github/workflows/build_util.yml b/.github/workflows/build_util.yml
index eb3c4df89..4200c11bd 100644
--- a/.github/workflows/build_util.yml
+++ b/.github/workflows/build_util.yml
@@ -3,6 +3,10 @@ name: Reusable build util
on:
workflow_call:
inputs:
+ os:
+ required: false
+ type: string
+ default: 'ubuntu-latest'
build-system:
required: true
type: string
@@ -28,10 +32,10 @@ on:
required: false
default: false
type: boolean
- os:
+ code-changed:
required: false
- type: string
- default: 'ubuntu-latest'
+ default: false
+ type: boolean
jobs:
family:
@@ -58,19 +62,29 @@ jobs:
arg: ${{ matrix.arg }}
- name: Build
+ if: ${{ inputs.code-changed }}
env:
IAR_LMS_BEARER_TOKEN: ${{ secrets.IAR_LMS_BEARER_TOKEN }}
- MEMBROWSE_API_KEY: ${{ secrets.MEMBROWSE_API_KEY }}
- MEMBROWSE_UPLOAD_OPTION: ${{ inputs.upload-membrowse && '--membrowse-upload' || '' }}
- TOOLCHAIN: ${{ inputs.toolchain }}
run: |
- if [ "$TOOLCHAIN" == "esp-idf" ]; then
- docker run --rm -e MEMBROWSE_API_KEY="$MEMBROWSE_API_KEY" -v $PWD:/project -w /project espressif/idf:tinyusb python tools/build.py $MEMBROWSE_UPLOAD_OPTION ${{ matrix.arg }}
- elif [ "${{ inputs.build-system }}" == "cmake-make" ] || [ "${{ inputs.build-system }}" == "make-cmake" ]; then
- python tools/build.py -s make $MEMBROWSE_UPLOAD_OPTION ${{ steps.setup-toolchain.outputs.build_option }} ${{ inputs.build-options }} ${{ matrix.arg }}
- python tools/build.py -s cmake $MEMBROWSE_UPLOAD_OPTION ${{ steps.setup-toolchain.outputs.build_option }} ${{ inputs.build-options }} ${{ matrix.arg }}
+ if [ "${{ inputs.toolchain }}" == "esp-idf" ]; then
+ docker run --rm -e MEMBROWSE_API_KEY="$MEMBROWSE_API_KEY" -v $PWD:/project -w /project espressif/idf:tinyusb python tools/build.py -T all ${{ matrix.arg }}
else
- python tools/build.py -s ${{ inputs.build-system }} $MEMBROWSE_UPLOAD_OPTION ${{ steps.setup-toolchain.outputs.build_option }} ${{ inputs.build-options }} ${{ matrix.arg }}
+ BUILD_PY_ARGS="-s ${{ inputs.build-system }} ${{ steps.setup-toolchain.outputs.build_option }} ${{ inputs.build-options }}"
+ python tools/build.py $BUILD_PY_ARGS --target all ${{ matrix.arg }}
+
+ if [ "${{ inputs.upload-metrics }}" = "true" ]; then
+ python tools/build.py $BUILD_PY_ARGS --target tinyusb_metrics ${{ matrix.arg }}
+ fi
+ fi
+ shell: bash
+
+ - name: Membrowse Upload
+ if: inputs.toolchain != 'esp-idf'
+ env:
+ MEMBROWSE_API_KEY: ${{ secrets.MEMBROWSE_API_KEY }}
+ run: |
+ if [ "${{ inputs.upload-membrowse }}" = "true" ]; then
+ python tools/build.py $BUILD_PY_ARGS --target examples-membrowse-upload ${{ matrix.arg }}
fi
shell: bash