-
Notifications
You must be signed in to change notification settings - Fork 38
200 lines (161 loc) · 5.85 KB
/
linux.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
name: 'Linux'
on:
push:
branches:
- '*'
pull_request:
types: [ opened, synchronize ]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
Build:
strategy:
fail-fast: false
matrix:
include:
- BuildType: Release
Platform: x64
Backend: GLFW
CC: gcc
CXX: g++
- BuildType: Release
Platform: x64
Backend: GLFW
CC: clang
CXX: clang++
- BuildType: Release
Platform: x64
Backend: SDL2
CC: gcc
CXX: g++
- BuildType: Release
Platform: x64
Backend: SDL2
CC: clang
CXX: clang++
runs-on: 'ubuntu-latest'
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 'Create Build Environment'
run: |
sudo apt-get update -y
sudo apt-get install -y cmake curl g++ libgl1-mesa-dev libopenmpt-dev rpm
- if: matrix.CC == 'clang'
name: 'Configure Clang Compiler'
uses: egor-tensin/setup-clang@v1
with:
version: 15
- name: 'Configure CMake'
run: |
export CC=${{ matrix.CC }}
export CXX=${{ matrix.CXX }}
rm -f ./Content/Translations/*.po
cmake -B ./_build/ -D CMAKE_BUILD_TYPE=${{ matrix.BuildType }} -D NCINE_STRIP_BINARIES=ON -D NCINE_PREFERRED_BACKEND=${{ matrix.Backend }} -D NCINE_ASSEMBLE_DEB=ON -D NCINE_ASSEMBLE_RPM=ON -D NCINE_WITH_GLEW=OFF
- name: 'Build'
run: |
make -j $(nproc) -C ./_build/
- name: 'Create Package'
run: |
make package -C ./_build/
mkdir ./_package/
cp -f ./_build/jazz2 ./_package/jazz2
cp -f ./_build/*.deb ./_package/jazz2.deb
cp -f ./_build/*.rpm ./_package/jazz2.rpm
cp -f -r ./Content/ ./_package/Content/
cp -f ./LICENSE ./_package/LICENSE
case "${{ matrix.CC }}" in
gcc ) artifactPath="Jazz2_Linux_${{ matrix.Platform }}_${{ matrix.Backend }}" ;;
clang ) artifactPath="Jazz2_Linux_${{ matrix.Platform }}_${{ matrix.Backend }}_Clang" ;;
* ) artifactPath="Jazz2_Linux_${{ matrix.Platform }}_${{ matrix.Backend }}_${{ matrix.CC }}" ;;
esac
echo "artifactPath=$artifactPath" >> $GITHUB_ENV
- name: 'Upload Package'
uses: actions/upload-artifact@v4
with:
name: ${{ env.artifactPath }}
path: ./_package/
Build-AppImage:
strategy:
fail-fast: false
matrix:
include:
- BuildType: Release
Platform: x64
Backend: GLFW
CC: gcc
CXX: g++
- BuildType: Release
Platform: x64
Backend: SDL2
CC: gcc
CXX: g++
runs-on: 'ubuntu-latest'
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 'Create Build Environment'
run: |
sudo apt-get update -y
sudo apt-get install -y cmake curl g++ libgl1-mesa-dev libglew2.2 libglfw3 libsdl2-2.0-0 libopenal1 libvorbisfile3 libopenmpt-dev fuse
- name: 'Configure CMake'
run: |
export CC=${{ matrix.CC }}
export CXX=${{ matrix.CXX }}
rm -f ./Content/Translations/*.po
cmake -B ./_build/ -D CMAKE_BUILD_TYPE=${{ matrix.BuildType }} -D NCINE_STRIP_BINARIES=ON -D NCINE_PREFERRED_BACKEND=${{ matrix.Backend }} -D NCINE_WITH_GLEW=OFF -D NCINE_LINUX_PACKAGE=jazz2 -D NCINE_PACKAGED_CONTENT_PATH=ON -D CMAKE_INSTALL_PREFIX=/usr
- name: 'Build'
run: |
DESTDIR=../_appdir/ make install -j $(nproc) -C ./_build/
- name: 'Create AppImage'
run: |
if [ ! -f linuxdeploy-x86_64.AppImage ]; then
curl -s -S -O --location 'https://github.com/darealshinji/linuxdeploy-plugin-checkrt/releases/download/continuous/linuxdeploy-plugin-checkrt.sh'
curl -s -S -O --location 'https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage'
chmod a+x linuxdeploy-x86_64.AppImage linuxdeploy-plugin-checkrt.sh
fi
mv -f ./_appdir/usr/share/jazz2/Content/ ./_appdir/usr/bin/Content/
rm -f -r ./_appdir/usr/share/jazz2/
rm -f -r ./_appdir/usr/share/doc/
LDAI_OUTPUT="./_build/jazz2.AppImage" ARCH=x86_64 ./linuxdeploy-x86_64.AppImage --appdir=./_appdir/ --icon-filename=jazz2 --desktop-file=./_appdir/usr/share/applications/jazz2.desktop --executable=./_appdir/usr/bin/jazz2 --custom-apprun=./Sources/AppRun --output=appimage --plugin checkrt
artifactPath="Jazz2_${{ matrix.Platform }}_${{ matrix.Backend }}.AppImage"
echo "artifactPath=$artifactPath" >> $GITHUB_ENV
- name: 'Upload Package'
uses: actions/upload-artifact@v4
with:
name: ${{ env.artifactPath }}
path: ./_build/jazz2.AppImage
CodeQL:
name: 'CodeQL Analyze'
strategy:
fail-fast: false
runs-on: 'ubuntu-latest'
permissions:
security-events: write
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 'Initialize CodeQL'
uses: github/codeql-action/init@v3
with:
languages: cpp
- name: 'Create Build Environment'
run: |
sudo apt-get update -y
sudo apt-get install -y cmake curl g++ libgl1-mesa-dev libopenmpt-dev
- name: 'Configure CMake and Build'
run: |
export CC=gcc
export CXX=g++
cmake -B ./_build/ -D CMAKE_BUILD_TYPE=Release -D NCINE_WITH_GLEW=OFF
make -j $(nproc) -C ./_build/
- name: 'Perform CodeQL Analysis'
uses: github/codeql-action/analyze@v3