mirror of
https://github.com/hathach/tinyusb.git
synced 2026-03-30 03:13:24 +00:00
upload metrics.json and metrics compare to release page (#3409)
* upload metrics.json and metrics compare to release page * Adjust workflow comment handling for forks
This commit is contained in:
43
.github/workflows/build.yml
vendored
43
.github/workflows/build.yml
vendored
@ -27,6 +27,8 @@ on:
|
||||
- '.github/workflows/build.yml'
|
||||
- '.github/workflows/build_util.yml'
|
||||
- '.github/workflows/ci_set_matrix.py'
|
||||
release:
|
||||
types: [ published ]
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
@ -42,7 +44,7 @@ jobs:
|
||||
hil_json: ${{ steps.set-matrix-json.outputs.hil_matrix }}
|
||||
steps:
|
||||
- name: Checkout TinyUSB
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Generate matrix json
|
||||
id: set-matrix-json
|
||||
@ -86,9 +88,12 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: write
|
||||
contents: write
|
||||
steps:
|
||||
- name: Checkout TinyUSB
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-tags: ${{ github.event_name == 'release' }}
|
||||
|
||||
- name: Download Artifacts
|
||||
uses: actions/download-artifact@v5
|
||||
@ -103,14 +108,14 @@ jobs:
|
||||
python tools/metrics.py combine -j -m -f tinyusb/src cmake-build/*/metrics.json
|
||||
|
||||
- name: Upload Metrics Artifact
|
||||
if: github.event_name == 'push'
|
||||
if: github.event_name == 'push' || github.event_name == 'release'
|
||||
uses: actions/upload-artifact@v5
|
||||
with:
|
||||
name: metrics-tinyusb
|
||||
path: metrics.json
|
||||
|
||||
- name: Download Base Branch Metrics
|
||||
if: github.event_name != 'push'
|
||||
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
|
||||
uses: dawidd6/action-download-artifact@v11
|
||||
with:
|
||||
workflow: build.yml
|
||||
@ -119,6 +124,18 @@ jobs:
|
||||
path: base-metrics
|
||||
continue-on-error: true
|
||||
|
||||
- name: Download Previous Release Asset
|
||||
if: github.event_name == 'release'
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
PREV_TAG=$(git tag --sort=-creatordate | head -n 2 | tail -n 1)
|
||||
echo "Previous Release: $PREV_TAG"
|
||||
echo "PREV_TAG=$PREV_TAG" >> $GITHUB_ENV
|
||||
|
||||
mkdir -p base-metrics
|
||||
gh release download $PREV_TAG -p metrics.json -D base-metrics || echo "No metrics.json found in $PREV_TAG release"
|
||||
|
||||
- name: Compare with Base Branch
|
||||
if: github.event_name != 'push'
|
||||
run: |
|
||||
@ -130,6 +147,16 @@ jobs:
|
||||
cp metrics.md metrics_compare.md
|
||||
fi
|
||||
|
||||
- name: Upload Release Assets
|
||||
if: github.event_name == 'release'
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
CURR_TAG=${{ github.event.release.tag_name }}
|
||||
COMPARE_FILE="metrics_compare_${CURR_TAG}-${PREV_TAG}.md"
|
||||
mv metrics_compare.md $COMPARE_FILE
|
||||
gh release upload $CURR_TAG metrics.json $COMPARE_FILE
|
||||
|
||||
- name: Save PR number
|
||||
if: github.event_name == 'pull_request'
|
||||
run: echo ${{ github.event.number }} > pr_number.txt
|
||||
@ -144,7 +171,7 @@ jobs:
|
||||
pr_number.txt
|
||||
|
||||
- name: Post Code Metrics as PR Comment
|
||||
if: github.event_name != 'push'
|
||||
if: (github.event_name == 'workflow_dispatch') || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false)
|
||||
uses: marocchino/sticky-pull-request-comment@v2
|
||||
with:
|
||||
header: code-metrics
|
||||
@ -175,7 +202,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout TinyUSB
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Setup Zephyr project
|
||||
uses: zephyrproject-rtos/action-zephyr-setup@v1
|
||||
@ -237,7 +264,7 @@ jobs:
|
||||
mkdir -p "${{ github.workspace }}"
|
||||
|
||||
- name: Checkout TinyUSB
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Download Artifacts
|
||||
uses: actions/download-artifact@v5
|
||||
@ -275,7 +302,7 @@ jobs:
|
||||
iccarm --version
|
||||
|
||||
- name: Checkout TinyUSB
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Get build boards
|
||||
run: |
|
||||
|
||||
2
.github/workflows/build_util.yml
vendored
2
.github/workflows/build_util.yml
vendored
@ -38,7 +38,7 @@ jobs:
|
||||
arg: ${{ fromJSON(inputs.build-args) }}
|
||||
steps:
|
||||
- name: Checkout TinyUSB
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Setup Toolchain
|
||||
id: setup-toolchain
|
||||
|
||||
1
.github/workflows/metrics_comment.yml
vendored
1
.github/workflows/metrics_comment.yml
vendored
@ -13,6 +13,7 @@ jobs:
|
||||
github.event.workflow_run.event == 'pull_request' &&
|
||||
github.event.workflow_run.conclusion == 'success'
|
||||
permissions:
|
||||
actions: read
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Download Artifacts
|
||||
|
||||
2
.github/workflows/pre-commit.yml
vendored
2
.github/workflows/pre-commit.yml
vendored
@ -20,7 +20,7 @@ jobs:
|
||||
ruby-version: '3.0'
|
||||
|
||||
- name: Checkout TinyUSB
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Get Dependencies
|
||||
run: |
|
||||
|
||||
8
.github/workflows/static_analysis.yml
vendored
8
.github/workflows/static_analysis.yml
vendored
@ -37,7 +37,7 @@ jobs:
|
||||
- 'metro_m4_express'
|
||||
steps:
|
||||
- name: Checkout TinyUSB
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Get Dependencies
|
||||
uses: ./.github/actions/get_deps
|
||||
@ -100,7 +100,7 @@ jobs:
|
||||
- 'raspberry_pi_pico'
|
||||
steps:
|
||||
- name: Checkout TinyUSB
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Get Dependencies
|
||||
uses: ./.github/actions/get_deps
|
||||
@ -154,7 +154,7 @@ jobs:
|
||||
- 'stm32h743eval'
|
||||
steps:
|
||||
- name: Checkout TinyUSB
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
||||
|
||||
@ -197,7 +197,7 @@ jobs:
|
||||
- 'b_g474e_dpow1'
|
||||
steps:
|
||||
- name: Checkout TinyUSB
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Get Dependencies
|
||||
uses: ./.github/actions/get_deps
|
||||
|
||||
2
.github/workflows/trigger.yml
vendored
2
.github/workflows/trigger.yml
vendored
@ -23,7 +23,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Push to tinyusb_src
|
||||
run: |
|
||||
|
||||
Reference in New Issue
Block a user