-
-
Notifications
You must be signed in to change notification settings - Fork 20
358 lines (292 loc) · 11.6 KB
/
ci.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
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
name: Build & Release Millennium
on:
workflow_dispatch:
jobs:
build-windows:
permissions:
contents: write
issues: write
pull-requests: write
runs-on: windows-latest
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
steps:
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: (Setup) Node.js
uses: actions/setup-node@v3
with:
node-version: 20
- name: (Setup) Assets Build Environment
run: cd assets && npm install && npm run build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: (Setup) Build Assets
run: . scripts\ci\win32\mk-assets.ps1
- name: (Setup) Construct Python Environment
run: . scripts\ci\win32\setup-python.ps1 D:/a/env/ext/data/cache
- name: (Setup) Semantic Release
run: npm install --save-dev semantic-release @semantic-release/github @semantic-release/exec @semantic-release/changelog @semantic-release/git
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# dry run to get the next version
- name: Bump Version
id: read_version
run: . scripts\ci\win32\version.ps1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up cache for Python source
uses: actions/cache@v3
id: build-cache
with:
path: Python-3.11.8/PCbuild/win32
key: ${{ runner.os }}-python-3.11.8-build
restore-keys: ${{ runner.os }}-python-3.11.8-build-
- name: (Python) Add msbuild to PATH
if: steps.build-cache.outputs.cache-hit != 'true'
uses: microsoft/setup-msbuild@v2
- name: (Python) Download 3.11.8 win32 source
if: steps.build-cache.outputs.cache-hit != 'true'
run: . scripts\ci\win32\build-python.ps1
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
name: python 3.11.8 build libraries
path: D:/a/Millennium/Millennium/build/python
- name: Install prerequisites
uses: msys2/setup-msys2@v2
with:
msystem: mingw32
install: >-
mingw-w64-i686-libgcrypt
mingw-w64-i686-gcc
mingw-w64-i686-cmake
mingw-w64-i686-ninja
unzip
- name: (Dependency) Install vcpkg
shell: pwsh
run: ./vendor/vcpkg/bootstrap-vcpkg.bat && ./vendor/vcpkg/vcpkg integrate install
- name: (Generator) Configure CMake
shell: msys2 {0}
run: cmake --preset=windows-mingw-release -DGITHUB_ACTION_BUILD=ON
- name: Install Node.js and npm
shell: msys2 {0}
run: |
curl -fsSL https://nodejs.org/dist/v16.20.0/node-v16.20.0-win-x86.zip -o node.zip
unzip node.zip -d /usr/local
export PATH="/usr/local/node-v16.20.0-win-x86:$PATH"
node --version
npm --version
- name: Build Millennium
shell: msys2 {0}
run: |
mkdir D:/a/Millennium/Millennium/build/artifacts
cmake --build build --config Release
cp D:/a/Millennium/Millennium/Python-3.11.8/PCbuild/win32/python311.dll D:/a/env/python311.dll
cp /d/a/Millennium/Millennium/build/win32/user32.dll D:/a/env/user32.dll
cp /d/a/Millennium/Millennium/build/millennium.dll D:/a/env/millennium.dll
mkdir D:/a/env/ext/bin
# Disable Millennium CLI for now, as it keeps get false positive detections for no apparent reason
# cp /d/a/Millennium/Millennium/build/cli/millennium.exe D:/a/env/ext/bin/millennium.exe
- name: Add API modules
run: |
npm install @steambrew/api
New-Item -ItemType Directory -Force -Path "D:/a/env/ext/data/shims"
Copy-Item -Path "./node_modules/@steambrew/api/dist/webkit_api.js" -Destination "D:/a/env/ext/data/shims/webkit_api.js" -Force
Copy-Item -Path "./node_modules/@steambrew/api/dist/client_api.js" -Destination "D:/a/env/ext/data/shims/client_api.js" -Force
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
include-hidden-files: true
name: millennium-windows
path: D:/a/env/
build-linux:
permissions:
contents: write
issues: write
pull-requests: write
runs-on: ubuntu-latest
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
steps:
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: (Setup) Node.js
uses: actions/setup-node@v3
with:
node-version: 20
- name: (Setup) Assets Build Environment
run: cd assets && npm install && npm run build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: (Setup) Build Assets
run: bash scripts/ci/posix/mk-assets.sh
- name: (Setup) Semantic Release
run: npm install --save-dev semantic-release @semantic-release/github @semantic-release/exec @semantic-release/changelog @semantic-release/git
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# dry run to get the next version
- name: Bump Version
id: read_version
run: bash scripts/ci/posix/version.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y \
build-essential \
zlib1g-dev:i386 \
libncurses5-dev:i386 \
libgdbm-dev:i386 \
libnss3-dev:i386 \
libssl-dev:i386 \
libreadline-dev:i386 \
libffi-dev:i386 \
wget \
curl \
libbz2-dev:i386 \
libsqlite3-dev:i386 \
liblzma-dev:i386 \
gcc-multilib \
g++-multilib
- name: Set up cache for Python source
uses: actions/cache@v3
id: build-cache
with:
path: home/runner/.millennium/ext/data/cache
key: ${{ runner.os }}-python-linux-3.11.8-build
restore-keys: ${{ runner.os }}-python-linux-3.11.8-build-
- name: Download Python 3.11.8 source
if: steps.build-cache.outputs.cache-hit != 'true'
run: |
wget https://www.python.org/ftp/python/3.11.8/Python-3.11.8.tgz
tar -xf Python-3.11.8.tgz
- name: Configure and build Python 3.11.8 (32-bit)
if: steps.build-cache.outputs.cache-hit != 'true'
run: |
mkdir -p $HOME/.millennium/ext/data/cache
cd Python-3.11.8
sudo CFLAGS="-m32" LDFLAGS="-m32" ./configure --prefix=$HOME/.millennium/ext/data/cache --enable-optimizations
sudo make -j$(nproc)
sudo make altinstall
- name: Setup installation
if: steps.build-cache.outputs.cache-hit != 'true'
run: |
sudo mkdir -p $HOME/.millennium/ext/data/cache/lib/tmp
cd $HOME/.millennium/ext/data/cache/lib/tmp
sudo ar -x ../libpython3.11.a
sudo gcc -m32 -shared -o ../libpython-3.11.8.so *.o
cd $HOME/.millennium/ext/data/cache/lib
sudo rm -rf tmp
ls
sudo mkdir -p $HOME/Documents/LibPython/
cd $HOME/.millennium/ext/data/cache/include/python3.11/
sudo mv * $HOME/Documents/LibPython/
sudo rm -rf $HOME/.millennium/ext/data/cache/lib/python3.11/test/
sudo rm -rf $HOME/.millennium/ext/data/cache/share
sudo rm -rf $HOME/.millennium/ext/data/cache/include
sudo rm -rf $HOME/.millennium/ext/data/cache/lib/python3.11/__pycache__/
sudo rm -rf $HOME/.millennium/ext/data/cache/lib/python3.11/config-3.11-x86_64-linux-gnu/
sudo rm $HOME/.millennium/ext/data/cache/lib/libpython3.11.a
sudo mv $HOME/.millennium/ext/data/cache/lib/libpython-3.11.8.so $HOME/.millennium/libpython-3.11.8.so
$HOME/.millennium/ext/data/cache/bin/python3.11 --version
mkdir -p /home/runner/env/ext/data
sudo cp -r $HOME/.millennium/ext/data/cache /home/runner/env/ext/data
- name: (Generator) Install CMake
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.21.1'
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
- name: (Dependency) Install vcpkg & setup environment
run: sudo apt install libgtk-3-dev ninja-build && ./vendor/vcpkg/bootstrap-vcpkg.sh && ./vendor/vcpkg/vcpkg integrate install
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
- name: (Generator) Configure CMake
run: cmake --preset=linux -G "Ninja" -DGITHUB_ACTION_BUILD=ON
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
- name: Build Millennium
run: |
# mkdir -p /home/runner/Millennium/build/artifacts
cmake --build build --config Release
# ls -laR /home/runner/Millennium/build
mkdir -p /home/runner/env
cp ./build/libMillennium.so /home/runner/env/libMillennium.so
cp ~/.millennium/libpython-3.11.8.so /home/runner/env/libpython-3.11.8.so
cp ./scripts/posix/start.sh /home/runner/env/start.sh
mkdir -p /home/runner/env/ext/bin
cp ./build/cli/millennium /home/runner/env/ext/bin/millennium
npm install @steambrew/api
mkdir -p /home/runner/env/ext/data/shims
cp -r ./node_modules/@steambrew/api/dist/webkit_api.js /home/runner/env/ext/data/shims/webkit_api.js
cp -r ./node_modules/@steambrew/api/dist/client_api.js /home/runner/env/ext/data/shims/client_api.js
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
include-hidden-files: true
name: millennium-linux
path: /home/runner/env/
release:
needs: [build-windows, build-linux]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 20
- name: Install Semantic Release
run: npm install --save-dev semantic-release @semantic-release/github @semantic-release/exec @semantic-release/changelog @semantic-release/git
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Download Windows Artifact
uses: actions/download-artifact@v4
with:
name: millennium-windows
path: ./artifacts/windows
- name: Download Linux Artifact
uses: actions/download-artifact@v4
with:
name: millennium-linux
path: ./artifacts/linux
- name: Bump Version
id: read_version
run: bash scripts/ci/posix/bump.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Proccess Artifacts
run: |
mkdir -p ./artifacts/release
cd ./artifacts/windows
zip -r ../release/millennium-v${{ steps.read_version.outputs.version }}-windows-x86_64.zip .
cd - # return to the original directory
cd ./artifacts/linux
tar -czvf ../release/millennium-v${{ steps.read_version.outputs.version }}-linux-x86_64.tar.gz .
cd - # return to the original directory
- name: Create GitHub Release
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}