mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
github.ref_name resolves to '26367/merge' for pull_request events, causing cache misses. Use github.head_ref (PR source branch) with fallback to github.ref_name for push events. Signed-off-by: Ramon Roche <mrpollo@gmail.com>
69 lines
1.7 KiB
YAML
69 lines
1.7 KiB
YAML
name: Clang Tidy
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- 'main'
|
|
paths-ignore:
|
|
- 'docs/**'
|
|
pull_request:
|
|
branches:
|
|
- '**'
|
|
paths-ignore:
|
|
- 'docs/**'
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: [runs-on, runner=16cpu-linux-x64, "run-id=${{ github.run_id }}", "extras=s3-cache"]
|
|
container:
|
|
image: px4io/px4-dev:v1.17.0-beta1
|
|
steps:
|
|
- uses: runs-on/action@v2
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
fetch-tags: true
|
|
|
|
- name: Git ownership workaround
|
|
run: git config --system --add safe.directory '*'
|
|
|
|
- name: ccache cache restore
|
|
id: cc_restore
|
|
uses: runs-on/cache/restore@v4
|
|
with:
|
|
path: ~/.ccache
|
|
key: ccache-clang-tidy-${{ github.head_ref || github.ref_name }}
|
|
restore-keys: |
|
|
ccache-clang-tidy-${{ github.head_ref || github.ref_name }}-
|
|
ccache-clang-tidy-main-
|
|
ccache-clang-tidy-
|
|
|
|
- name: ccache config and stats
|
|
run: |
|
|
mkdir -p ~/.ccache
|
|
echo "base_dir = ${GITHUB_WORKSPACE}" > ~/.ccache/ccache.conf
|
|
echo "compression = true" >> ~/.ccache/ccache.conf
|
|
echo "compression_level = 6" >> ~/.ccache/ccache.conf
|
|
echo "max_size = 120M" >> ~/.ccache/ccache.conf
|
|
echo "hash_dir = false" >> ~/.ccache/ccache.conf
|
|
echo "compiler_check = content" >> ~/.ccache/ccache.conf
|
|
ccache -s
|
|
ccache -z
|
|
|
|
- name: Testing (clang-tidy)
|
|
run: make -j16 clang-tidy
|
|
|
|
- name: ccache post-build stats
|
|
if: always()
|
|
run: ccache -s
|
|
|
|
- name: ccache cache save
|
|
if: always()
|
|
uses: runs-on/cache/save@v4
|
|
with:
|
|
path: ~/.ccache
|
|
key: ${{ steps.cc_restore.outputs.cache-primary-key }}
|