-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yaml
401 lines (370 loc) · 15.9 KB
/
action.yaml
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
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
name: build-release
description: >
Build Savi application release binaries for
multiple platforms from a single CI runner.
inputs:
manifest-name:
description: >
The name of the Savi manifest to build as a binary.
required: true
tarball-name:
description: >
The name to use for the built tarballs.
Each tarball will have a suffix of the platform name and `.tar.gz`.
required: true
all-platforms:
type: boolean
description: >
Produce builds for all platforms.
required: false
default: false
x86_64-unknown-linux-gnu:
type: boolean
description: >
Produce a build targeting the x86_64-unknown-linux-gnu platform.
required: false
default: false
x86_64-unknown-linux-musl:
type: boolean
description: >
Produce a build targeting the x86_64-unknown-linux-musl platform.
required: false
default: false
arm64-unknown-linux-musl:
type: boolean
description: >
Produce a build targeting the arm64-unknown-linux-musl platform.
required: false
default: false
x86_64-unknown-freebsd:
type: boolean
description: >
Produce a build targeting the x86_64-unknown-freebsd platform.
required: false
default: false
x86_64-apple-macosx:
type: boolean
description: >
Produce a build targeting the x86_64-apple-macosx platform.
required: false
default: false
arm64-apple-macosx:
type: boolean
description: >
Produce a build targeting the arm64-apple-macosx platform.
required: false
default: false
x86_64-unknown-windows-msvc:
type: boolean
description: >
Produce a build targeting the x86_64-unknown-windows-msvc platform.
required: false
default: false
macosx-accept-license:
type: boolean
description: >
Acknowledge acceptance of the terms of the MacOSX SDK license.
Required for building macosx targets on non-macosx runners.
required: false
default: false
windows-accept-license:
type: boolean
description: >
Acknowledge acceptance of the terms of the Windows SDK license.
Required for building windows targets on non-windows runners.
required: false
default: false
build-command:
description: The build command. You probably shouldn't mess with this.
required: false
default: " \
echo Building $tarball_name-$target.tar.gz && \
rm -rf bin && \
savi build $manifest_name -X $target --release --no-debug && \
rm -rf $dir/current && \
cp -r bin $dir/current && \
mkdir -p $dir/publish && \
tar -czf $dir/publish/$tarball_name-$target.tar.gz -C $dir/current . \
"
outputs:
tarball-directory:
description: The directory where the bin release tarballs were build.
value: ${{ steps.setup.outputs.directory }}/publish
runs:
using: "composite"
steps:
- id: setup
run: echo "directory=$(mktemp -d)" >> $GITHUB_OUTPUT
shell: bash
- run: mkdir -p ${{ steps.setup.outputs.directory }}/publish
shell: bash
# Set up the x86_64 debian root, if the user requested that target.
- if: >
inputs.x86_64-unknown-linux-gnu == 'true'
|| inputs.all-platforms == 'true'
id: cache-x-x86_64-linux-gnu
uses: actions/cache@v3
with:
key: savi-build-release-x86_64-debian-bullseye-20220922
path: /tmp/x-x86_64-linux-gnu/root
- if: >
(inputs.x86_64-unknown-linux-gnu == 'true'
|| inputs.all-platforms == 'true')
&& steps.cache-x-x86_64-linux-gnu.outputs.cache-hit != 'true'
shell: bash
run: |
libc6_sha256=a3ef5dbbfa61f944efaa759feb4b3d05f572be159216545bced7b297fc09bab5 && \
libc6_dev_sha256=6821bb405a262ab73c0d087d742ce531103b8906f3a5fc0ee25c347295edee30 && \
libgcc_dev_sha256=347113a3bdd7379846e618efb610f49ce2704032972e1797e8e126925d5d7b19 && \
libgcc_shared_sha256=9e1d76c3f638472f7940bfac8f42c10aa534c0a0fce2314641d41a2b492347cd && \
rm -rf /tmp/x-x86_64-linux-gnu && mkdir -p /tmp/x-x86_64-linux-gnu/root && \
wget http://http.us.debian.org/debian/pool/main/c/cross-toolchain-base/libc6-amd64-cross_2.31-9cross4_all.deb \
-O /tmp/x-x86_64-linux-gnu/libc6.deb && \
wget http://http.us.debian.org/debian/pool/main/c/cross-toolchain-base/libc6-dev-amd64-cross_2.31-9cross4_all.deb \
-O /tmp/x-x86_64-linux-gnu/libc6-dev.deb && \
wget http://http.us.debian.org/debian/pool/main/g/gcc-10-cross/libgcc-10-dev-amd64-cross_10.2.1-6cross1_all.deb \
-O /tmp/x-x86_64-linux-gnu/libgcc-dev.deb && \
wget http://http.us.debian.org/debian/pool/main/g/gcc-10-cross/libgcc-s1-amd64-cross_10.2.1-6cross1_all.deb \
-O /tmp/x-x86_64-linux-gnu/libgcc-shared.deb && \
echo $libc6_sha256' /tmp/x-x86_64-linux-gnu/libc6.deb' | sha256sum -c - && \
echo $libc6_dev_sha256' /tmp/x-x86_64-linux-gnu/libc6-dev.deb' | sha256sum -c - && \
echo $libgcc_dev_sha256' /tmp/x-x86_64-linux-gnu/libgcc-dev.deb' | sha256sum -c - && \
echo $libgcc_shared_sha256' /tmp/x-x86_64-linux-gnu/libgcc-shared.deb' | sha256sum -c - && \
cd /tmp/x-x86_64-linux-gnu && \
ar -xf libc6.deb data.tar.xz && tar -xf data.tar.xz -C root && \
ar -xf libc6-dev.deb data.tar.xz && tar -xf data.tar.xz -C root && \
ar -xf libgcc-dev.deb data.tar.xz && tar -xf data.tar.xz -C root && \
ar -xf libgcc-shared.deb data.tar.xz && tar -xf data.tar.xz -C root && \
echo Fixing troublesome absolute paths in linker scripts... && \
sed -i 's|/usr|/tmp/x-x86_64-linux-gnu/root/usr|g' \
root/usr/x86_64-linux-gnu/lib/libc.so \
root/usr/x86_64-linux-gnu/lib/libm.so \
&& \
echo Done!
# Set up the x86_64 alpine root, if the user requested that target.
- if: >
inputs.x86_64-unknown-linux-musl == 'true'
|| inputs.all-platforms == 'true'
id: cache-x-x86_64-alpine
uses: actions/cache@v3
with:
key: savi-build-release-x86_64-alpine-3.17-20220922
path: /tmp/x-x86_64-alpine/root
- if: >
(inputs.x86_64-unknown-linux-musl == 'true'
|| inputs.all-platforms == 'true')
&& steps.cache-x-x86_64-alpine.outputs.cache-hit != 'true'
shell: bash
run: |
musl_dev_sha256=5df2320d68bf964a1f047649644264fca8a6c2fa9d417ea75c729457fad9df6f && \
gcc_sha256=ebf07b623a8bb3ebe18e8e1431118f6cc3f381d52aa57fc94c825c43d151f8f7 && \
libgcc_sha256=2c0282ec5c2d78fe94b1e0ab676d6fe675e6656796b8a92e29ce4b17234add6a && \
rm -rf /tmp/x-x86_64-alpine && mkdir -p /tmp/x-x86_64-alpine/root && \
wget https://dl-cdn.alpinelinux.org/alpine/v3.17/main/x86_64/musl-dev-1.2.3-r5.apk \
-O /tmp/x-x86_64-alpine/musl-dev.apk && \
wget https://dl-cdn.alpinelinux.org/alpine/v3.17/main/x86_64/gcc-12.2.1_git20220924-r4.apk \
-O /tmp/x-x86_64-alpine/gcc.apk && \
wget https://dl-cdn.alpinelinux.org/alpine/v3.17/main/x86_64/libgcc-12.2.1_git20220924-r4.apk \
-O /tmp/x-x86_64-alpine/libgcc.apk && \
echo $musl_dev_sha256' /tmp/x-x86_64-alpine/musl-dev.apk' | sha256sum -c - && \
echo $gcc_sha256' /tmp/x-x86_64-alpine/gcc.apk' | sha256sum -c - && \
echo $libgcc_sha256' /tmp/x-x86_64-alpine/libgcc.apk' | sha256sum -c - && \
cd /tmp/x-x86_64-alpine && \
tar -xf musl-dev.apk -C root && \
tar -xf gcc.apk -C root && \
tar -xf libgcc.apk -C root && \
echo Done!
# Set up the arm64 alpine root, if the user requested that target.
- if: >
inputs.arm64-unknown-linux-musl == 'true'
|| inputs.all-platforms == 'true'
id: cache-x-arm64-alpine
uses: actions/cache@v3
with:
key: savi-build-release-arm64-alpine-3.17-20220922
path: /tmp/x-arm64-alpine/root
- if: >
(inputs.arm64-unknown-linux-musl == 'true'
|| inputs.all-platforms == 'true')
&& steps.cache-x-arm64-alpine.outputs.cache-hit != 'true'
shell: bash
run: |
musl_dev_sha256=6a194ea8eb7045f517c396b1f3e6865aa048196ee7d4d2fbc2e56e26ae6daac6 && \
gcc_sha256=7742bdd9dcd5c4d357fda1c13830af8afad15b4aae291c24c7f87a2701d37584 && \
libgcc_sha256=4247daeec6d4f005c2c5e420c49b12f3deadb5640f0eb58e8e1a3c8cd0a32206 && \
rm -rf /tmp/x-arm64-alpine && mkdir -p /tmp/x-arm64-alpine/root && \
wget https://dl-cdn.alpinelinux.org/alpine/v3.17/main/aarch64/musl-dev-1.2.3-r5.apk \
-O /tmp/x-arm64-alpine/musl-dev.apk && \
wget https://dl-cdn.alpinelinux.org/alpine/v3.17/main/aarch64/gcc-12.2.1_git20220924-r4.apk \
-O /tmp/x-arm64-alpine/gcc.apk && \
wget https://dl-cdn.alpinelinux.org/alpine/v3.17/main/aarch64/libgcc-12.2.1_git20220924-r4.apk \
-O /tmp/x-arm64-alpine/libgcc.apk && \
echo $musl_dev_sha256' /tmp/x-arm64-alpine/musl-dev.apk' | sha256sum -c - && \
echo $gcc_sha256' /tmp/x-arm64-alpine/gcc.apk' | sha256sum -c - && \
echo $libgcc_sha256' /tmp/x-arm64-alpine/libgcc.apk' | sha256sum -c - && \
cd /tmp/x-arm64-alpine && \
tar -xf musl-dev.apk -C root && \
tar -xf gcc.apk -C root && \
tar -xf libgcc.apk -C root && \
echo Done!
# Set up the x86_64 freebsd root, if the user requested that target.
#
# For updates, see package names and hashes in the following YAML file:
# http://pkg.freebsd.org/FreeBSD:13:amd64/latest/packagesite.txz
- if: >
inputs.x86_64-unknown-freebsd == 'true'
|| inputs.all-platforms == 'true'
id: cache-x-x86_64-freebsd
uses: actions/cache@v3
with:
key: savi-build-release-x86_64-freebsd-14-20230421
path: /tmp/x-x86_64-freebsd/root
- if: >
(inputs.x86_64-unknown-freebsd == 'true'
|| inputs.all-platforms == 'true')
&& steps.cache-x-x86_64-freebsd.outputs.cache-hit != 'true'
shell: bash
run: |
sysroot_sha256=def304c61f3a24ba9393cba62cb93bf8aa6404bf28a2603d4226695b1de5abcd && \
rm -rf /tmp/x-x86_64-freebsd && mkdir -p /tmp/x-x86_64-freebsd/root && \
cd /tmp/x-x86_64-freebsd && \
wget http://pkg.freebsd.org/FreeBSD:14:amd64/release_0/All/amd64-freebsd-sysroot-a2023.08.03.pkg \
-O sysroot.pkg && \
echo $sysroot_sha256' sysroot.pkg' | sha256sum -c - && \
tar -xf sysroot.pkg -C root && \
echo Fixing troublesome absolute paths in linker scripts... && \
sed -i 's| /lib| /tmp/x-x86_64-freebsd/root/usr/local/freebsd-sysroot/amd64/lib|g' \
root/usr/local/freebsd-sysroot/amd64/usr/lib/libc.so \
&& \
sed -i 's| /usr| /tmp/x-x86_64-freebsd/root/usr/local/freebsd-sysroot/amd64/usr|g' \
root/usr/local/freebsd-sysroot/amd64/usr/lib/libc.so \
&& \
echo Done!
# Set up the MacOSX root, if the user accepted the license.
- if: inputs.macosx-accept-license == 'true'
id: cache-x-macosx
uses: actions/cache@v3
with:
key: savi-build-release-macosx-11.3-usr-lib-20220922
path: /tmp/x-macosx/root/usr/lib
- if: >
inputs.macosx-accept-license == 'true'
&& steps.cache-x-macosx.outputs.cache-hit != 'true'
shell: bash
run: |
macosx_sha512=36c1964ea43a782dfe2a0ef1da8c9c95ffe834fbc10b0d312ff8a87dd9f4c3310dea67e6e3d943824a2e3c288be4d60cf5bd852027770b35bc088527b598734f && \
rm -rf /tmp/x-macosx && mkdir -p /tmp/x-macosx/root && \
wget https://storage.googleapis.com/ory.sh/build-assets/MacOSX11.3.sdk.tar.xz \
-O /tmp/x-macosx/root.tar.gz && \
echo $macosx_sha512' /tmp/x-macosx/root.tar.gz' \
| sha512sum -c - && \
tar -xf /tmp/x-macosx/root.tar.gz -C /tmp/x-macosx/root --strip-components=1 && \
echo Done!
# Set up the Windows root, if the user accepted the license.
- if: inputs.windows-accept-license == 'true'
id: cache-x-windows
uses: actions/cache@v3
with:
key: savi-build-release-xwin-0.2.1-20220922
path: /tmp/x-windows/root
- if: >
inputs.windows-accept-license == 'true'
&& steps.cache-x-windows.outputs.cache-hit != 'true'
shell: bash
env: { XWIN_ACCEPT_LICENSE: '1' }
run: |
xwin_sha256=1a242d10aec08b9ea0aa4104b106289916291ef87e3bac3b911b006faf46c288 && \
rm -rf /tmp/x-windows && mkdir -p /tmp/x-windows/root && \
cd /tmp/x-windows && \
curl -L --fail https://github.com/Jake-Shadle/xwin/releases/download/0.2.1/xwin-0.2.1-x86_64-unknown-linux-musl.tar.gz \
| tar --strip-components=1 --wildcards -xvzf - '*/xwin' && \
echo $xwin_sha256' xwin' | sha256sum -c - && \
./xwin splat --output /tmp/x-windows/root && \
echo Done!
# Install dependencies for the Savi application being built, but guarantee
# that the dependency manifests aren't updated compared to the source code.
- run: |
savi deps update --for ${{ inputs.manifest-name }}
git diff --exit-code
shell: bash
##
# Now, build for all requested platforms...
- if: >
inputs.x86_64-unknown-linux-gnu == 'true'
|| inputs.all-platforms == 'true'
run: ${{ inputs.build-command }}
shell: bash
env:
dir: ${{ steps.setup.outputs.directory }}
manifest_name: ${{ inputs.manifest-name }}
tarball_name: ${{ inputs.tarball-name }}
target: x86_64-unknown-linux-gnu
SAVI_SYS_ROOT: /tmp/x-x86_64-linux-gnu/root
- if: >
inputs.x86_64-unknown-linux-musl == 'true'
|| inputs.all-platforms == 'true'
run: ${{ inputs.build-command }}
shell: bash
env:
dir: ${{ steps.setup.outputs.directory }}
manifest_name: ${{ inputs.manifest-name }}
tarball_name: ${{ inputs.tarball-name }}
target: x86_64-unknown-linux-musl
SAVI_SYS_ROOT: /tmp/x-x86_64-alpine/root
- if: >
inputs.arm64-unknown-linux-musl == 'true'
|| inputs.all-platforms == 'true'
run: ${{ inputs.build-command }}
shell: bash
env:
dir: ${{ steps.setup.outputs.directory }}
manifest_name: ${{ inputs.manifest-name }}
tarball_name: ${{ inputs.tarball-name }}
target: arm64-unknown-linux-musl
SAVI_SYS_ROOT: /tmp/x-arm64-alpine/root
- if: >
inputs.x86_64-unknown-freebsd == 'true'
|| inputs.all-platforms == 'true'
run: ${{ inputs.build-command }}
shell: bash
env:
dir: ${{ steps.setup.outputs.directory }}
manifest_name: ${{ inputs.manifest-name }}
tarball_name: ${{ inputs.tarball-name }}
target: x86_64-unknown-freebsd
SAVI_SYS_ROOT: /tmp/x-x86_64-freebsd/root/usr/local/freebsd-sysroot/amd64
- if: >
inputs.x86_64-apple-macosx == 'true'
|| inputs.all-platforms == 'true'
run: ${{ inputs.build-command }}
shell: bash
env:
dir: ${{ steps.setup.outputs.directory }}
manifest_name: ${{ inputs.manifest-name }}
tarball_name: ${{ inputs.tarball-name }}
target: x86_64-apple-macosx
SAVI_SYS_ROOT: /tmp/x-macosx/root
- if: >
inputs.arm64-apple-macosx == 'true'
|| inputs.all-platforms == 'true'
run: ${{ inputs.build-command }}
shell: bash
env:
dir: ${{ steps.setup.outputs.directory }}
manifest_name: ${{ inputs.manifest-name }}
tarball_name: ${{ inputs.tarball-name }}
target: arm64-apple-macosx
SAVI_SYS_ROOT: /tmp/x-macosx/root
- if: >
inputs.x86_64-unknown-windows-msvc == 'true'
|| inputs.all-platforms == 'true'
run: ${{ inputs.build-command }}
shell: bash
env:
dir: ${{ steps.setup.outputs.directory }}
manifest_name: ${{ inputs.manifest-name }}
tarball_name: ${{ inputs.tarball-name }}
target: x86_64-unknown-windows-msvc
SAVI_SYS_ROOT: /tmp/x-windows/root
- run: ls -la ${{ steps.setup.outputs.directory }}/publish
shell: bash