Skip to content

Commit

Permalink
ci(codeql): fix codeql builds (#2475)
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenigneArcher authored May 14, 2024
1 parent ff54ab2 commit d70a17a
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 16 deletions.
35 changes: 24 additions & 11 deletions .codeql-prebuild-cpp-Linux.sh
Original file line number Diff line number Diff line change
@@ -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 \
Expand Down Expand Up @@ -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
Expand All @@ -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"
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'
Expand Down

0 comments on commit d70a17a

Please sign in to comment.