-
-
Notifications
You must be signed in to change notification settings - Fork 6
79 lines (61 loc) · 2.58 KB
/
codeql-analysis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
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-20.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=libraries-OS-COMPILER
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=nCine-BRANCH_NAME-OS-COMPILER
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