summaryrefslogtreecommitdiff
path: root/.github/workflows
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2025-12-04 09:03:37 +0700
committerGitHub <[email protected]>2025-12-04 09:03:37 +0700
commitf68e354729c9485918966d2818fe652c033e4a93 (patch)
tree0b9332d09e888ae0313e52b23268addea6b45e71 /.github/workflows
parent7ee288bc223db393d68c7bdb09bf7c05ffd2eb03 (diff)
parent1b6f2b90a45e172a2eb45b3dea2fa2d11382c2b0 (diff)
Merge pull request #3384 from hathach/pr-size-diff
Size metrics
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/build.yml69
-rw-r--r--.github/workflows/build_util.yml15
-rwxr-xr-x.github/workflows/ci_set_matrix.py24
3 files changed, 84 insertions, 24 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index f1b134b8a..77f2d573f 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -57,11 +57,10 @@ jobs:
echo "hil_matrix=$HIL_MATRIX_JSON" >> $GITHUB_OUTPUT
# ---------------------------------------
- # Build CMake: only build on push with one-per-family.
+ # Build CMake: only one-per-family.
# Full built is done by CircleCI in PR
# ---------------------------------------
cmake:
- if: github.event_name == 'push'
needs: set-matrix
uses: ./.github/workflows/build_util.yml
strategy:
@@ -79,6 +78,65 @@ jobs:
toolchain: ${{ matrix.toolchain }}
build-args: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain]) }}
one-per-family: true
+ upload-metrics: true
+
+ code-metrics:
+ needs: cmake
+ runs-on: ubuntu-latest
+ permissions:
+ pull-requests: write
+ steps:
+ - name: Checkout TinyUSB
+ uses: actions/checkout@v4
+
+ - name: Download Artifacts
+ uses: actions/download-artifact@v5
+ with:
+ pattern: metrics-*
+ path: cmake-build
+ merge-multiple: true
+
+ - name: Aggregate Code Metrics
+ run: |
+ python tools/get_deps.py
+ pip install tools/linkermap/
+ python tools/metrics.py combine -j -m -f tinyusb/src cmake-build/*/metrics.json
+
+ - name: Upload Metrics Artifact
+ if: github.event_name == 'push'
+ uses: actions/upload-artifact@v5
+ with:
+ name: metrics-tinyusb
+ path: metrics.json
+
+ - name: Download Base Branch Metrics
+ if: github.event_name == 'pull_request'
+ uses: dawidd6/action-download-artifact@v11
+ with:
+ workflow: build.yml
+ branch: ${{ github.base_ref }}
+ name: metrics-tinyusb
+ path: base-metrics
+ continue-on-error: true
+
+ - name: Compare with Base Branch
+ if: github.event_name == 'pull_request'
+ run: |
+ if [ -f base-metrics/metrics.json ]; then
+ python tools/metrics.py compare -f tinyusb/src base-metrics/metrics.json metrics.json
+ cat metrics_compare.md
+ else
+ echo "No base metrics found, skipping comparison"
+ cp metrics.md metrics_compare.md
+ fi
+
+ - name: Post Code Metrics as PR Comment
+ if: github.event_name == 'pull_request'
+ uses: marocchino/sticky-pull-request-comment@v2
+ with:
+ header: code-metrics
+ path: metrics_compare.md
+
# ---------------------------------------
# Build Make: only build on push with one-per-family
@@ -134,7 +192,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- os: [windows-latest, macos-latest]
+ os: [ windows-latest, macos-latest ]
build-system: [ 'make', 'cmake' ]
with:
os: ${{ matrix.os }}
@@ -196,7 +254,7 @@ jobs:
github.repository_owner == 'hathach' &&
(github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch')
needs: hil-build
- runs-on: [self-hosted, X64, hathach, hardware-in-the-loop]
+ runs-on: [ self-hosted, X64, hathach, hardware-in-the-loop ]
steps:
- name: Get Skip Boards from previous run
if: github.run_attempt != '1'
@@ -221,6 +279,7 @@ jobs:
- name: Download Artifacts
uses: actions/download-artifact@v5
with:
+ pattern: binaries-*
path: cmake-build
merge-multiple: true
@@ -238,7 +297,7 @@ jobs:
github.repository_owner == 'hathach' &&
github.event.pull_request.head.repo.fork == false &&
(github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch')
- runs-on: [self-hosted, Linux, X64, hifiphile]
+ runs-on: [ self-hosted, Linux, X64, hifiphile ]
env:
IAR_LMS_BEARER_TOKEN: ${{ secrets.IAR_LMS_BEARER_TOKEN }}
steps:
diff --git a/.github/workflows/build_util.yml b/.github/workflows/build_util.yml
index 55901b838..36043a1d5 100644
--- a/.github/workflows/build_util.yml
+++ b/.github/workflows/build_util.yml
@@ -20,6 +20,10 @@ on:
required: false
default: false
type: boolean
+ upload-metrics:
+ required: false
+ default: false
+ type: boolean
os:
required: false
type: string
@@ -69,11 +73,18 @@ jobs:
fi
shell: bash
+ - name: Upload Artifacts for Metrics
+ if: ${{ inputs.upload-metrics }}
+ uses: actions/upload-artifact@v5
+ with:
+ name: metrics-${{ matrix.arg }}
+ path: cmake-build/cmake-build-*/metrics.json
+
- name: Upload Artifacts for Hardware Testing
if: ${{ inputs.upload-artifacts }}
- uses: actions/upload-artifact@v4
+ uses: actions/upload-artifact@v5
with:
- name: ${{ matrix.arg }}
+ name: binaries-${{ matrix.arg }}
path: |
cmake-build/cmake-build-*/*/*/*.elf
cmake-build/cmake-build-*/*/*/*.bin
diff --git a/.github/workflows/ci_set_matrix.py b/.github/workflows/ci_set_matrix.py
index 9d0e42c2e..933a8375f 100755
--- a/.github/workflows/ci_set_matrix.py
+++ b/.github/workflows/ci_set_matrix.py
@@ -15,39 +15,29 @@ toolchain_list = [
# family: [supported toolchain]
family_list = {
- "at32f402_405 at32f403a_407 at32f413 at32f415 at32f423 at32f425 at32f435_437": ["arm-gcc"],
- "broadcom_32bit": ["arm-gcc"],
+ "at32f402_405 at32f403a_407 at32f413 at32f415 at32f423 at32f425 at32f435_437 broadcom_32bit da1469x": ["arm-gcc"],
"broadcom_64bit": ["aarch64-gcc"],
"ch32v10x ch32v20x ch32v30x fomu gd32vf103": ["riscv-gcc"],
- "da1469x": ["arm-gcc"],
"imxrt": ["arm-gcc", "arm-clang"],
"kinetis_k kinetis_kl kinetis_k32l2": ["arm-gcc", "arm-clang"],
- "lpc11 lpc13 lpc15": ["arm-gcc", "arm-clang"],
- "lpc17 lpc18 lpc40 lpc43": ["arm-gcc", "arm-clang"],
+ "lpc11 lpc13 lpc15 lpc17 lpc18 lpc40 lpc43": ["arm-gcc", "arm-clang"],
"lpc51 lpc54 lpc55": ["arm-gcc", "arm-clang"],
- "maxim": ["arm-gcc"],
- "mcx": ["arm-gcc"],
- "mm32": ["arm-gcc"],
+ "maxim mcx mm32 msp432e4 tm4c": ["arm-gcc"],
"msp430": ["msp430-gcc"],
- "msp432e4 tm4c": ["arm-gcc"],
"nrf": ["arm-gcc", "arm-clang"],
- "nuc100_120 nuc121_125 nuc126 nuc505": ["arm-gcc"],
+ "nuc100_120 nuc121_125 nuc126 nuc505 xmc4000": ["arm-gcc"],
"ra": ["arm-gcc"],
"rp2040": ["arm-gcc"],
"rx": ["rx-gcc"],
- "samd11 samd2x_l2x": ["arm-gcc", "arm-clang"],
- "samd5x_e5x samg": ["arm-gcc", "arm-clang"],
+ "samd11 samd2x_l2x samd5x_e5x samg": ["arm-gcc", "arm-clang"],
"stm32c0 stm32f0 stm32f1 stm32f2 stm32f3": ["arm-gcc", "arm-clang", "arm-iar"],
"stm32f4": ["arm-gcc", "arm-clang", "arm-iar"],
"stm32f7": ["arm-gcc", "arm-clang", "arm-iar"],
"stm32g0 stm32g4 stm32h5": ["arm-gcc", "arm-clang", "arm-iar"],
"stm32h7": ["arm-gcc", "arm-clang", "arm-iar"],
- "stm32h7rs": ["arm-gcc", "arm-clang", "arm-iar"],
- "stm32l0 stm32l4": ["arm-gcc", "arm-clang", "arm-iar"],
+ "stm32h7rs stm32l0 stm32l4": ["arm-gcc", "arm-clang", "arm-iar"],
"stm32n6": ["arm-gcc"],
- "stm32u0 stm32u5 stm32wb": ["arm-gcc", "arm-clang", "arm-iar"],
- "stm32wba": ["arm-gcc", "arm-clang"],
- "xmc4000": ["arm-gcc"],
+ "stm32u0 stm32u5 stm32wb stm32wba": ["arm-gcc", "arm-clang", "arm-iar"],
"-bespressif_s2_devkitc": ["esp-idf"],
# S3, P4 will be built by hil test
# "-bespressif_s3_devkitm": ["esp-idf"],