mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
Bump every GitHub Action in the repository to its latest major version, addressing the upcoming Node.js 20 deprecation. Several of the old versions (checkout v4, cache v4, setup-node v4, labeler v5) use the Node 20 runtime which GitHub is deprecating. The new versions use Node 22. - actions/checkout v4/v5 to v6 - actions/upload-artifact v4 to v7 - actions/download-artifact v4 to v8 - actions/cache, cache/restore, cache/save v4 to v5 - actions/setup-node v4 to v6 - actions/setup-python v5 to v6 - actions/github-script v7/v8 to v9 - actions/labeler v5 to v6 - peter-evans/find-comment v3 to v4 - dorny/paths-filter v3 to v4 - codecov/codecov-action v4 to v6 - docker/setup-buildx-action v3 to v4 - docker/build-push-action v6 to v7 - tj-actions/changed-files v46 to v47 Signed-off-by: Ramon Roche <mrpollo@gmail.com>
97 lines
2.9 KiB
YAML
97 lines
2.9 KiB
YAML
name: Static Analysis
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- 'main'
|
|
paths-ignore:
|
|
- 'docs/**'
|
|
pull_request:
|
|
branches:
|
|
- '**'
|
|
paths-ignore:
|
|
- 'docs/**'
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
clang_tidy:
|
|
name: Clang-Tidy
|
|
runs-on: [runs-on, runner=16cpu-linux-x64, "run-id=${{ github.run_id }}", "extras=s3-cache"]
|
|
container:
|
|
image: ghcr.io/px4/px4-dev:v1.17.0-rc2
|
|
permissions:
|
|
contents: read
|
|
pull-requests: read
|
|
steps:
|
|
- uses: runs-on/action@v2
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0
|
|
fetch-tags: true
|
|
- name: Configure Git Safe Directory
|
|
run: git config --system --add safe.directory '*'
|
|
|
|
- uses: ./.github/actions/setup-ccache
|
|
id: ccache
|
|
with:
|
|
cache-key-prefix: ccache-clang-tidy
|
|
max-size: 150M
|
|
|
|
- name: Build - px4_sitl_default (Clang)
|
|
run: make -j16 px4_sitl_default-clang
|
|
|
|
- name: Run Clang-Tidy Analysis
|
|
id: clang_tidy
|
|
run: |
|
|
if [ "${{ github.event_name }}" != "pull_request" ]; then
|
|
make -j$(nproc) clang-tidy
|
|
else
|
|
python3 Tools/ci/run-clang-tidy-pr.py origin/${{ github.base_ref }}
|
|
fi
|
|
|
|
# On PRs, also produce a `pr-review` artifact for the PR Review Poster
|
|
# workflow to consume. clang-tidy-diff-18 emits a unified fixes.yml that
|
|
# the producer script translates into line-anchored review comments.
|
|
# Running this inside the same container as the build means there is no
|
|
# workspace-path rewriting and no cross-runner artifact handoff.
|
|
- name: Export clang-tidy fixes for PR review
|
|
if: always() && github.event_name == 'pull_request'
|
|
run: |
|
|
mkdir -p pr-review
|
|
git diff -U0 origin/${{ github.base_ref }}...HEAD \
|
|
| clang-tidy-diff-18.py -p1 \
|
|
-path build/px4_sitl_default-clang \
|
|
-export-fixes pr-review/fixes.yml \
|
|
-j0 || true
|
|
|
|
- name: Build pr-review artifact
|
|
if: always() && github.event_name == 'pull_request'
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
python3 Tools/ci/clang-tidy-fixes-to-review.py \
|
|
--fixes pr-review/fixes.yml \
|
|
--repo-root "$GITHUB_WORKSPACE" \
|
|
--repo "$GITHUB_REPOSITORY" \
|
|
--pr-number "${{ github.event.pull_request.number }}" \
|
|
--commit-sha "${{ github.event.pull_request.head.sha }}" \
|
|
--out-dir pr-review \
|
|
--event REQUEST_CHANGES
|
|
|
|
- name: Upload pr-review artifact
|
|
if: always() && github.event_name == 'pull_request'
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: pr-review
|
|
path: |
|
|
pr-review/manifest.json
|
|
pr-review/comments.json
|
|
retention-days: 1
|
|
|
|
- uses: ./.github/actions/save-ccache
|
|
if: always()
|
|
with:
|
|
cache-primary-key: ${{ steps.ccache.outputs.cache-primary-key }}
|