mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-19 14:52:40 +08:00
86fe5f41cd
ubuntu-latest is moving to Ubuntu 26.04, and three native jobs fail there for reasons outside the engine change under test: GCC 15 no longer pulls <cstdint> and <algorithm> into EventBus.h/.cpp, 7-Zip 26 refuses the OH SDK archive's relative symlinks, and python3.8 from the deadsnakes PPA has no candidate for the runner's amd64v3 apt index. Run those three jobs on ubuntu-24.04, where all three passed on 2026-10-28. The Android, Windows, macOS and iOS jobs are unchanged.
123 lines
4.5 KiB
YAML
123 lines
4.5 KiB
YAML
name: <Native> Linter
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- 'templates/**'
|
|
- 'native/**'
|
|
|
|
# github.head_ref is only defined on pull_request events
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.actor }}-${{ github.head_ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
# Set the job key. The key is displayed as the job name
|
|
# when a job name is not provided
|
|
super-lint:
|
|
# Name the Job
|
|
name: ClangTidy Android
|
|
# Set the type of machine to run on
|
|
if:
|
|
(! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration'))
|
|
runs-on: ubuntu-24.04
|
|
|
|
steps:
|
|
# Checks out a copy of your repository on the ubuntu-latest machine
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Python3.8
|
|
run: |
|
|
sudo add-apt-repository ppa:deadsnakes/ppa
|
|
sudo apt update
|
|
sudo apt remove python
|
|
sudo apt install python3.8
|
|
echo "python version: $(python --version)"
|
|
echo "python path: $(which python)"
|
|
|
|
- name: Install libffi7 which clang-tidy-11 depends on
|
|
run: |
|
|
echo "install libffi7"
|
|
wget http://ftp.ubuntu.com/ubuntu/ubuntu/pool/universe/libf/libffi7/libffi7_3.3-5ubuntu1_amd64.deb
|
|
sudo dpkg -i libffi7_3.3-5ubuntu1_amd64.deb
|
|
|
|
|
|
- name: Install CMake & Clang Tidy
|
|
run: |
|
|
cd .github/workflows
|
|
chmod +x ./llvm.sh
|
|
sudo ./llvm.sh 11
|
|
sudo apt update --fix-missing
|
|
sudo apt install -y cmake llvm clang-tidy-11 ninja-build
|
|
- name: Download external
|
|
run: |
|
|
EXT_VERSION=`node ./.github/workflows/get-native-external-version.js`
|
|
git clone --branch $EXT_VERSION --depth 1 https://github.com/cocos/cocos-engine-external native/external
|
|
- uses: nttld/setup-ndk@v1
|
|
id: setup-ndk
|
|
with:
|
|
ndk-version: r21e
|
|
add-to-path: false
|
|
local-cache: true
|
|
- name: Get changed files
|
|
uses: PatriceJiang/paths-filter@master
|
|
id: listchanged
|
|
with:
|
|
list-files: shell
|
|
filters: |
|
|
source:
|
|
- added|modified: '**/*.cpp'
|
|
- added|modified: '**/*.h'
|
|
- added|modified: '**/*.hpp'
|
|
- added|modified: '**/*.m'
|
|
- added|modified: '**/*.mm'
|
|
- added|modified: '**/*.c'
|
|
- exclude: 'native/cocos/editor-support/**'
|
|
- exclude: 'native/cocos/base/etc1.*'
|
|
- exclude: 'native/cocos/base/etc2.*'
|
|
- exclude: 'native/cocos/bindings/manual/jsb_global.cpp'
|
|
- exclude: 'native/cocos/bindings/manual/jsb_dragonbones_manual.cpp'
|
|
- exclude: 'native/cocos/bindings/manual/jsb_spine_manual.cpp'
|
|
- exclude: 'native/cocos/bindings/manual/jsb_socketio.cpp'
|
|
- exclude: 'native/cocos/bindings/manual/jsb_conversions.*'
|
|
- exclude: 'native/cocos/bindings/jswrapper/v8/debugger/**'
|
|
- exclude: 'native/cocos/audio/android/audio_utils/**'
|
|
- exclude: 'native/cocos/audio/android/AudioMixer.cpp'
|
|
- exclude: 'native/cocos/audio/android/AudioResampler.cpp'
|
|
- exclude: 'native/cocos/audio/common/utils/**'
|
|
allChanges:
|
|
- added|modified|deleted: '**'
|
|
skipedDebug:
|
|
- added|modified|deleted: '**'
|
|
- exclude: 'native/cocos/editor-support/**'
|
|
|
|
- name: Generate Compile database
|
|
shell: bash
|
|
env:
|
|
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
|
|
run: |
|
|
cd native
|
|
./utils/generate_compile_commands_android.sh
|
|
ninja -C build -t targets |grep -E ".*jsb_.*auto.*" |awk -F": " '{print $1}' |xargs ninja -C build
|
|
|
|
- name: Generate clang-fix.yaml
|
|
shell: bash
|
|
if: ${{ steps.listchanged.outputs.source == 'true' }}
|
|
run: |
|
|
CPP="${{ steps.listchanged.outputs.source_files }}"
|
|
FILTERED=`node .github/workflows/filter_by_cdb.js $CPP`
|
|
if [[ "$FILTERED-xxx" == "-xxx" ]]; then
|
|
echo "no source files match"
|
|
else
|
|
clang-tidy-11 --format-style=file --export-fixes=clang-fixes.yaml $FILTERED
|
|
fi
|
|
- name: clang-tidy-action
|
|
uses: PatriceJiang/clang-tidy-action@master
|
|
if: hashFiles('clang-fixes.yaml') != ''
|
|
with:
|
|
fixesFile: clang-fixes.yaml
|
|
noFailOnIssue: false
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
error-limit: 200
|