-
Notifications
You must be signed in to change notification settings - Fork 9
284 lines (244 loc) · 10.9 KB
/
nightly.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
name: Nightly
on:
schedule:
- cron: '0 0 * * *' # run at 0 AM UTC
workflow_dispatch:
inputs:
justification:
description: "Reason for manual run"
required: true
dryRun:
description: "If true, do not upload files"
default: true
env:
SIMC_PROFILE: profiles/CI.simc
ORG_NAME: simulationcraftorg
IMAGE_NAME: simc
jobs:
nightly-build-macos:
name: MacOS Nightly ${{ matrix.source_branch }}
runs-on: macos-latest
strategy:
matrix:
source_branch: [dragonflight]
include:
- source_branch: dragonflight
run_smokeTest: false
- architecture: macos
steps:
- uses: actions/checkout@v3
with:
repository: simulationcraft/simc
ref: ${{ matrix.source_branch }}
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
modules: qtwebengine qtwebchannel qtpositioning
version: 6.4.0
aqtversion: '==3.0.*'
setup-python: 'false'
- name: Get git hash
id: git_hash
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Extract Simc Version info and setup output information
id: simc_info
env:
configHeader: engine/config.hpp
run: |
export SIMC_MAJOR=$(grep -E -e "^#define SC_MAJOR_VERSION" "${{ env.configHeader }}" | sed -E -e "s/#define SC_MAJOR_VERSION \"([0-9]+)\"/\1/g")
export SIMC_MINOR=$(grep -E -e "^#define SC_MINOR_VERSION" "${{ env.configHeader }}" | sed -E -e "s/#define SC_MINOR_VERSION \"([0-9]+)\"/\1/g")
export SIMC_VERSION=$SIMC_MAJOR-$SIMC_MINOR
echo "simc_version=$(echo "$SIMC_VERSION")" >> $GITHUB_OUTPUT
echo "simc_output_file=$(echo "simc-$SIMC_VERSION-osx-x86.dmg")" >> $GITHUB_OUTPUT
echo "simc_nightly_file=$(echo "simc-$SIMC_VERSION-${{ matrix.architecture }}-${{ steps.git_hash.outputs.sha_short }}.dmg")" >> $GITHUB_OUTPUT
echo "$SIMC_VERSION" > ./simc-version
- name: Build and create a release package
env:
SC_DEFAULT_APIKEY: ${{ secrets.SC_DEFAULT_APIKEY }}
run: |
$Qt6_DIR/bin/qmake LTO=1 simulationcraft.pro QMAKE_APPLE_DEVICE_ARCHS="x86_64 arm64"
make -j $(sysctl -n hw.ncpu) create_release
- name: Smoke Test
if: ${{ matrix.run_smokeTest }}
run: |
./simc ${{ env.SIMC_PROFILE }} iterations=5 output=/dev/null html=/dev/null json2=/dev/null cleanup_threads=1
- name: Rename DMG file to nightly format
run: |
mv ${{ steps.simc_info.outputs.simc_output_file }} ${{ steps.simc_info.outputs.simc_nightly_file }}
- uses: actions/upload-artifact@v3
with:
name: simc-nightly-${{ matrix.architecture }}-${{ matrix.source_branch }}
path: |
${{ steps.simc_info.outputs.simc_nightly_file }}
./simc-version
nightly-build-windows:
name: Windows Nightly ${{ matrix.architecture }} ${{ matrix.source_branch }} ${{ matrix.qt }}
runs-on: windows-latest
env:
SIMCDIR: ${{ github.workspace }}
INSTALL: ${{ github.workspace }}/install
CMAKE_BUILD_DIR: ${{ github.workspace }}/builddir/
uploadDir: ${{ github.workspace }}/upload
strategy:
fail-fast: false
matrix:
qt: [qt6]
targetConfiguration: [Release]
source_branch: [dragonflight]
architecture: [x64, arm64]
include:
- qt: qt6
qt_version: 6.4.0
qt_dir_variable: QT6_DIR
qt_modules: qtwebengine qtwebchannel qtpositioning
- architecture: x64
cl_architecture: x64
package_suffix: win64
qt_arch: win64_msvc2019_64
smokeTest: true
buildGui: ON
- architecture: arm64
cl_architecture: amd64_arm64
package_suffix: winarm64
# Use x64 qt installation for arm, since we can currently build cli only anyway, and require host qmake. If we ever want to fully build the GUI, we need to somehow get both win64_msvc2019_arm64 Qt as well as win64_msvc2019_64 for qmake set up. jurplel/install-qt-actio does not set up the qmake.bat from the arm64 install to correctly point to the x64 qmake.exe, and maybe does not even install it at all.
qt_arch: win64_msvc2019_64
smokeTest: false
buildGui: OFF
qt_modules: ""
- source_branch: dragonflight
smokeTest: false
steps:
- uses: actions/checkout@v3
with:
repository: simulationcraft/simc
ref: ${{ matrix.source_branch }}
- name: Get git hash
id: git_hash
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Get cmake
uses: lukka/get-cmake@latest
- name: Add MSBuild and MS C++ Compiler to path
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.cl_architecture }}
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
modules: ${{ matrix.qt_modules }}
arch: ${{ matrix.qt_arch }}
setup-python: 'false'
version: ${{ matrix.qt_version }}
aqtversion: '==3.0.*'
- name: Create Install and Upload Directory
run: |
mkdir ${{ env.INSTALL }}
mkdir ${{ env.uploadDir }}
- name: Extract Simc Version info and setup output information
id: simc_info
env:
configHeader: engine/config.hpp
run: |
$env:simc_major = Get-Content "${{ env.configHeader }}" | Select-String '#define SC_MAJOR_VERSION \"(.+)\"' | ForEach-Object {$_.Matches[0].Groups[1].Value}
$env:simc_minor = Get-Content "${{ env.configHeader }}" | Select-String '#define SC_MINOR_VERSION \"(.+)\"' | ForEach-Object {$_.Matches[0].Groups[1].Value}
mkdir ${{ env.CMAKE_BUILD_DIR }}
echo "$env:simc_major.$env:simc_minor" > ${{ env.CMAKE_BUILD_DIR }}/simc-version
- name: Generate project files
run: |
cmake -B "${{ env.CMAKE_BUILD_DIR }}" -GNinja -DBUILD_GUI=${{ matrix.buildGui }} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=${{ steps.simc_info.outputs.install_dir}} -DSC_DEFAULT_APIKEY=${{ secrets.SC_DEFAULT_APIKEY }} -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=1 -DCPACK_SYSTEM_NAME=${{ matrix.package_suffix }} --log-level=VERBOSE
- name: Build
run: |
cmake --build "${{ env.CMAKE_BUILD_DIR }}" --target all
- name: Smoke Test
if: ${{ matrix.smokeTest }}
run: |
& "${{ env.CMAKE_BUILD_DIR }}/simc.exe" ${{ env.SIMC_PROFILE }} iterations=5 output=nul html=nul json2=nul cleanup_threads=1
- name: Package
run: |
cmake --build "${{ env.CMAKE_BUILD_DIR }}" --target package
- uses: actions/upload-artifact@v3
with:
name: simc-nightly-${{ matrix.package_suffix }}-${{ matrix.source_branch }}
path: |
${{ env.CMAKE_BUILD_DIR }}/*.7z
${{ env.CMAKE_BUILD_DIR }}/simc-version
nightly-upload:
name: Nightly Upload ${{ matrix.source_branch }} ${{ matrix.package_suffix }}
runs-on: ubuntu-latest
needs: [nightly-build-windows, nightly-build-macos]
if: ${{ github.event.inputs.dryRun != 'true' }}
strategy:
matrix:
package_suffix: [win64, winarm64, macos]
source_branch: [dragonflight]
include:
- package_suffix: win64
file_extension: 7z
- package_suffix: winarm64
file_extension: 7z
- package_suffix: macos
file_extension: dmg
steps:
- name: Install sftp utils
run: |
sudo apt install sshpass
- uses: actions/download-artifact@v3
with:
name: simc-nightly-${{ matrix.package_suffix }}-${{ matrix.source_branch }}
path: ${{ github.workspace }}/artifacts
# Use specific commit id here to fix known-hosts input not working.
- name: SFTP Upload
run: |
export SIMCVERSION=$(cat ${{ env.local-dir }}/simc-version | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
mkdir -p ~/.ssh
echo "${{ secrets.UPLOAD_KNOWN_HOSTS }}" > ~/.ssh/known_hosts
sshpass -e sftp -q ${{ secrets.UPLOAD_USER }}@${{ secrets.UPLOAD_HOST }}:${{ env.remote-dir }} <<< $"rm simc-$SIMCVERSION-${{ matrix.package_suffix }}-*.${{ matrix.file_extension }}"
sshpass -e sftp -q ${{ secrets.UPLOAD_USER }}@${{ secrets.UPLOAD_HOST }}:${{ env.remote-dir }} <<< $"rm simc-$SIMCVERSION.*-${{ matrix.package_suffix }}.${{ matrix.file_extension }}"
sshpass -e sftp -q ${{ secrets.UPLOAD_USER }}@${{ secrets.UPLOAD_HOST }}:${{ env.remote-dir }} <<< $'put ${{ env.local-dir }}/*.${{ matrix.file_extension }}'
env:
SSHPASS: ${{ secrets.UPLOAD_PASSWORD }}
known-hosts: ${{ secrets.UPLOAD_KNOWN_HOSTS }}
remote-dir: /
local-dir: ${{ github.workspace }}/artifacts
docker-image-create-and-publish:
# TODO: this approach could be improved by doing a matrix build like the above jobs do
# matrix could be branch and threads
# threads could be used for different tagged versions too
needs: [nightly-build-windows, nightly-build-macos]
runs-on: ubuntu-latest
strategy:
matrix:
source_branch: [dragonflight]
steps:
- uses: actions/checkout@v3
with:
repository: simulationcraft/simc
ref: ${{ matrix.source_branch }}
path: 'simc'
- name: Get SimulationCraft version
run: |
echo "SIMC_VERSION=$(grep 'SIMC_WOW_VERSION' engine/dbc/generated/client_data_version.inc | sed -E -e 's/#define SIMC_WOW_VERSION \"(.+)\"/\1/')" >> $GITHUB_ENV
working-directory: ./simc
- name: Get SimulationCraft version
run: |
echo "SIMC_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
working-directory: ./simc
- name: Get date
run: |
echo "DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
working-directory: ./simc
- name: Create full version string
run: |
echo "VERSION_STRING=$SIMC_VERSION-$DATE-$SIMC_HASH" >> $GITHUB_ENV
- name: Build image
run: |
docker build . --file Dockerfile --build-arg APIKEY=${{ secrets.SC_DEFAULT_APIKEY }} --tag $IMAGE_NAME:$VERSION_STRING --tag $IMAGE_NAME:latest
working-directory: ./simc
- name: Log into registry
run: echo "${{ secrets.DOCKERHUB }}" | docker login -u ${{ secrets.DOCKERHUBUSER }} --password-stdin
- name: Push image
run: |
IMAGE_ID=$ORG_NAME/$IMAGE_NAME
docker tag $IMAGE_NAME:$VERSION_STRING $IMAGE_ID:$VERSION_STRING
docker tag $IMAGE_NAME:latest $IMAGE_ID:latest
docker push $IMAGE_ID:$VERSION_STRING
docker push $IMAGE_ID:latest