mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
119 lines
3.6 KiB
YAML
119 lines
3.6 KiB
YAML
name: FLASH usage analysis
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- 'main'
|
|
pull_request:
|
|
branches:
|
|
- '*'
|
|
|
|
jobs:
|
|
analyze_flash:
|
|
name: Analyzing ${{ matrix.target }}
|
|
runs-on: [runs-on,runner=8cpu-linux-x64,image=ubuntu24-full-x64,"run-id=${{ github.run_id }}",spot=false]
|
|
container:
|
|
image: px4io/px4-dev-nuttx-focal
|
|
strategy:
|
|
matrix:
|
|
target: [px4_fmu-v5x, px4_fmu-v6x]
|
|
outputs:
|
|
px4_fmu-v5x: ${{ steps.gen-output.outputs.output_px4_fmu-v5x }}
|
|
px4_fmu-v6x: ${{ steps.gen-output.outputs.output_px4_fmu-v6x }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
submodules: recursive
|
|
|
|
- name: Git ownership workaround
|
|
run: git config --system --add safe.directory '*'
|
|
|
|
- name: Build Target
|
|
run: make ${{ matrix.target }}
|
|
|
|
- name: Store the ELF with the change
|
|
run: cp ./build/${{ matrix.target }}_default/${{ matrix.target }}_default.elf ./with-change.elf
|
|
|
|
- name: Clean previous build
|
|
run: |
|
|
make clean
|
|
make distclean
|
|
|
|
- name: If it's a PR checkout the base commit
|
|
if: ${{ github.event.pull_request }}
|
|
run: git checkout ${{ github.event.pull_request.base.sha }}
|
|
|
|
- name: If it's a push checkout the previous commit
|
|
if: github.event_name == 'push'
|
|
run: git checkout ${{ github.event.before }}
|
|
|
|
- name: Update submodules
|
|
run: make submodulesupdate
|
|
|
|
- name: Build
|
|
run: make ${{ matrix.target }}
|
|
|
|
- name: Store the ELF before the change
|
|
run: cp ./build/${{ matrix.target }}_default/${{ matrix.target }}_default.elf ./before-change.elf
|
|
|
|
- name: bloaty-action
|
|
uses: carlosperate/bloaty-action@v1.1.0
|
|
id: bloaty-step
|
|
with:
|
|
bloaty-args: -d sections,compileunits -n 0 ./with-change.elf -- ./before-change.elf
|
|
output-to-summary: true
|
|
|
|
- name: Generate output
|
|
id: gen-output
|
|
run: |
|
|
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
|
|
echo "output_${{ matrix.target }}<<$EOF" >> $GITHUB_OUTPUT
|
|
echo "${{ steps.bloaty-step.outputs.bloaty-output-encoded }}" >> $GITHUB_OUTPUT
|
|
echo "$EOF" >> $GITHUB_OUTPUT
|
|
|
|
post_pr_comment:
|
|
name: Publish Results
|
|
runs-on: [runs-on,runner=1cpu-linux-x64,image=ubuntu24-full-x64,"run-id=${{ github.run_id }}",spot=false]
|
|
needs: [analyze_flash]
|
|
if: ${{ github.event.pull_request }}
|
|
steps:
|
|
- name: Find Comment
|
|
uses: peter-evans/find-comment@v3
|
|
id: fc
|
|
with:
|
|
issue-number: ${{ github.event.pull_request.number }}
|
|
comment-author: 'github-actions[bot]'
|
|
body-includes: FLASH Analysis
|
|
|
|
- name: Set Build Time
|
|
id: bt
|
|
run: |
|
|
echo "timestamp=$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_OUTPUT
|
|
|
|
- name: Create or update comment
|
|
uses: peter-evans/create-or-update-comment@v4
|
|
with:
|
|
comment-id: ${{ steps.fc.outputs.comment-id }}
|
|
issue-number: ${{ github.event.pull_request.number }}
|
|
body: |
|
|
## FLASH Analysis
|
|
<details>
|
|
<summary>px4_fmu-v5x</summary>
|
|
|
|
```
|
|
${{ needs.analyze_flash.outputs.px4_fmu-v5x }}
|
|
```
|
|
</details>
|
|
|
|
<details>
|
|
<summary>px4_fmu-v6x</summary>
|
|
|
|
```
|
|
${{ needs.analyze_flash.outputs.px4_fmu-v6x }}
|
|
```
|
|
</details>
|
|
|
|
**Updated: _${{ steps.bt.outputs.timestamp }}_**
|
|
edit-mode: replace
|