From 27f4fc88768bad1a4c4e08a0f4ce341401088f2b Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Tue, 14 May 2024 19:20:37 -0400 Subject: [PATCH] ci(codeql): fix codeql builds (#2475) --- .codeql-prebuild-cpp-Linux.sh | 35 ++++++++++++++++++++++++----------- .github/workflows/CI.yml | 2 +- .github/workflows/codeql.yml | 12 ++++++++---- 3 files changed, 33 insertions(+), 16 deletions(-) diff --git a/.codeql-prebuild-cpp-Linux.sh b/.codeql-prebuild-cpp-Linux.sh index d00c671ec2c..042ae12c828 100644 --- a/.codeql-prebuild-cpp-Linux.sh +++ b/.codeql-prebuild-cpp-Linux.sh @@ -1,7 +1,23 @@ # install dependencies for C++ analysis set -e +CUDA_VERSION=11.8.0 +CUDA_BUILD=520.61.05 + +# install wget and cuda first sudo apt-get update -y +sudo apt-get install -y \ + wget + +# Install CUDA +url_base="https://developer.download.nvidia.com/compute/cuda/${CUDA_VERSION}/local_installers" +url="${url_base}/cuda_${CUDA_VERSION}_${CUDA_BUILD}_linux.run" +sudo wget -q -O /root/cuda.run ${url} +sudo chmod a+x /root/cuda.run +sudo /root/cuda.run --silent --toolkit --toolkitpath=/usr/local/cuda --no-opengl-libs --no-man-page --no-drm +sudo rm /root/cuda.run + +# Install dependencies sudo apt-get install -y \ build-essential \ gcc-10 \ @@ -32,8 +48,7 @@ sudo apt-get install -y \ libxcb1-dev \ libxfixes-dev \ libxrandr-dev \ - libxtst-dev \ - wget + libxtst-dev # clean apt cache sudo apt-get clean @@ -48,19 +63,17 @@ sudo update-alternatives --install \ --slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-10 \ --slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-10 -# Install CUDA -sudo wget \ - https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run \ - --progress=bar:force:noscroll -q --show-progress -O /root/cuda.run -sudo chmod a+x /root/cuda.run -sudo /root/cuda.run --silent --toolkit --toolkitpath=/usr --no-opengl-libs --no-man-page --no-drm -sudo rm /root/cuda.run - # build mkdir -p build cd build || exit 1 -cmake -G "Unix Makefiles" .. +cmake \ + -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc \ + -G "Unix Makefiles" \ + .. make -j"$(nproc)" +# Delete CUDA +sudo rm -rf /usr/local/cuda + # skip autobuild echo "skip_autobuild=true" >> "$GITHUB_OUTPUT" diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 401f97af97d..4ac8cb729c9 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -476,7 +476,7 @@ jobs: # permissions chmod +x ../artifacts/sunshine.AppImage - - name: Delete cuda + - name: Delete CUDA # free up space on the runner run: | sudo rm -rf /usr/local/cuda diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index ff12034f0c6..ec4ed250181 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -63,7 +63,9 @@ jobs: if (key.toLowerCase() === 'swift') { osList = ['macos-latest']; } else if (key.toLowerCase() === 'cpp') { - osList = ['macos-latest', 'ubuntu-latest', 'windows-latest']; + // TODO: update macos to latest after the below issue is resolved + // https://github.com/github/codeql-action/issues/2266 + osList = ['macos-13', 'ubuntu-latest', 'windows-latest']; } for (let os of osList) { // set name for matrix @@ -120,10 +122,12 @@ jobs: steps: - name: Maximize build space - if: runner.os == 'Linux' - uses: easimon/maximize-build-space@v8 + if: >- + runner.os == 'Linux' && + matrix.language == 'cpp' + uses: easimon/maximize-build-space@v10 with: - root-reserve-mb: 20480 + root-reserve-mb: 30720 remove-dotnet: ${{ (matrix.language == 'csharp' && 'false') || 'true' }} remove-android: 'true' remove-haskell: 'true'