mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
misc/github: Fix workflows.
This commit is contained in:
parent
27e308fadc
commit
074252dc8d
44
.github/workflows/code-size-report.yml
vendored
Normal file
44
.github/workflows/code-size-report.yml
vendored
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
name: '📝 Code Report'
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_run:
|
||||||
|
workflows: ['🔥 Firmware Build']
|
||||||
|
types:
|
||||||
|
- completed
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
post-code-report:
|
||||||
|
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: '↓ Download code size report'
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: code-size-report
|
||||||
|
run-id: ${{ github.event.workflow_run.id }}
|
||||||
|
github-token: ${{ github.token }}
|
||||||
|
|
||||||
|
- name: '📝 Check report'
|
||||||
|
id: generate_report
|
||||||
|
run: |
|
||||||
|
# Get the filename matching the pattern *.md
|
||||||
|
CODE_SIZE_REPORT=$(ls ${GITHUB_WORKSPACE}/*.md)
|
||||||
|
echo "Code Size Report: ${CODE_SIZE_REPORT}"
|
||||||
|
|
||||||
|
# Extract the PR number from the filename
|
||||||
|
# Assuming the filename format is <pr_number>.md
|
||||||
|
PR_NUMBER=$(basename "${CODE_SIZE_REPORT}" .md)
|
||||||
|
echo "Pull Request Number: $PR_NUMBER"
|
||||||
|
|
||||||
|
# If the report file is not empty set a flag for the next step.
|
||||||
|
if [ -s "${CODE_SIZE_REPORT}" ]; then
|
||||||
|
echo "pr_number=${PR_NUMBER}" >> $GITHUB_OUTPUT
|
||||||
|
echo "code_size_report=${CODE_SIZE_REPORT}" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: '📝 Post report'
|
||||||
|
if: steps.generate_report.outputs.code_size_report != ''
|
||||||
|
uses: thollander/actions-comment-pull-request@v2
|
||||||
|
with:
|
||||||
|
pr_number: ${{ steps.generate_report.outputs.pr_number }}
|
||||||
|
filePath: ${{ steps.generate_report.outputs.code_size_report }}
|
||||||
39
.github/workflows/firmware.yml
vendored
39
.github/workflows/firmware.yml
vendored
@ -28,7 +28,7 @@ jobs:
|
|||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
target: [OPENMV2, OPENMV3, OPENMV4, OPENMV4P, OPENMVPT, OPENMV_RT1060, ARDUINO_PORTENTA_H7, ARDUINO_GIGA, ARDUINO_NICLA_VISION, ARDUINO_NANO_RP2040_CONNECT, ARDUINO_NANO_33_BLE_SENSE]
|
target: [OPENMV3]
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
steps:
|
steps:
|
||||||
- name: '⏳ Checkout repository'
|
- name: '⏳ Checkout repository'
|
||||||
@ -71,11 +71,9 @@ jobs:
|
|||||||
path: ${{ matrix.target }}
|
path: ${{ matrix.target }}
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
post-stats:
|
code-size-report:
|
||||||
needs: build-firmware
|
needs: build-firmware
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
permissions:
|
|
||||||
pull-requests: write
|
|
||||||
if: github.event_name == 'pull_request'
|
if: github.event_name == 'pull_request'
|
||||||
steps:
|
steps:
|
||||||
- name: '⏳ Checkout repository'
|
- name: '⏳ Checkout repository'
|
||||||
@ -100,13 +98,13 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
pip install tabulate==0.9.0
|
pip install tabulate==0.9.0
|
||||||
|
|
||||||
- name: '🤌 Download artifacts'
|
- name: '↓ Download artifacts'
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
path: new_firmware
|
path: new_firmware
|
||||||
merge-multiple: false
|
merge-multiple: false
|
||||||
|
|
||||||
- name: '🤌 Download release'
|
- name: '↓ Download release'
|
||||||
uses: robinraju/release-downloader@v1
|
uses: robinraju/release-downloader@v1
|
||||||
with:
|
with:
|
||||||
repository: 'openmv/openmv'
|
repository: 'openmv/openmv'
|
||||||
@ -116,22 +114,21 @@ jobs:
|
|||||||
out-file-path: 'old_firmware'
|
out-file-path: 'old_firmware'
|
||||||
|
|
||||||
- name: '📝 Generate report'
|
- name: '📝 Generate report'
|
||||||
run: |
|
id: generate_report
|
||||||
TOOLCHAIN_PATH=${HOME}/cache/gcc
|
CODE_SIZE_REPORT=${{ github.event.pull_request.number }}.md
|
||||||
export PATH=${TOOLCHAIN_PATH}/bin:${PATH}
|
python tools/code_size.py > ${GITHUB_WORKSPACE}/${CODE_SIZE_REPORT}
|
||||||
python tools/gen_stats.py > ${GITHUB_WORKSPACE}/stats.txt
|
if [ -s ${GITHUB_WORKSPACE}/${CODE_SIZE_REPORT} ]; then
|
||||||
cat ${GITHUB_WORKSPACE}/stats.txt
|
echo "code_size_report=${CODE_SIZE_REPORT}" >> $GITHUB_OUTPUT
|
||||||
if [ -s ./stats.txt ]; then
|
|
||||||
echo "report=true" >> $GITHUB_ENV
|
|
||||||
else
|
|
||||||
echo "report=false" >> $GITHUB_ENV
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: '📝 Post report'
|
- name: '⬆ Upload report'
|
||||||
if: env.report == 'true'
|
if: steps.generate_report.outputs.code_size_report != ''
|
||||||
uses: thollander/actions-comment-pull-request@v2
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
filePath: ./stats.txt
|
overwrite: true
|
||||||
|
name: code-size-report
|
||||||
|
path: ${{ github.workspace }}/${{ steps.generate_report.outputs.code_size_report }}
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
stable-release:
|
stable-release:
|
||||||
needs: build-firmware
|
needs: build-firmware
|
||||||
@ -143,7 +140,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
submodules: false
|
submodules: false
|
||||||
|
|
||||||
- name: '🤌 Download artifacts'
|
- name: '↓ Download artifacts'
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
path: firmware
|
path: firmware
|
||||||
@ -187,7 +184,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
submodules: false
|
submodules: false
|
||||||
|
|
||||||
- name: '🤌 Download artifacts'
|
- name: '↓ Download artifacts'
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
path: firmware
|
path: firmware
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user