summaryrefslogtreecommitdiff
path: root/.github/workflows
diff options
context:
space:
mode:
authorAleksei Musin <[email protected]>2026-02-09 12:22:20 +0400
committerGitHub <[email protected]>2026-02-09 12:22:20 +0400
commit6e675da608b063e2ea7db1d700d788d6a247f9ec (patch)
tree5bcf5bb529e6ca2ebefc889920b28f1fab851e3f /.github/workflows
parentebc9edfb7a512c8dd6816a40698c62c364bd78da (diff)
parentf5424c569ddc673a9c23b78febceed8f7f098509 (diff)
Merge branch 'hathach:master' into threadx_osal
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/build.yml60
-rw-r--r--.github/workflows/build_util.yml14
-rwxr-xr-x.github/workflows/ci_set_matrix.py6
-rw-r--r--.github/workflows/membrowse-comment.yml38
-rw-r--r--.github/workflows/membrowse-onboard.yml62
-rw-r--r--.github/workflows/membrowse-report.yml101
6 files changed, 270 insertions, 11 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 781d3b002..ded4e816c 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -3,6 +3,7 @@ name: Build
on:
workflow_dispatch:
push:
+ branches: [master]
paths:
- 'src/**'
- 'examples/**'
@@ -29,6 +30,7 @@ on:
- '.github/workflows/ci_set_matrix.py'
release:
types: [ published ]
+
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
@@ -82,6 +84,7 @@ jobs:
build-args: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain]) }}
build-options: '--one-first'
upload-metrics: true
+ upload-artifacts: true
code-metrics:
needs: cmake
@@ -181,7 +184,6 @@ jobs:
# Build Make/CMake on Windows/MacOS
# ---------------------------------------
build-os:
- if: github.event_name == 'pull_request'
uses: ./.github/workflows/build_util.yml
strategy:
fail-fast: false
@@ -198,7 +200,8 @@ jobs:
# Zephyr
# ---------------------------------------
zephyr:
- if: github.event_name == 'push'
+ # skip zephyr build due to failed build, fix later
+ if: false
runs-on: ubuntu-latest
steps:
- name: Checkout TinyUSB
@@ -220,10 +223,8 @@ jobs:
# 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
+ if: github.repository_owner == 'hathach'
uses: ./.github/workflows/build_util.yml
strategy:
fail-fast: false
@@ -242,7 +243,6 @@ jobs:
# self-hosted on local VM, for attached hardware checkout HIL_JSON
# ---------------------------------------
hil-tinyusb:
- if: github.repository_owner == 'hathach' && github.event_name != 'push'
needs: hil-build
runs-on: [ self-hosted, X64, hathach, hardware-in-the-loop ]
steps:
@@ -285,8 +285,7 @@ jobs:
hil-hfp:
if: |
github.repository_owner == 'hathach' &&
- github.event.pull_request.head.repo.fork == false &&
- github.event_name != 'push'
+ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == true)
runs-on: [ self-hosted, Linux, X64, hifiphile ]
env:
IAR_LMS_BEARER_TOKEN: ${{ secrets.IAR_LMS_BEARER_TOKEN }}
@@ -315,7 +314,50 @@ jobs:
run: python3 tools/get_deps.py $BUILD_ARGS
- name: Build
- run: python3 tools/build.py -j 4 --toolchain iar $BUILD_ARGS
+ run: python3 tools/build.py --toolchain iar $BUILD_ARGS
- name: Test on actual hardware (hardware in the loop)
run: python3 test/hil/hil_test.py hfp.json
+
+ # ---------------------------------------
+ # Membrowse Memory Analysis
+ # Push: always runs (uses identical for doc-only to maintain commit chain)
+ # PR: only runs if code changed (doc-only PRs skip entirely)
+ # ---------------------------------------
+ membrowse:
+ needs: cmake
+ permissions:
+ contents: read
+ actions: read
+ uses: ./.github/workflows/membrowse-report.yml
+ with:
+ code_changed: true
+ secrets: inherit
+
+ membrowse-comment:
+ needs: membrowse
+ # skip membrowse comment since it is too verbal
+ if: false && github.event_name == 'pull_request'
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ actions: read
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v6
+
+ - name: Download report artifacts
+ id: download
+ uses: actions/download-artifact@v5
+ with:
+ pattern: membrowse-report-*
+ path: reports
+ merge-multiple: true
+ continue-on-error: true
+
+ - name: Upload Membrowse Comment Artifact
+ if: steps.download.outcome == 'success'
+ uses: actions/upload-artifact@v5
+ with:
+ name: membrowse-comment
+ path: reports/
diff --git a/.github/workflows/build_util.yml b/.github/workflows/build_util.yml
index 540ee8b47..e62c10ca1 100644
--- a/.github/workflows/build_util.yml
+++ b/.github/workflows/build_util.yml
@@ -73,6 +73,19 @@ jobs:
name: metrics-${{ matrix.arg }}
path: cmake-build/cmake-build-*/metrics.json
+ - name: Copy linker scripts for artifacts
+ if: ${{ inputs.upload-artifacts }}
+ run: |
+ for dir in cmake-build/cmake-build-*; do
+ board=$(basename "$dir" | sed 's/cmake-build-//')
+ ld_path=$(jq -r --arg b "$board" '.targets[] | select(.board == $b) | .ld // empty' .github/membrowse-targets.json)
+ if [ -n "$ld_path" ] && [ -f "$ld_path" ]; then
+ mkdir -p "cmake-build/$(dirname "$ld_path")"
+ cp "$ld_path" "cmake-build/$ld_path"
+ fi
+ done
+ shell: bash
+
- name: Upload Artifacts for Hardware Testing
if: ${{ inputs.upload-artifacts }}
uses: actions/upload-artifact@v5
@@ -86,3 +99,4 @@ jobs:
cmake-build/cmake-build-*/*/*/partition_table/partition-table.bin
cmake-build/cmake-build-*/*/*/config.env
cmake-build/cmake-build-*/*/*/flash_args
+ cmake-build/hw/mcu/**/*.ld
diff --git a/.github/workflows/ci_set_matrix.py b/.github/workflows/ci_set_matrix.py
index c276d5253..9ab08601d 100755
--- a/.github/workflows/ci_set_matrix.py
+++ b/.github/workflows/ci_set_matrix.py
@@ -15,7 +15,8 @@ toolchain_list = [
# family: [supported toolchain]
family_list = {
- "at32f402_405 at32f403a_407 at32f413 at32f415 at32f423 at32f425 at32f435_437 broadcom_32bit da1469x": ["arm-gcc"],
+ "at32f45x at32f402_405 at32f403a_407 at32f413 at32f415 at32f423 at32f425 at32f435_437 broadcom_32bit da1469x": [
+ "arm-gcc"],
"broadcom_64bit": ["aarch64-gcc"],
"ch32v10x ch32v20x ch32v30x fomu gd32vf103 hpmicro": ["riscv-gcc"],
"imxrt": ["arm-gcc", "arm-clang"],
@@ -37,7 +38,8 @@ family_list = {
"stm32h7": ["arm-gcc", "arm-clang", "arm-iar"],
"stm32h7rs stm32l0 stm32l4": ["arm-gcc", "arm-clang", "arm-iar"],
"stm32n6": ["arm-gcc"],
- "stm32u0 stm32u5 stm32wb stm32wba": ["arm-gcc", "arm-clang", "arm-iar"],
+ "stm32u0 stm32wb stm32wba": ["arm-gcc", "arm-clang", "arm-iar"],
+ "stm32u5": ["arm-gcc", "arm-clang", "arm-iar"],
"-bespressif_s2_devkitc": ["esp-idf"],
# S3, P4 will be built by hil test
# "-bespressif_s3_devkitm": ["esp-idf"],
diff --git a/.github/workflows/membrowse-comment.yml b/.github/workflows/membrowse-comment.yml
new file mode 100644
index 000000000..a99c9db51
--- /dev/null
+++ b/.github/workflows/membrowse-comment.yml
@@ -0,0 +1,38 @@
+name: Membrowse Comment
+
+on:
+ workflow_run:
+ workflows: ["Build"]
+ types:
+ - completed
+
+jobs:
+ post-comment:
+ runs-on: ubuntu-latest
+ if: >
+ github.event.workflow_run.event == 'pull_request' &&
+ github.event.workflow_run.conclusion != 'cancelled'
+ permissions:
+ actions: read
+ pull-requests: write
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v6
+
+ - name: Download Artifacts
+ id: download
+ uses: actions/download-artifact@v5
+ with:
+ run-id: ${{ github.event.workflow_run.id }}
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ name: membrowse-comment
+ path: reports
+ continue-on-error: true
+
+ - name: Post Membrowse PR comment
+ if: steps.download.outcome == 'success'
+ uses: membrowse/membrowse-action/comment-action@v1
+ with:
+ json_files: 'reports/*.json'
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/membrowse-onboard.yml b/.github/workflows/membrowse-onboard.yml
new file mode 100644
index 000000000..aa7204ffa
--- /dev/null
+++ b/.github/workflows/membrowse-onboard.yml
@@ -0,0 +1,62 @@
+name: Onboard to Membrowse
+
+on:
+ workflow_dispatch:
+ inputs:
+ num_commits:
+ description: 'Number of commits to process'
+ required: true
+ default: '10'
+ type: string
+
+jobs:
+ load-targets:
+ runs-on: ubuntu-22.04
+ outputs:
+ targets: ${{ steps.load.outputs.targets }}
+ toolchains: ${{ steps.load.outputs.toolchains }}
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v5
+
+ - name: Load target matrix
+ id: load
+ run: |
+ echo "targets=$(jq -c '.targets' .github/membrowse-targets.json)" >> $GITHUB_OUTPUT
+ echo "toolchains=$(jq -c '.toolchains' .github/membrowse-targets.json)" >> $GITHUB_OUTPUT
+
+ onboard:
+ needs: load-targets
+ runs-on: ubuntu-22.04
+ strategy:
+ fail-fast: false
+ matrix:
+ include: ${{ fromJson(needs.load-targets.outputs.targets) }}
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v5
+ with:
+ fetch-depth: 0
+ submodules: recursive
+
+ - name: Install packages
+ run: |
+ ${{ fromJson(needs.load-targets.outputs.toolchains)[matrix.toolchain].setup_cmd }} && python3 tools/get_deps.py ${{ matrix.get_deps || matrix.port }}
+
+ - name: Setup ccache
+ uses: hendrikmuhs/[email protected]
+ with:
+ key: ${{ matrix.port }}-${{ matrix.board }}
+
+ - name: Run Membrowse Onboard Action
+ uses: membrowse/membrowse-action/onboard-action@v1
+ with:
+ target_name: ${{ matrix.port }}-${{ matrix.board }}-${{ matrix.example }}
+ num_commits: ${{ github.event.inputs.num_commits }}
+ build_script: python3 tools/build.py -s cmake -b ${{ matrix.board }}
+ elf: cmake-build/cmake-build-${{ matrix.board }}/device/${{ matrix.example }}/${{ matrix.example }}.elf
+ ld: ${{ matrix.ld }}
+ linker_vars: ${{ matrix.linker_vars || '' }}
+ api_key: ${{ secrets.MEMBROWSE_API_KEY }}
+ api_url: ${{ vars.MEMBROWSE_API_URL }}
diff --git a/.github/workflows/membrowse-report.yml b/.github/workflows/membrowse-report.yml
new file mode 100644
index 000000000..0667418e6
--- /dev/null
+++ b/.github/workflows/membrowse-report.yml
@@ -0,0 +1,101 @@
+name: Membrowse Memory Report
+
+on:
+ workflow_call:
+ inputs:
+ code_changed:
+ description: 'Whether code paths changed (true) or doc-only (false)'
+ type: boolean
+ required: true
+
+permissions:
+ contents: read
+ actions: read
+
+jobs:
+ load-targets:
+ runs-on: ubuntu-latest
+ outputs:
+ targets: ${{ steps.load.outputs.targets }}
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v6
+
+ - name: Load target matrix
+ id: load
+ run: echo "targets=$(jq -c '.targets' .github/membrowse-targets.json)" >> $GITHUB_OUTPUT
+
+ analyze:
+ needs: [load-targets]
+ runs-on: ubuntu-latest
+ strategy:
+ fail-fast: false
+ matrix:
+ include: ${{ fromJson(needs.load-targets.outputs.targets) }}
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v6
+ with:
+ fetch-depth: 0
+ submodules: recursive
+
+ # Download artifacts when code changed (build artifacts available)
+ - name: Download build artifacts
+ if: inputs.code_changed
+ id: download
+ uses: actions/download-artifact@v5
+ with:
+ pattern: binaries-*
+ path: cmake-build
+ merge-multiple: true
+ continue-on-error: true
+
+ - name: Restore linker scripts
+ if: inputs.code_changed
+ run: cp -r cmake-build/hw . 2>/dev/null || true
+
+ - name: Check if ELF exists
+ id: check-elf
+ run: |
+ if [ -f "cmake-build/cmake-build-${{ matrix.board }}/device/${{ matrix.example }}/${{ matrix.example }}.elf" ]; then
+ echo "exists=true" >> $GITHUB_OUTPUT
+ else
+ echo "exists=false" >> $GITHUB_OUTPUT
+ fi
+
+ # Run with actual ELF analysis when build artifacts available
+ - name: Run Membrowse Analysis
+ if: steps.check-elf.outputs.exists == 'true'
+ id: membrowse
+ continue-on-error: true
+ uses: membrowse/membrowse-action@v1
+ with:
+ target_name: ${{ matrix.port }}-${{ matrix.board }}-${{ matrix.example }}
+ elf: cmake-build/cmake-build-${{ matrix.board }}/device/${{ matrix.example }}/${{ matrix.example }}.elf
+ ld: ${{ matrix.ld }}
+ linker_vars: ${{ matrix.linker_vars || '' }}
+ api_key: ${{ secrets.MEMBROWSE_API_KEY }}
+ api_url: ${{ vars.MEMBROWSE_API_URL }}
+ verbose: INFO
+
+ # Run with identical=true when no ELF (doc-only push)
+ # Preserves the chain of commits in membrowse tracking
+ - name: Run Membrowse Identical Report
+ if: steps.check-elf.outputs.exists == 'false'
+ id: membrowse-identical
+ continue-on-error: true
+ uses: membrowse/membrowse-action@v1
+ with:
+ target_name: ${{ matrix.port }}-${{ matrix.board }}-${{ matrix.example }}
+ identical: true
+ api_key: ${{ secrets.MEMBROWSE_API_KEY }}
+ api_url: ${{ vars.MEMBROWSE_API_URL }}
+ verbose: INFO
+
+ - name: Upload report artifact
+ if: steps.membrowse.outcome == 'success' || steps.membrowse-identical.outcome == 'success'
+ uses: actions/upload-artifact@v5
+ with:
+ name: membrowse-report-${{ matrix.port }}-${{ matrix.board }}-${{ matrix.example }}
+ path: ${{ steps.membrowse.outputs.report_path || steps.membrowse-identical.outputs.report_path }}