Skip to content

Support two macOS GitHub Actions runner images #26

Support two macOS GitHub Actions runner images

Support two macOS GitHub Actions runner images #26

name: 'CodeQL'
env:
LIBRARIES_BRANCH: libraries-OS-COMPILER
NCINE_BRANCH: nCine-BRANCH_NAME-OS-COMPILER
NCINE_SOURCE_BRANCH: BRANCH_NAME
on: [push, workflow_dispatch]
jobs:
analyze:
name: 'Analyze'
runs-on: 'ubuntu-22.04'
strategy:
fail-fast: false
matrix:
language: [ 'cpp' ]
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v4
- name: 'Initialize CodeQL'
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
- run: |
# Download nCine-libraries, nCine Artifacts, and project data
export OS=linux
export CC=gcc
export BRANCH_NAME=$(git describe --tags --exact-match 2> /dev/null || git symbolic-ref -q --short HEAD || git rev-parse --short HEAD)
export LIBRARIES_BRANCH=`echo $LIBRARIES_BRANCH | sed 's/OS/'"$OS"'/'`
export LIBRARIES_BRANCH=`echo $LIBRARIES_BRANCH | sed 's/COMPILER/'"$CC"'/'`
cd ..
git clone https://github.com/nCine/nCine-libraries-artifacts.git
cd nCine-libraries-artifacts
git checkout $LIBRARIES_BRANCH
LIBRARIES_FILE=$(ls -t | head -n 1) && tar xpzf $LIBRARIES_FILE
mv nCine-external ..
cd ..
rm -rf nCine-libraries-artifacts
export NCINE_SOURCE_BRANCH=`echo $NCINE_SOURCE_BRANCH | sed 's/BRANCH_NAME/'"$BRANCH_NAME"'/'`
export NCINE_BRANCH=`echo $NCINE_BRANCH | sed 's/BRANCH_NAME/'"$NCINE_SOURCE_BRANCH"'/'`
export NCINE_BRANCH=`echo $NCINE_BRANCH | sed 's/OS/'"$OS"'/'`
export NCINE_BRANCH=`echo $NCINE_BRANCH | sed 's/COMPILER/'"$CC"'/'`
git clone https://github.com/nCine/nCine-artifacts.git
cd nCine-artifacts
git checkout $NCINE_BRANCH
NCINE_FILE=$(ls -t nCine-* | head -n 1)
tar xpzf $NCINE_FILE
mv "${NCINE_FILE/.tar.gz/}" ../nCine
cd ..
rm -rf nCine-artifacts
git clone https://github.com/$GITHUB_REPOSITORY-data.git
# CMake Configuration and Make
export PROJECT_NAME=${GITHUB_REPOSITORY##*/}
export NCINE_DIRECTORY=$(pwd)/nCine/lib/cmake/nCine
export BuildType=Debug
cd $PROJECT_NAME
cmake -B ../$PROJECT_NAME-build-$BuildType -D CMAKE_BUILD_TYPE=$BuildType -D nCine_DIR=$NCINE_DIRECTORY
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/../nCine-external/lib
make -j2 -C ../$PROJECT_NAME-build-$BuildType
- name: 'Perform CodeQL Analysis'
uses: github/codeql-action/analyze@v1