-
Notifications
You must be signed in to change notification settings - Fork 177
187 lines (157 loc) · 6.17 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
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
# glibc 2.31
- os: ubuntu-20.04
artifact: "linux"
wasm4: bin/wasm4
libretro: lib/wasm4_libretro.so
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-20.04'
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
- name: Build
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Release
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@v2
with:
path: runtimes/native/instdir/${{ matrix.config.wasm4 }}
name: wasm4-${{ matrix.config.artifact }}
- name: Upload libretro artifact
uses: actions/upload-artifact@v2
with:
path: runtimes/native/instdir/${{ matrix.config.libretro }}
name: wasm4-libretro-${{ 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@v2
with:
path: artifacts
- name: Import native runtimes
run: |
mkdir -p assets/natives
ls -R ../artifacts
mv ../artifacts/wasm4-windows/wasm4.exe assets/natives/wasm4-windows.exe
mv ../artifacts/wasm4-mac/wasm4 assets/natives/wasm4-mac
mv ../artifacts/wasm4-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@v2
with:
path: cli-build
name: w4
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@v2
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="[email protected]" --password="$IA_PASSWORD"
ia upload wasm4-source "/tmp/wasm4-$version.tar.gz"
env:
IA_PASSWORD: ${{ secrets.IA_PASSWORD }}