-
Notifications
You must be signed in to change notification settings - Fork 0
364 lines (297 loc) · 9.85 KB
/
build.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
358
359
360
361
362
363
364
# SPDX-License-Identifier: CC0-1.0
#
# SPDX-FileContributor: Adrian "asie" Siekierka, 2024
# SPDX-FileContributor: Antonio Niño Díaz, 2024
name: Packages
on:
push:
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
workflow_dispatch:
repository_dispatch:
types: [run_build]
permissions:
contents: read
pages: write
id-token: write
packages: write
jobs:
build_linux:
name: Build Pacman packages (Linux)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arch: [x86_64, aarch64]
steps:
- name: Clone project
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Alpine Linux
uses: jirutka/setup-alpine@v1
with:
branch: v3.20
arch: ${{ matrix.arch }}
packages: >
bash
build-base
coreutils
curl
fakeroot
git
libarchive-tools
patchelf
sed
sudo
xz
zstd
# This folder needs to be created as root, but regular users need to be
# able to modify it.
- name: Create /opt/wonderful folder
shell: alpine.sh --root {0}
run: |
sudo sh -c "mkdir /opt/wonderful && chown -R runner /opt/wonderful"
- name: Install Wonderful
shell: alpine.sh {0}
run: |
cd /opt/wonderful
curl https://wonderful.asie.pl/bootstrap/wf-bootstrap-${{ matrix.arch }}.tar.gz | tar xzvf -
- name: Install prerequisites (Wonderful)
shell: alpine.sh {0}
run: |
export PATH=/opt/wonderful/bin:$PATH
wf-pacman -Syu --noconfirm
wf-pacman -Syu --noconfirm \
wonderful-base \
runtime-musl-dev \
toolchain-gcc-arm-none-eabi \
if [ "${{ matrix.arch }}" == "x86_64" ]; then
wf-pacman -Syu --noconfirm \
toolchain-llvm-teak-llvm \
toolchain-gcc-arm-none-eabi-libpng16 \
toolchain-gcc-arm-none-eabi-zlib
fi
- name: Build packages
shell: alpine.sh {0}
run: |
bash build.sh blocksds-toolchain
bash build.sh blocksds-ptexconv
# Only build architecture-agnostic packages once
if [ "${{ matrix.arch }}" == "x86_64" ]; then
# Install the SDK so that we can build other libs
bash install.sh blocksds-toolchain
export BLOCKSDS=/opt/wonderful/thirdparty/blocksds/core/
export BLOCKSDSEXT=/opt/wonderful/thirdparty/blocksds/external/
bash build.sh blocksds-dserial
bash install.sh blocksds-dserial # Required by blocksds-dsmi
bash build.sh blocksds-docs
bash build.sh blocksds-dsmi
bash build.sh blocksds-gbajpeg
bash build.sh blocksds-libdsf
bash build.sh blocksds-libwoopsi
bash build.sh blocksds-nflib
bash build.sh blocksds-nitroengine
bash build.sh blocksds-ulibrary
fi
mkdir -p out
mv */*.pkg.tar.xz out
echo "Artifacts:"
echo "=========="
ls out
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: packages_linux_${{ matrix.arch }}
path: out
compression-level: 0
if-no-files-found: error
# https://wonderful.asie.pl/wiki/doku.php?id=getting_started
build_windows:
name: Build Pacman packages (Windows)
runs-on: windows-latest
continue-on-error: false
strategy:
fail-fast: false
steps:
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: ucrt64
update: true
install: |
base-devel
gcc
git
libarchive
libtool
lld
make
mingw-w64-ucrt-x86_64-ca-certificates
mingw-w64-ucrt-x86_64-iconv
mingw-w64-ucrt-x86_64-python
mingw-w64-ucrt-x86_64-python-poetry
mingw-w64-ucrt-x86_64-toolchain
wget
- name: Install Wonderful
shell: msys2 {0}
run: |
mkdir /opt/wonderful
cd /opt/wonderful
wget https://wonderful.asie.pl/bootstrap/wf-bootstrap-windows-x86_64.tar.gz
tar -xzvf wf-bootstrap-windows-x86_64.tar.gz
- name: Install prerequisites (Wonderful)
shell: msys2 {0}
run: |
export PATH=/opt/wonderful/bin:$PATH
export WONDERFUL_TOOLCHAIN=/opt/wonderful/
wf-pacman -Syu --noconfirm
wf-pacman -Syu --noconfirm \
wonderful-base \
wf-pacman \
runtime-gcc-libs \
toolchain-gcc-arm-none-eabi
- name: Set Git line endings to LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Clone project
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build packages
shell: msys2 {0}
run: |
bash build.sh blocksds-toolchain
bash build.sh blocksds-ptexconv
mkdir -p out
mv */*.pkg.tar.xz out
echo "Artifacts:"
echo "=========="
ls out
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: packages_windows_x86_64
path: out
compression-level: 0
if-no-files-found: error
generate_website:
name: Generate website
needs: [build_linux, build_windows]
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Clone project
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Alpine Linux
uses: jirutka/setup-alpine@v1
with:
branch: v3.20
arch: x86_64
packages: >
bash
build-base
coreutils
curl
envsubst
fakeroot
git
libarchive-tools
patchelf
sed
sudo
xz
zstd
# This folder needs to be created as root, but regular users need to be
# able to modify it.
- name: Create /opt/wonderful folder
shell: alpine.sh --root {0}
run: |
sudo sh -c "mkdir /opt/wonderful && chown -R runner /opt/wonderful"
- name: Install Wonderful
shell: alpine.sh {0}
run: |
cd /opt/wonderful
curl https://wonderful.asie.pl/bootstrap/wf-bootstrap-x86_64.tar.gz | tar xzvf -
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Create repo files
shell: alpine.sh {0}
run: |
tree
export PATH=/opt/wonderful/bin:$PATH
export WONDERFUL_TOOLCHAIN=/opt/wonderful/
mkdir -p packages/rolling/linux/x86_64/
mkdir -p packages/rolling/linux/aarch64/
mkdir -p packages/rolling/windows/x86_64/
# The architecture-agnostic and OS-agnostic packages are only built
# in the Linux x86_64 build, so they need to be copied to the other
# architectures and OSes.
cp packages_linux_x86_64/*.pkg.tar.xz packages/rolling/linux/x86_64/
cp packages_linux_x86_64/*any.pkg.tar.xz packages/rolling/linux/aarch64/
cp packages_linux_aarch64/*.pkg.tar.xz packages/rolling/linux/aarch64/
cp packages_linux_x86_64/*any.pkg.tar.xz packages/rolling/windows/x86_64/
cp packages_windows_x86_64/*.pkg.tar.xz packages/rolling/windows/x86_64/
tree
cd packages/rolling/linux/x86_64/
wf-repo-add blocksds.db.tar.xz *.pkg.tar.xz
# Remove symlinks for GitHub pages
rm blocksds.db
rm blocksds.files
cp blocksds.db.tar.xz blocksds.db
cp blocksds.files.tar.xz blocksds.files
cd ../../../..
cd packages/rolling/linux/aarch64/
wf-repo-add blocksds.db.tar.xz *.pkg.tar.xz
# Remove symlinks for GitHub pages
rm blocksds.db
rm blocksds.files
cp blocksds.db.tar.xz blocksds.db
cp blocksds.files.tar.xz blocksds.files
cd ../../../..
cd packages/rolling/windows/x86_64/
wf-repo-add blocksds.db.tar.xz *.pkg.tar.xz
# Remove symlinks for GitHub pages
rm blocksds.db
rm blocksds.files
cp blocksds.db.tar.xz blocksds.db
cp blocksds.files.tar.xz blocksds.files
cd ../../../..
# Generate basic index files
bash gen_index.sh packages/rolling/linux/x86_64/ true
bash gen_index.sh packages/rolling/linux/aarch64/ true
bash gen_index.sh packages/rolling/windows/x86_64/ true
bash gen_index.sh packages/rolling/linux/ true
bash gen_index.sh packages/rolling/windows/ true
bash gen_index.sh packages/rolling/ true
bash gen_index.sh packages/ false
# Create tarball with everything to upload to GitHub pages
cd packages
tar -cvf ../repo.tar ./*
- name: Upload repo artifact
uses: actions/upload-artifact@v4
with:
name: github-pages
path: repo.tar
if-no-files-found: error
publish_repo:
name: Publish website with GitHub pages
if: contains(github.ref,'refs/heads/master')
needs: [generate_website]
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4