OnDemand Clang Tidy #677
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: OnDemand Clang Tidy | |
on: | |
workflow_dispatch: | |
inputs: | |
logLevel: | |
description: 'Log level' | |
required: true | |
default: 'warning' | |
type: choice | |
options: | |
- info | |
- warning | |
- debug | |
tags: | |
description: 'Test scenario tags' | |
required: false | |
type: boolean | |
schedule: | |
- cron: '0 16 * * *' | |
env: | |
CACHE_EPOCH: 131-1 | |
GOPROXY: direct | |
jobs: | |
win-clang-tidy: | |
runs-on: windows-2022 | |
if: ${{ github.event_name != 'release' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: [x64, x86] | |
build_type: [Release] | |
crt-linkage: [dynamic] | |
env: | |
BUILD_TYPE: '${{ matrix.build_type }}' | |
defaults: | |
run: | |
shell: cmd | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Checkout with shallow submodules | |
run: | | |
# unshallow must come first otherwise submodule may be get unshallowed | |
git fetch --tags --unshallow | |
git submodule update --init --depth 1 | |
- name: Cache toolchain, nasm, nsis and wixtoolset 3 | |
id: toolchain-cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
third_party/nasm | |
third_party/llvm-build/Release+Asserts | |
third_party/wix311 | |
third_party/nsis | |
key: ${{ runner.os }}-toolchain-nsis-${{ hashFiles('CLANG_REVISION') }}-v${{ env.CACHE_EPOCH }} | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: '>=1.20.0' | |
cache-dependency-path: | | |
tools/go.sum | |
third_party/boringssl/src/go.sum | |
- name: Build build tool | |
run: | | |
cd tools | |
go build | |
- name: "Install dependency: clang, nasm, nsis and wixtoolset 3" | |
if: ${{ steps.toolchain-cache.outputs.cache-hit != 'true' }} | |
run: | | |
scripts\download-toolchain.bat | |
- name: "Install dependency: cmake (chocolatey)" | |
run: | | |
REM choco install -y cmake.portable --version=3.29.8 | |
cmake --version | |
- name: "Install dependency: ninja (chocolatey)" | |
run: | | |
choco install -y ninja | |
ninja --version | |
- name: Build Binary | |
run: | | |
set VCToolsVersion= | |
set Winsdk=10.0.22621.0 | |
set "WindowsSDKVersion=%Winsdk%\" | |
if "${{ matrix.arch }}" == "arm64" (call :SetNewVCToolsVersion) | |
set vsdevcmd=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat | |
set "VSCMD_START_DIR=%CD%" | |
set Platform=${{ matrix.arch }} | |
call "%vsdevcmd%" -arch=%Platform% -host_arch=amd64 -winsdk=%Winsdk% -no_logo -vcvars_ver=%VCToolsVersion% | |
tools\build -clang-tidy-mode -msvc-tgt-arch=${{ matrix.arch }} -msvc-crt-linkage=${{ matrix.crt-linkage }} -build-test -build-benchmark -no-packaging || exit /b | |
exit /b 0 | |
:SetNewVCToolsVersion | |
set VCToolsVersion= | |
mingw64-clang-tidy: | |
runs-on: ubuntu-22.04 | |
if: ${{ github.event_name != 'release' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
build_type: [Release] | |
include: | |
- arch: i686 | |
variant: msvcrt | |
- arch: x86_64 | |
variant: ucrt | |
- arch: aarch64 | |
variant: ucrt | |
env: | |
BUILD_TYPE: '${{ matrix.build_type }}' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Checkout with shallow submodules | |
run: | | |
# unshallow must come first otherwise submodule may be get unshallowed | |
git fetch --tags --unshallow | |
git submodule update --init --depth 1 | |
- name: Cache toolchain | |
id: toolchain-cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
third_party/llvm-build/Release+Asserts | |
key: ${{ runner.os }}-toolchain-${{ hashFiles('CLANG_REVISION') }}-v${{ env.CACHE_EPOCH }} | |
- name: Cache mingw64 llvm sysroot | |
id: sysroot-cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
third_party/llvm-mingw-20240619-${{ matrix.variant }}-ubuntu-20.04-x86_64 | |
key: ${{ runner.os }}-mingw64-sysroot-third_party-llvm-20240619-${{ matrix.variant }}-v1 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: '>=1.20.0' | |
cache-dependency-path: | | |
tools/go.sum | |
third_party/boringssl/src/go.sum | |
- name: Build build tool | |
run: | | |
cd tools | |
go build | |
- name: "Install dependency: prebuilt clang and clang-tidy binaries" | |
if: ${{ steps.toolchain-cache.outputs.cache-hit != 'true' }} | |
run: | | |
./scripts/download-clang-prebuilt-binaries.py | |
rm -f third_party/llvm-build/Release+Asserts/*.tgz | |
- name: "Install dependency: llvm-mingw sysroot" | |
if: ${{ steps.sysroot-cache.outputs.cache-hit != 'true' }} | |
run: | | |
pushd third_party | |
curl -L -O https://github.com/mstorsjo/llvm-mingw/releases/download/20240619/llvm-mingw-20240619-${{ matrix.variant }}-ubuntu-20.04-x86_64.tar.xz | |
tar -xf llvm-mingw-20240619-${{ matrix.variant }}-ubuntu-20.04-x86_64.tar.xz | |
rm -vf llvm-mingw-*.xz | |
popd | |
- name: Change ubuntu mirror | |
run: | | |
sudo sed -i 's/azure.archive.ubuntu.com/azure.archive.ubuntu.com/g' /etc/apt/sources.list | |
sudo apt-get update -qq | |
- name: Populate depedencies | |
run: | | |
sudo apt-get update -qq | |
sudo apt-get install -y cmake ninja-build nasm zip nsis locales-all | |
- name: Populate dependencie (cmake, overwrite) | |
run: | | |
curl -L -O https://github.com/Kitware/CMake/releases/download/v3.29.8/cmake-3.29.8-linux-x86_64.tar.gz | |
sudo tar -C /usr/local --strip-components=1 -xf cmake-3.29.8-linux-x86_64.tar.gz | |
cmake --version | |
rm -f *.tar.gz | |
- name: Patch libcxx for windows xp | |
if: ${{ matrix.arch == 'i686' || matrix.arch == 'x86_64' }} | |
run: | | |
pushd third_party/libc++/trunk | |
patch -p1 < ../winxp.patch | |
popd | |
pushd third_party/libc++abi/trunk | |
patch -p1 < ../winxp.patch | |
popd | |
echo "BUILD_OPTIONS=-mingw-allow-xp -enable-lto=false" >> $GITHUB_ENV | |
- name: Build Binary | |
run: | | |
# fix cpack error on C.UTF-8 locale | |
# see https://github.com/lightspark/lightspark/discussions/604#discussioncomment-1034262 | |
export LC_ALL=en_US.UTF-8 | |
./tools/build --variant gui --arch ${{ matrix.arch }} --system mingw \ | |
-build-test -build-benchmark -clang-tidy-mode \ | |
-mingw-dir $PWD/third_party/llvm-mingw-20240619-${{ matrix.variant }}-ubuntu-20.04-x86_64 \ | |
${{ env.BUILD_OPTIONS }} | |
linux-clang-tidy: | |
runs-on: ubuntu-20.04 | |
if: ${{ github.event_name != 'release' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
build_type: [Release] | |
env: | |
BUILD_TYPE: '${{ matrix.build_type }}' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Checkout with shallow submodules | |
run: | | |
# unshallow must come first otherwise submodule may be get unshallowed | |
git fetch --tags --unshallow | |
git submodule update --init --depth 1 | |
- name: Cache toolchain | |
id: toolchain-cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
third_party/llvm-build/Release+Asserts | |
key: ${{ runner.os }}-toolchain-${{ hashFiles('CLANG_REVISION') }}-v${{ env.CACHE_EPOCH }} | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: '>=1.20.0' | |
cache-dependency-path: | | |
tools/go.sum | |
third_party/boringssl/src/go.sum | |
- name: Build build tool | |
run: | | |
cd tools | |
go build | |
- name: "Install dependency: prebuilt clang and clang-tidy binaries" | |
if: ${{ steps.toolchain-cache.outputs.cache-hit != 'true' }} | |
run: | | |
./scripts/download-clang-prebuilt-binaries.py | |
rm -f third_party/llvm-build/Release+Asserts/*.tgz | |
- name: Change ubuntu mirror | |
run: | | |
sudo sed -i 's/azure.archive.ubuntu.com/azure.archive.ubuntu.com/g' /etc/apt/sources.list | |
sudo apt-get update -qq | |
- name: Populate depedencies | |
run: sudo apt-get update -qq && sudo apt-get install -y cmake ninja-build libgtk-3-dev gettext | |
- name: Populate dependencie (cmake, overwrite) | |
run: | | |
curl -L -O https://github.com/Kitware/CMake/releases/download/v3.29.8/cmake-3.29.8-linux-x86_64.tar.gz | |
sudo tar -C /usr/local --strip-components=1 -xf cmake-3.29.8-linux-x86_64.tar.gz | |
cmake --version | |
rm -f *.tar.gz | |
- name: Populate depedencies (test purposes) | |
run: sudo apt-get update -qq && sudo apt-get install -y libcurl4-openssl-dev | |
- name: Build Binary | |
run: | | |
./tools/build -clang-tidy-mode -build-test -build-benchmark -no-packaging | |
mac-clang-tidy: | |
runs-on: macos-15 | |
if: ${{ github.event_name != 'release' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
build_type: [Release] | |
env: | |
BUILD_TYPE: '${{ matrix.build_type }}' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Checkout with shallow submodules | |
run: | | |
# unshallow must come first otherwise submodule may be get unshallowed | |
git fetch --tags --unshallow | |
git submodule update --init --depth 1 | |
- name: Cache toolchain | |
id: toolchain-cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
third_party/llvm-build/Release+Asserts | |
key: ${{ runner.os }}-toolchain-arm64-${{ hashFiles('CLANG_REVISION') }}-v${{ env.CACHE_EPOCH }} | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: '>=1.20.0' | |
cache-dependency-path: | | |
tools/go.sum | |
third_party/boringssl/src/go.sum | |
- name: Build build tool | |
run: | | |
cd tools | |
go build | |
- name: "Install dependency: prebuilt clang and clang-tidy binaries" | |
if: ${{ steps.toolchain-cache.outputs.cache-hit != 'true' }} | |
run: | | |
./scripts/download-clang-prebuilt-binaries.py | |
rm -f third_party/llvm-build/Release+Asserts/*.tgz | |
- name: Populate depedencies | |
run: brew install ninja cmake p7zip | |
- name: Build Binary | |
run: | | |
./tools/build -clang-tidy-mode -build-test -build-benchmark -no-packaging |