[WIP] Work in progress #1690
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: Static Analysis | |
on: | |
push: | |
pull_request: | |
types: [opened] | |
jobs: | |
clang-tidy: | |
name: Clang Tidy | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'pull_request' && github.event.action == 'opened' && !github.event.pull_request.merged || github.event_name == 'push' }} | |
container: ubuntu:rolling | |
env: | |
DEBIAN_FRONTEND: "noninteractive" | |
INEXOR_VULKAN_VERSION: "1.3.216.0" | |
INEXOR_VULKAN_SDK_PATH: "$GITHUB_WORKSPACE/../vulkan_sdk/" | |
steps: | |
- name: Update environment | |
run: | | |
# Update package lists | |
apt update -qq | |
# Install tools | |
apt-get install -y \ | |
clang-tidy \ | |
cmake \ | |
curl \ | |
git \ | |
libgl1-mesa-dev \ | |
libx11-dev \ | |
libx11-xcb-dev \ | |
libxcb-dri3-dev \ | |
libxcb-icccm4-dev \ | |
libxcb-image0-dev \ | |
libxcb-keysyms1-dev \ | |
libxcb-randr0-dev \ | |
libxcb-render-util0-dev \ | |
libxcb-render0-dev \ | |
libxcb-shape0-dev \ | |
libxcb-sync-dev \ | |
libxcb-util-dev \ | |
libxcb-xfixes0-dev \ | |
libxcb-xinerama0-dev \ | |
libxcb-xkb-dev \ | |
ninja-build \ | |
parallel \ | |
pkg-config \ | |
python3 \ | |
python3-pip \ | |
xkb-data \ | |
xorg-dev | |
pip3 install --break-system-packages wheel setuptools | |
- name: Install Vulkan SDK | |
run: | | |
# Download Vulkan SDK | |
curl -LS -o vulkansdk.tar.gz \ | |
https://sdk.lunarg.com/sdk/download/${{ env.INEXOR_VULKAN_VERSION }}/linux/vulkansdk-linux-x86_64-${{ env.INEXOR_VULKAN_VERSION }}.tar.gz | |
# Create Vulkan SDK directory and extract | |
mkdir "${{ env.INEXOR_VULKAN_SDK_PATH }}" | |
tar xfz vulkansdk.tar.gz -C "${{ env.INEXOR_VULKAN_SDK_PATH }}" | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Configure CMake | |
run: | | |
export CC=gcc | |
export CXX=g++ | |
export VULKAN_SDK="${{ env.INEXOR_VULKAN_SDK_PATH }}/${{ env.INEXOR_VULKAN_VERSION}}/x86_64" | |
export PATH=$VULKAN_SDK/bin:$PATH | |
cmake . -Bbuild -DCMAKE_BUILD_TYPE=Debug -GNinja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON | |
- name: Run clang-tidy | |
run: | | |
find example src include -path '*/_deps/*' -prune -o \ | |
-name '*.cpp' -o -name '*.hpp' \ | |
-print0 | | |
parallel -0 \ | |
clang-tidy -p build --quiet {} 2>/dev/null | | |
tee output | |
if [ -s output ]; then exit 1; fi |