Fix clang-tidy warnings to make it actually useful #2987
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: cesium-native | |
on: [push, pull_request] | |
jobs: | |
QuickChecks: | |
name: "Quick Checks" | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Check source formatting | |
run: | | |
npm install | |
npm run format -- --dry-run -Werror | |
Linting: | |
name: "Linting" | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Install latest ninja and cmake | |
uses: lukka/get-cmake@latest | |
- name: ccache | |
uses: hendrikmuhs/ccache-action@v1.2.9 | |
with: | |
key: ccache-ubuntu-24.04-clang-clang-tidy | |
- name: Install latest clang and clang-tidy | |
run: | | |
wget https://apt.llvm.org/llvm.sh | |
chmod +x llvm.sh | |
sudo ./llvm.sh 19 | |
sudo apt-get install clang-tidy-19 | |
- name: Cache vcpkg artifacts | |
uses: actions/cache@v4 | |
with: | |
path: ~/.ezvcpkg | |
key: vcpkg-ubuntu-24.04-clang-${{ hashFiles('CMakeLists.txt') }} | |
restore-keys: | | |
vcpkg-ubuntu-24.04-clang-${{ hashFiles('CMakeLists.txt') }} | |
vcpkg-ubuntu-24.04-clang | |
- name: Set CC and CXX | |
run: | | |
echo "CC=/usr/bin/clang-19" >> "$GITHUB_ENV" | |
echo "CXX=/usr/bin/clang++-19" >> "$GITHUB_ENV" | |
- name: Make more swap space available | |
run: | | |
sudo swapoff -a | |
sudo fallocate -l 10G /mnt/swapfile | |
sudo chmod 600 /mnt/swapfile | |
sudo mkswap /mnt/swapfile | |
sudo swapon /mnt/swapfile | |
sudo swapon --show | |
- name: Run clang-tidy | |
run: | | |
echo `$CC --version | head -n 1`, `cmake --version | head -n 1` | |
cmake -B build -S . -DCMAKE_BUILD_TYPE=Debug | |
cmake --build build --target clang-tidy > output.log | |
- name: List clang-tidy warnings & errors | |
run: | | |
sed -n '/\(error\|warning\):/,/^$/p' output.log | |
Documentation: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Install Doxygen | |
run: | | |
cd ~ | |
wget https://github.com/doxygen/doxygen/releases/download/Release_1_12_0/doxygen-1.12.0.linux.bin.tar.gz | |
tar xzf doxygen-1.12.0.linux.bin.tar.gz | |
export PATH=$PWD/doxygen-1.12.0/bin:$PATH | |
echo "PATH=$PATH" >> "$GITHUB_ENV" | |
doxygen --version | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: ccache | |
uses: hendrikmuhs/ccache-action@v1.2.9 | |
with: | |
key: ccache-ubuntu-22.04-doxygen | |
- name: Cache vcpkg artifacts | |
uses: actions/cache@v4 | |
with: | |
path: ~/.ezvcpkg | |
key: vcpkg-ubuntu-22.04-doxygen-${{ hashFiles('CMakeLists.txt') }} | |
restore-keys: | | |
vcpkg-ubuntu-22.04-doxygen-${{ hashFiles('CMakeLists.txt') }} | |
vcpkg-ubuntu-22.04-doxygen | |
- name: Generate Documentation | |
run: | | |
npm install | |
cmake -B build -S . | |
cmake --build build --target cesium-native-docs | |
- name: Publish Documentation Artifact | |
if: ${{ success() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ReferenceDocumentation | |
path: build/doc/html | |
WindowsBuild: | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: [windows-2022] | |
build_type: [Debug, RelWithDebInfo] | |
name: "${{matrix.platform}} / ${{matrix.build_type}}" | |
env: | |
CACHE_KEY: "${{ matrix.platform }}" | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- name: Install ninja | |
uses: seanmiddleditch/gha-setup-ninja@master | |
- name: Install nasm | |
uses: ilammy/setup-nasm@v1 | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup MSVC for command-line builds | |
uses: ilammy/msvc-dev-cmd@v1 | |
- name: sccache | |
uses: hendrikmuhs/ccache-action@v1.2.9 | |
with: | |
key: ccache-${{ env.CACHE_KEY}}-${{matrix.build_type}}-1 | |
variant: sccache | |
- name: Cache vcpkg artifacts | |
uses: actions/cache@v4 | |
with: | |
path: /.ezvcpkg | |
key: vcpkg-${{ env.CACHE_KEY }}-${{ hashFiles('CMakeLists.txt') }}-1 | |
- name: Compile ${{matrix.build_type}} Configuration | |
run: | | |
cmake -B build -S . -G Ninja -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_C_COMPILER_LAUNCHER=C:\\Users\\runneradmin\\.cargo\\bin\\sccache -DCMAKE_CXX_COMPILER_LAUNCHER=C:\\Users\\runneradmin\\.cargo\\bin\\sccache | |
cmake --build build | |
- name: Test ${{matrix.build_type}} Configuration | |
run: | | |
cd build | |
ctest -V | |
PosixBuild: | |
strategy: | |
fail-fast: false | |
matrix: | |
compiler: [ gcc, clang ] | |
platform: [ ubuntu-22.04, ubuntu-20.04, macos-15 ] | |
build_type: [Debug, RelWithDebInfo] | |
exclude: | |
- compiler: clang | |
platform: ubuntu-22.04 | |
- compiler: gcc | |
platform: macos-15 | |
- compiler: gcc | |
platform: ubuntu-20.04 | |
name: "${{matrix.platform}} / ${{matrix.compiler}} / ${{matrix.build_type}}" | |
env: | |
CACHE_KEY: "${{ matrix.platform }}-${{matrix.compiler}}" | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- name: Install ninja | |
uses: seanmiddleditch/gha-setup-ninja@master | |
- name: Install nasm | |
uses: ilammy/setup-nasm@v1 | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: ccache | |
uses: hendrikmuhs/ccache-action@v1.2.9 | |
with: | |
key: ccache-${{ env.CACHE_KEY}}-${{matrix.build_type}} | |
- name: Cache vcpkg artifacts | |
uses: actions/cache@v4 | |
with: | |
path: ~/.ezvcpkg | |
key: vcpkg-${{ env.CACHE_KEY }}-${{ hashFiles('CMakeLists.txt') }} | |
restore-keys: | | |
vcpkg-${{ env.CACHE_KEY }}-${{ hashFiles('CMakeLists.txt') }} | |
vcpkg-${{ env.CACHE_KEY }} | |
- name: Set CC and CXX | |
if: ${{ matrix.compiler == 'clang' && matrix.platform != 'macos-15'}} | |
run: | | |
echo "CC=clang-12" >> "$GITHUB_ENV" | |
echo "CXX=clang++-12" >> "$GITHUB_ENV" | |
- name: Make more swap space available | |
if: ${{ matrix.platform != 'macos-15'}} | |
run: | | |
sudo swapoff -a | |
sudo fallocate -l 10G /mnt/swapfile | |
sudo chmod 600 /mnt/swapfile | |
sudo mkswap /mnt/swapfile | |
sudo swapon /mnt/swapfile | |
sudo swapon --show | |
- name: Set macOS cmake options | |
if: ${{ matrix.platform == 'macos-15' }} | |
run: | | |
echo "EXTRA_CMAKE_OPTIONS=-DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_SYSTEM_NAME=Darwin -DCMAKE_SYSTEM_PROCESSOR=x86_64" >> "$GITHUB_ENV" | |
- name: Compile ${{matrix.build_type}} Configuration | |
run: | | |
cmake -B build -S . -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} $EXTRA_CMAKE_OPTIONS | |
cmake --build build --parallel | |
- name: Test ${{matrix.build_type}} Configuration | |
run: | | |
cd build | |
ctest -V |