-
Notifications
You must be signed in to change notification settings - Fork 202
248 lines (204 loc) · 7.95 KB
/
build.yml
File metadata and controls
248 lines (204 loc) · 7.95 KB
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
name: Build
on: [push, pull_request]
jobs:
build-native-runtime:
strategy:
fail-fast: false
matrix:
config:
- os: windows-latest
artifact: "windows"
wasm4: bin/wasm4.exe
libretro: lib/wasm4_libretro.dll
- os: macos-latest
artifact: "mac"
wasm4: bin/wasm4
libretro: lib/wasm4_libretro.dylib
- os: ubuntu-latest
artifact: "linux"
wasm4: bin/wasm4
libretro: lib/wasm4_libretro.so
wasm_backend:
- wasm3
- toywasm
name: Build ${{ matrix.config.artifact }}
runs-on: ${{ matrix.config.os }}
defaults:
run:
working-directory: runtimes/native
steps:
- uses: actions/checkout@v2
with:
submodules: true
- if: matrix.config.os == 'ubuntu-latest'
name: Install local dependencies
run: |
ldd --version
sudo apt update
sudo apt install libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev libxkbcommon-dev libasound2-dev libpulse-dev libwayland-dev
- name: Build
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Release -DWASM_BACKEND=${{ matrix.wasm_backend }} -DWINDOW_BACKEND=glfw -DGLFW_BUILD_WAYLAND=ON -DGLFW_BUILD_X11=ON
cmake --build build --config Release --parallel
- name: Install
run: cmake --install build --prefix instdir --config Release --strip || true
- name: Upload wasm4 artifact
uses: actions/upload-artifact@v4.4.0
with:
path: runtimes/native/instdir/${{ matrix.config.wasm4 }}
name: wasm4-${{ matrix.wasm_backend }}-${{ matrix.config.artifact }}
- name: Upload libretro artifact
uses: actions/upload-artifact@v4.4.0
with:
path: runtimes/native/instdir/${{ matrix.config.libretro }}
name: wasm4-libretro-${{ matrix.wasm_backend }}-${{ matrix.config.artifact }}
build-cli:
name: Build w4 CLI
runs-on: ubuntu-latest
needs: build-native-runtime
defaults:
run:
working-directory: cli
steps:
- uses: actions/checkout@v2
- name: Build web-devtools
working-directory: devtools/web
run: |
npm ci
- name: Build web runtime
working-directory: runtimes/web
run: |
npm ci
npm run build
- name: Import web runtime
run: |
rm -f assets/runtime
cp -r ../runtimes/web/dist assets/runtime
- name: Download artifacts
uses: actions/download-artifact@v4.1.8
with:
path: artifacts
- name: Import native runtimes
run: |
mkdir -p assets/natives
ls -R ../artifacts
mv ../artifacts/wasm4-wasm3-windows/wasm4.exe assets/natives/wasm4-windows.exe
mv ../artifacts/wasm4-wasm3-mac/wasm4 assets/natives/wasm4-mac
mv ../artifacts/wasm4-wasm3-linux/wasm4 assets/natives/wasm4-linux
chmod +x assets/natives/wasm4-*
- name: Test CLI
run: |
npm ci
npm test
- name: Build CLI
run: |
cp ../README.md ../LICENSE.txt .
mkdir -p ../cli-build
mv `npm pack` ../cli-build/wasm4-npm.tar.gz
npm ci
npm run package
- name: Quick w4 CLI tests
run: |
W4=../cli-build/wasm4-linux
$W4 --help
$W4 --version
$W4 new --c /tmp/test-w4
$W4 png2src --c ../site/static/img/bunny.png
$W4 bundle ../site/static/carts/watris.wasm \
--html /tmp/test-w4/cart.html \
--linux /tmp/test-w4/cart-linux \
--windows /tmp/test-w4/cart-windows.exe \
--mac /tmp/test-w4/cart-mac \
- name: Upload artifacts
uses: actions/upload-artifact@v4.4.0
with:
path: cli-build
name: w4
build-site:
name: Build website
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Build web devtools
working-directory: devtools/web
run: npm ci
- name: Build web runtime
working-directory: runtimes/web
run: |
npm ci
npm run build
- name: Build site
working-directory: site
run: |
rm -rf static/embed
cp -r ../runtimes/web/dist/slim static/embed
npm ci
npm run build
env:
NODE_OPTIONS: --openssl-legacy-provider
- name: Add CNAME for custom domain
run: echo "wasm4.org" > site/build/CNAME
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: site/build
deploy-site:
name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
needs: build-site
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
release:
if: startsWith(github.ref, 'refs/tags/v')
name: Release
runs-on: ubuntu-latest
needs: build-cli
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Download artifacts
uses: actions/download-artifact@v4.1.8
with:
path: artifacts
name: w4
- name: Create release zips
run: |
chmod +x artifacts/wasm4-*
mv artifacts/wasm4-win.exe w4.exe
zip w4-windows.zip w4.exe
mv artifacts/wasm4-macos w4
zip w4-mac.zip w4
mv artifacts/wasm4-linux w4
zip w4-linux.zip w4
- name: Publish GitHub release
uses: softprops/action-gh-release@v1
with:
files: w4-*.zip
- name: Publish to NPM
run: |
npm config set //registry.npmjs.org/:_authToken=$NPM_TOKEN
npm publish ./artifacts/wasm4-npm.tar.gz
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish to the Internet Archive
run: |
sudo apt update
sudo apt install internetarchive
version=`git describe --tags`
git ls-files --recurse-submodules | tar caf "/tmp/wasm4-$version.tar.gz" --xform "s:^:wasm4-$version/:" --verbatim-files-from -T-
ia configure --username="b@aduros.com" --password="$IA_PASSWORD"
ia upload wasm4-source "/tmp/wasm4-$version.tar.gz"
env:
IA_PASSWORD: ${{ secrets.IA_PASSWORD }}