diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index c5a432d80b..fe63c43d9f 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -26,6 +26,19 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Setup vcpkg caching + uses: actions/github-script@v7 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite') + + - name: Install vcpkg + run: | + git clone https://github.com/microsoft/vcpkg + ./vcpkg/bootstrap-vcpkg.sh -disableMetrics + - name: Install dependencies run: | echo "::group::Update apt" @@ -44,13 +57,28 @@ jobs: libsdl2-dev \ zlib1g-dev \ # EOF + + echo "::group::Install vcpkg dependencies" + + # Disable vcpkg integration, as we mostly use system libraries. + mv vcpkg.json vcpkg-disabled.json + + # We only use breakpad from vcpkg, as its CMake files + # are a bit special. So the Ubuntu's variant doesn't work. + ./vcpkg/vcpkg install breakpad + echo "::endgroup::" env: DEBIAN_FRONTEND: noninteractive - - name: Set number of make jobs + - name: Prepare build run: | - echo "MAKEFLAGS=-j$(nproc)" >> $GITHUB_ENV + mkdir build + cd build + + echo "::group::CMake" + cmake .. -DCMAKE_TOOLCHAIN_FILE=${GITHUB_WORKSPACE}/vcpkg/scripts/buildsystems/vcpkg.cmake + echo "::endgroup::" - name: Initialize CodeQL uses: github/codeql-action/init@v3 @@ -58,8 +86,14 @@ jobs: languages: cpp config-file: ./.github/codeql/codeql-config.yml - - name: Autobuild - uses: github/codeql-action/autobuild@v3 + - name: Build + run: | + cd build + + echo "::group::Build" + echo "Running on $(nproc) cores" + cmake --build . -j $(nproc) + echo "::endgroup::" - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v3