Skip to content

Commit 3fe7ab2

Browse files
committed
simplify & improve tooling
1 parent 8b783a5 commit 3fe7ab2

72 files changed

Lines changed: 4895 additions & 1105 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 285 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,285 @@
1+
on: push
2+
3+
permissions:
4+
contents: read
5+
pages: write
6+
id-token: write
7+
8+
# TODO: codegen before each step
9+
# TODO: publish dockers automatically (so they have up-to-date headers)
10+
# TODO: should I provide "sdk" releases for each cart-type?
11+
12+
jobs:
13+
# TODO: seperate these into different steps and remove matrix?
14+
host_linux:
15+
strategy:
16+
matrix:
17+
include:
18+
- arch: x86_64
19+
os: ubuntu-latest
20+
- arch: arm64
21+
os: ubuntu-24.04-arm64
22+
runs-on: ${{ matrix.os }}
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
- name: Build Linux Host (x86_64)
28+
if: matrix.container == false && matrix.arch == 'x86_64'
29+
run: |
30+
sudo apt-get update
31+
sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev libwayland-dev libwayland-bin libxkbcommon-dev zip
32+
cmake -B build -DCMAKE_BUILD_TYPE=Release
33+
cmake --build build --target host
34+
cd build/host
35+
zip ../../null0_linux_x86-64.zip null0
36+
- name: Upload Linux Host (x86_64) artifact
37+
if: matrix.container == false && matrix.arch == 'x86_64'
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: null0_host_linux_x86-64
41+
path: null0_linux_x86-64.zip
42+
43+
- name: Build Linux Hosts (arm64) - X11/Wayland and DRM
44+
if: matrix.container == false && matrix.arch == 'arm64'
45+
run: |
46+
sudo apt-get update
47+
sudo apt-get install -y --no-install-recommends curl git pkg-config cmake build-essential ninja-build zip \
48+
libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev libwayland-dev libwayland-bin libxkbcommon-dev \
49+
libdrm-dev libgbm-dev libegl1-mesa-dev libgles2-mesa-dev libasound2-dev libudev-dev libinput-dev clang
50+
# Regular (desktop) build
51+
cmake -B build_desktop -G Ninja -DCMAKE_BUILD_TYPE=Release \
52+
-DWAMR_BUILD_SIMD=0 -DWAMR_BUILD_INVOKE_NATIVE_GENERAL=1 \
53+
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \
54+
-DCMAKE_C_FLAGS="-Wno-unknown-warning-option -Wno-unused-command-line-argument" \
55+
-DCMAKE_CXX_FLAGS="-Wno-unknown-warning-option -Wno-unused-command-line-argument"
56+
cmake --build build_desktop --target host
57+
(cd build_desktop/host && zip ../../null0_linux_arm64.zip null0)
58+
# DRM build
59+
cmake -B build_drm -G Ninja -DCMAKE_BUILD_TYPE=Release \
60+
-DPLATFORM=DRM -DGRAPHICS=GRAPHICS_API_OPENGL_ES2 \
61+
-DWAMR_BUILD_SIMD=0 -DWAMR_BUILD_INVOKE_NATIVE_GENERAL=1 \
62+
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \
63+
-DCMAKE_C_FLAGS="-Wno-unknown-warning-option -Wno-unused-command-line-argument" \
64+
-DCMAKE_CXX_FLAGS="-Wno-unknown-warning-option -Wno-unused-command-line-argument"
65+
cmake --build build_drm --target host
66+
(cd build_drm/host && zip ../../null0_linux_drm_arm64.zip null0)
67+
- name: Upload Linux Hosts (arm64) artifact
68+
if: matrix.container == false && matrix.arch == 'arm64'
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: null0_host_linux_arm64
72+
path: null0_linux_arm64.zip
73+
- name: Upload Linux Hosts (drm_arm64) artifact
74+
if: matrix.container == false && matrix.arch == 'arm64'
75+
uses: actions/upload-artifact@v4
76+
with:
77+
name: null0_host_linux_drm_arm64
78+
path: null0_linux_drm_arm64.zip
79+
80+
host_mac:
81+
runs-on: macos-14
82+
steps:
83+
- name: Checkout
84+
uses: actions/checkout@v4
85+
- name: Build arm64
86+
run: |
87+
cmake -B build_arm64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 -DWAMR_BUILD_SIMD=0 -DWAMR_BUILD_INVOKE_NATIVE_GENERAL=1
88+
cmake --build build_arm64 --target host
89+
- name: Build x86_64
90+
run: |
91+
cmake -B build_x86_64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 -DWAMR_BUILD_SIMD=0 -DWAMR_BUILD_INVOKE_NATIVE_GENERAL=1
92+
cmake --build build_x86_64 --target host
93+
- name: Create universal binary
94+
run: |
95+
mkdir -p build_universal
96+
lipo -create build_x86_64/host/null0 build_arm64/host/null0 -output build_universal/null0
97+
chmod +x build_universal/null0
98+
cd build_universal
99+
zip ../null0_macos.zip null0
100+
- name: Upload Mac Host artifact
101+
uses: actions/upload-artifact@v4
102+
with:
103+
name: null0_host_mac
104+
path: null0_macos.zip
105+
106+
host_windows:
107+
runs-on: windows-latest
108+
steps:
109+
- name: Checkout
110+
uses: actions/checkout@v4
111+
- name: Setup MSVC
112+
uses: ilammy/msvc-dev-cmd@v1
113+
with:
114+
arch: x64
115+
- name: Build Native Windows Host (x64)
116+
run: |
117+
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DWAMR_BUILD_SIMD=0 -DWAMR_BUILD_INVOKE_NATIVE_GENERAL=1
118+
cmake --build build --target host
119+
cd build/host
120+
Compress-Archive -Path null0.exe -DestinationPath ../../null0_windows_x64.zip
121+
shell: pwsh
122+
- name: Upload Windows Host artifact
123+
uses: actions/upload-artifact@v4
124+
with:
125+
name: null0_host_windows
126+
path: null0_windows_x64.zip
127+
128+
host_web:
129+
runs-on: windows-latest
130+
steps:
131+
- name: Checkout
132+
uses: actions/checkout@v4
133+
- name: Install emscripten
134+
uses: mymindstorm/setup-emsdk@v14
135+
with:
136+
version: 'latest'
137+
- name: Build Web Host
138+
run: npm run build:web
139+
- name: Upload Web Host artifact
140+
uses: actions/upload-artifact@v4
141+
with:
142+
name: null0_host_web
143+
path: wbuild/host/null0.mjs
144+
145+
cart_c:
146+
name: C Carts
147+
runs-on: ubuntu-latest
148+
strategy:
149+
matrix:
150+
cart:
151+
- colorbars
152+
- example
153+
- gradient
154+
- input
155+
- sfx
156+
- speak
157+
- wasi_demo
158+
steps:
159+
- name: Checkout
160+
uses: actions/checkout@v4
161+
- name: Build C ${{ matrix.cart }} cart
162+
run: docker run -v ./carts/c/${{ matrix.cart }}:/src -v .:/out konsumer/null0-cart-c ${{ matrix.cart }}_c
163+
- name: Upload C ${{ matrix.cart }} cart artifact
164+
uses: actions/upload-artifact@v4
165+
with:
166+
name: ${{ matrix.cart }}_c
167+
path: ${{ matrix.cart }}_c.null0
168+
169+
cart_js:
170+
name: JS Carts
171+
runs-on: ubuntu-latest
172+
strategy:
173+
matrix:
174+
cart:
175+
- demo
176+
- input
177+
steps:
178+
- name: Checkout
179+
uses: actions/checkout@v4
180+
- name: Build JS ${{ matrix.cart }} cart
181+
run: docker run -v ./carts/js/${{ matrix.cart }}:/src -v .:/out konsumer/null0-cart-quickjs ${{ matrix.cart }}_js
182+
- name: Upload JS ${{ matrix.cart }} cart artifact
183+
uses: actions/upload-artifact@v4
184+
with:
185+
name: ${{ matrix.cart }}_js
186+
path: ${{ matrix.cart }}_js.null0
187+
188+
cart_as:
189+
name: Assemblyscript Carts
190+
runs-on: ubuntu-latest
191+
strategy:
192+
matrix:
193+
cart:
194+
- simple
195+
steps:
196+
- name: Checkout
197+
uses: actions/checkout@v4
198+
- name: Build Assemblyscript ${{ matrix.cart }} cart
199+
run: docker run -v ./carts/as/${{ matrix.cart }}:/src -v .:/out konsumer/null0-cart-assemblyscript ${{ matrix.cart }}_as
200+
- name: Upload Assemblyscript ${{ matrix.cart }} cart artifact
201+
uses: actions/upload-artifact@v4
202+
with:
203+
name: ${{ matrix.cart }}_as
204+
path: ${{ matrix.cart }}_as.null0
205+
206+
cart_nelua:
207+
name: Nelua Carts
208+
runs-on: ubuntu-latest
209+
strategy:
210+
matrix:
211+
cart:
212+
- basic
213+
- colorbars
214+
steps:
215+
- name: Checkout
216+
uses: actions/checkout@v4
217+
- name: Build Nelua ${{ matrix.cart }} cart
218+
run: docker run -v ./carts/nelua/${{ matrix.cart }}:/src -v .:/out konsumer/null0-cart-nelua ${{ matrix.cart }}_nelua
219+
- name: Upload Nelua ${{ matrix.cart }} cart artifact
220+
uses: actions/upload-artifact@v4
221+
with:
222+
name: ${{ matrix.cart }}_nelua
223+
path: ${{ matrix.cart }}_nelua.null0
224+
225+
# cart_nim:
226+
# name: Nim Carts
227+
# runs-on: ubuntu-latest
228+
# strategy:
229+
# matrix:
230+
# cart:
231+
# - simple
232+
# steps:
233+
# - name: Checkout
234+
# uses: actions/checkout@v4
235+
# - name: Build Nim ${{ matrix.cart }} cart
236+
# run: docker run -v ./carts/nim/${{ matrix.cart }}:/src -v .:/out konsumer/null0-cart-nim ${{ matrix.cart }}_nim
237+
# - name: Upload Nim ${{ matrix.cart }} cart artifact
238+
# uses: actions/upload-artifact@v4
239+
# with:
240+
# name: ${{ matrix.cart }}_nim
241+
# path: ${{ matrix.cart }}_nim.null0
242+
243+
# this creates a release on any tag, and attaches all the artifacts to it, then uploads demo page
244+
release:
245+
name: Release Tag
246+
runs-on: ubuntu-latest
247+
if: github.ref_type == 'tag'
248+
needs:
249+
- cart_c
250+
- cart_js
251+
- cart_as
252+
- cart_nelua
253+
- host_linux
254+
- host_mac
255+
- host_windows
256+
- host_web
257+
steps:
258+
- name: Checkout
259+
uses: actions/checkout@v4
260+
- name: Download all artifacts
261+
uses: actions/download-artifact@v4
262+
with:
263+
path: artifacts
264+
- run: ls -al artifacts
265+
- name: Create Release and Upload Assets
266+
uses: softprops/action-gh-release@v2
267+
with:
268+
files: artifacts/**/*
269+
- name: Setup website
270+
run: |
271+
cd webroot
272+
mv ../artifacts/null0.mjs .
273+
mkdir -p carts
274+
mv ../artifacts/**/*.null0 carts/
275+
cd carts
276+
ls *.null0 > list.txt
277+
- name: Setup Pages
278+
uses: actions/configure-pages@v5
279+
- name: Upload Pages
280+
uses: actions/upload-pages-artifact@v3
281+
with:
282+
path: 'webroot'
283+
- name: Deploy to GitHub Pages
284+
id: deployment
285+
uses: actions/deploy-pages@v4

.github/workflows/release_js.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)