-
Notifications
You must be signed in to change notification settings - Fork 1
328 lines (284 loc) · 9.53 KB
/
main.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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
name: "Main"
on:
push:
branches: [ "*" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
schedule:
- cron: '0 0 * * 5'
jobs:
configure:
name: Configure
runs-on: ubuntu-22.04
outputs:
tag: ${{steps.configure.outputs.tag}}
sha: ${{steps.configure.outputs.sha}}
upload_url: ${{steps.create_release.outputs.upload_url}}
steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.12.0
with:
access_token: ${{github.token}} # needs other token https://github.com/styfle/cancel-workflow-action/issues/7
- name: Configure
id: configure
shell: bash
run: |
tag_regex='^refs/tags/'
if [[ $GITHUB_EVENT_NAME == pull-request ]]; then # pull request
sha="${{github.event.pull_request.head.sha}}"
elif [[ $GITHUB_REF =~ $tag_regex ]]; then # release
sha="$GITHUB_SHA"
tag="${GITHUB_REF/refs\/tags\//}"
echo "::set-output name=tag::$tag"
else # push to branch
sha="$GITHUB_SHA"
fi
echo "::set-output name=sha::$sha"
- name: Checkout
if: steps.configure.outputs.tag != null
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Prepare release parameters
id: prepare
if: steps.configure.outputs.tag != null
shell: bash
env:
TAG: ${{steps.configure.outputs.tag}}
run: .ci/prep_release.sh
- name: Create release
if: steps.configure.outputs.tag != null
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{github.token}}
with:
tag_name: ${{github.ref}}
release_name: ${{steps.prepare.outputs.title}}
body_path: ${{steps.prepare.outputs.body_path}}
draft: true
prerelease: ${{steps.prepare.outputs.is_beta == 'yes'}}
build-linux:
needs: configure
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
language: [ 'cpp' ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust
uses: hecrj/setup-rust-action@v2
with:
rust-version: nightly
- uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: 'pip' # caching pip dependencies
- run: pip install -r requirements.txt -r src/mtg_search_engine/requirements.txt
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{matrix.language}}
- name: Install deps
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends build-essential \
cmake gcovr qtbase5-dev qtdeclarative5-dev qttools5-dev qttools5-dev-tools \
valgrind python3 astyle qt6-l10n-tools \
libgl1-mesa-dev libjemalloc-dev libcurl4-openssl-dev \
libdwarf-dev libelf-dev libjansson-dev libabsl-dev
- name: Make Release
shell: bash
run : |
rm -rf build
mkdir -p build
cd build
cmake .. -DCMAKE_BUILD_TYPE=RELEASE
cmake --build . -j
build-macos:
strategy:
fail-fast: false
matrix:
include:
- target: Debug # tests only
os: macos-latest
xcode: 12.5.1
qt_version: 6
type: Debug
do_tests: 0
- target: 10.14_Mojave
os: macos-10.15 # runs on Catalina
xcode: 10.3 # allows compatibility with macOS 10.14
qt_version: 5
type: Release
do_tests: 0
make_package: 1
- target: 10.15_Catalina
os: macos-10.15
xcode: 12.4
qt_version: 6
type: Release
do_tests: 0
make_package: 1
- target: 11_Big_Sur
os: macos-11
xcode: 13.2
qt_version: 6
type: Release
do_tests: 0
make_package: 1
# - target: 12_Monterey
# os: macos-12
# xcode: 13.3
# qt_version: 6
# type: Release
# do_tests: 1
# make_package: 1
name: macOS ${{matrix.target}}
needs: configure
runs-on: ${{matrix.os}}
env:
DEVELOPER_DIR:
/Applications/Xcode_${{matrix.xcode}}.app/Contents/Developer
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust
uses: hecrj/setup-rust-action@v2
with:
rust-version: nightly
- uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: 'pip' # caching pip dependencies
- run: pip install -r requirements.txt -r src/mtg_search_engine/requirements.txt
- name: Install dependencies using homebrew
shell: bash
# cmake cannot find the mysql connector
# neither of these works: mariadb-connector-c mysql-connector-c++
env:
qt_version: 'qt@${{matrix.qt_version}}'
run: |
brew update
brew install "$qt_version" --force-bottle
brew install llvm
brew install gcc
brew install python3
brew install curl
brew install openssl
- name: Build on Xcode ${{matrix.xcode}}
shell: bash
id: build
env:
BUILDTYPE: '${{matrix.type}}'
MAKE_TEST: '${{matrix.do_tests}}'
MAKE_PACKAGE: '${{matrix.make_package}}'
PACKAGE_SUFFIX: '-macOS-${{matrix.target}}'
# set QTDIR to find qt5, qt6 can be found without this
QTDIR: '/usr/local/opt/qt5'
run: mkdir build; cd build; cmake ..; cmake --build . -j
build-windows:
strategy:
fail-fast: false
matrix:
include:
- target: Win-32bit
arch: 32
vcpkg_default_triplet: x86
qt_version: '5.15.2'
cmake_generator_platform: Win32
qt_arch: msvc2019
qt_tools: "tools_openssl_x86"
- target: Win7+-64bit
arch: 64
vcpkg_default_triplet: x64
qt_version: '5.15.2'
cmake_generator_platform: x64
qt_arch: msvc2019_64
qt_tools: "tools_openssl_x86"
- target: Win10+-64bit
arch: 64
vcpkg_default_triplet: x64
qt_version: '6.3.0'
cmake_generator_platform: x64
qt_arch: msvc2019_64
qt_modules: "qt5compat qtmultimedia qtwebsockets"
qt_tools: "tools_openssl_x86"
name: ${{matrix.target}}
needs: configure
runs-on: windows-2019
env:
CMAKE_GENERATOR: 'Visual Studio 16 2019'
steps:
- name: Add msbuild to PATH
id: add-msbuild
uses: microsoft/setup-msbuild@v1.3
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust
uses: hecrj/setup-rust-action@v2
with:
rust-version: nightly
- uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: 'pip' # caching pip dependencies
- run: pip install -r requirements.txt -r src/mtg_search_engine/requirements.txt
- name: Restore Qt ${{matrix.qt_version}} for ${{matrix.target}} from cache
id: cache-qt
uses: actions/cache@v4 # Intentionally v1, based on jurplel documentation
with:
key: QtCache-${{matrix.qt_version}}-${{matrix.target}}
path: '${{github.workspace}}/../Qt'
- name: Install Qt ${{matrix.qt_version}} for ${{matrix.target}}
uses: jurplel/install-qt-action@v4
with:
cached: ${{steps.cache-qt.outputs.cache-hit}}
version: ${{matrix.qt_version}}
arch: win${{matrix.arch}}_${{matrix.qt_arch}}
modules: ${{matrix.qt_modules}}
tools: ${{matrix.qt_tools}}
- name: Install Chocolatey
run: Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
- name: Install OpenSSL
run: choco install openssl -y
- name: Install curl
run: choco install curl -y
- name: Install flex and bison
run: choco install winflexbison3 -y
- name: Install Doxygen
run: choco install doxygen.install -y
- name: Build Squire Desktop
id: build
shell: bash
env:
PACKAGE_SUFFIX: '-${{matrix.target}}'
CMAKE_GENERATOR: '${{env.CMAKE_GENERATOR}}'
CMAKE_GENERATOR_PLATFORM: '${{matrix.cmake_generator_platform}}'
QTDIR: '${{github.workspace}}\Qt\${{matrix.qt_version}}\win${{matrix.arch}}_${{matrix.qt_arch}}'
run: |
mkdir build
cd build
cmake ..
cmake --build . -j
- name: Generate release assets
shell: bash
run: |
mkdir -p debug-build
cp -f build/Debug/SquireDesktop.exe debug-build/
cp -f lib/x86_64/discord_game_sdk.dll debug-build/
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: SquireDesktop.exe
path: debug-build