From eaf62f3969f62b6ef4363b4534b35823b6da81f1 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Mon, 11 Mar 2024 15:42:44 +0100 Subject: [PATCH] Codechange: [CI] manual build CodeQL to improve speed (#12251) Autobuild also fetches dependencies and other things, while those are already ready on the system. This seems to cost ~1 minutes, for no actual good reason. --- .github/workflows/codeql.yml | 42 ++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) 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