diff options
| author | Ha Thach <[email protected]> | 2026-02-10 10:26:08 +0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-02-10 10:26:08 +0700 |
| commit | 207396bba68b8eb5243fee81f0c40805032ae41c (patch) | |
| tree | eb0cae4845ac2a75f570931ea1267b29313c559c /.github | |
| parent | f5424c569ddc673a9c23b78febceed8f7f098509 (diff) | |
| parent | a65a852bcfa9c988a25024de5301b637de2b53bf (diff) | |
Merge pull request #3485 from hathach/readd-ci-checkpath
Add back check-path job to workflow
Diffstat (limited to '.github')
| -rw-r--r-- | .github/workflows/build.yml | 72 |
1 files changed, 46 insertions, 26 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ded4e816c..352875a9d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,30 +4,7 @@ on: workflow_dispatch: push: branches: [master] - paths: - - 'src/**' - - 'examples/**' - - 'lib/**' - - 'hw/**' - - 'tools/build.py' - - 'tools/get_deps.py' - - '.github/actions/**' - - '.github/workflows/build.yml' - - '.github/workflows/build_util.yml' - - '.github/workflows/ci_set_matrix.py' pull_request: - paths: - - 'src/**' - - 'examples/**' - - 'lib/**' - - 'hw/**' - - 'test/hil/**' - - 'tools/build.py' - - 'tools/get_deps.py' - - '.github/actions/**' - - '.github/workflows/build.yml' - - '.github/workflows/build_util.yml' - - '.github/workflows/ci_set_matrix.py' release: types: [ published ] @@ -39,7 +16,39 @@ env: HIL_JSON: test/hil/tinyusb.json jobs: + # Check if the code changes and we need to run ci build + # Cannot use paths filter in the on-event since we want this workflow to run even when there are no code changes, to register the commit chain + check-paths: + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: read + outputs: + code_changed: ${{ steps.filter.outputs.code }} + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 2 # Needed for push commit comparison + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + code: + - 'src/**' + - 'examples/**' + - 'lib/**' + - 'hw/**' + - 'test/hil/**' + - 'tools/build.py' + - 'tools/get_deps.py' + - '.github/actions/**' + - '.github/workflows/build.yml' + - '.github/workflows/build_util.yml' + - '.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 }} @@ -184,6 +193,8 @@ jobs: # Build Make/CMake on Windows/MacOS # --------------------------------------- build-os: + needs: [ check-paths ] + if: needs.check-paths.outputs.code_changed == 'true' uses: ./.github/workflows/build_util.yml strategy: fail-fast: false @@ -200,8 +211,9 @@ jobs: # Zephyr # --------------------------------------- zephyr: + needs: [ check-paths ] # skip zephyr build due to failed build, fix later - if: false + if: false && needs.check-paths.outputs.code_changed == 'true' runs-on: ubuntu-latest steps: - name: Checkout TinyUSB @@ -283,6 +295,7 @@ jobs: # Since IAR Token secret is not passed to forked PR, only build non-forked PR # --------------------------------------- hil-hfp: + needs: [ check-paths ] if: | github.repository_owner == 'hathach' && !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == true) @@ -325,13 +338,20 @@ jobs: # PR: only runs if code changed (doc-only PRs skip entirely) # --------------------------------------- membrowse: - needs: cmake + needs: [check-paths, cmake] + if: | + always() && !cancelled() && ( + github.event_name == 'push' || + github.event_name == 'release' || + github.event_name == 'workflow_dispatch' || + (github.event_name == 'pull_request' && needs.check-paths.outputs.code_changed == 'true') + ) permissions: contents: read actions: read uses: ./.github/workflows/membrowse-report.yml with: - code_changed: true + code_changed: ${{ needs.check-paths.outputs.code_changed == 'true' || github.event_name == 'release' || github.event_name == 'workflow_dispatch' }} secrets: inherit membrowse-comment: |
