-
Notifications
You must be signed in to change notification settings - Fork 107
183 lines (158 loc) · 4.72 KB
/
wasm-build.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
#
# Copyright 2023 Paul Guyot <[email protected]>
#
# SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
#
name: Wasm Build
on:
push:
paths:
- '.github/workflows/**'
- 'CMakeLists.txt'
- 'libs/**'
- 'src/platforms/emscripten/**'
- 'src/libAtomVM/**'
pull_request:
paths:
- '.github/workflows/**'
- 'CMakeLists.txt'
- 'libs/**'
- 'src/platforms/emscripten/**'
- 'src/libAtomVM/**'
env:
otp_version: 24
elixir_version: 1.14
jobs:
compile_tests:
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ env.otp_version }}
elixir-version: ${{ env.elixir_version }}
- name: apt update
run: sudo apt update
- name: Install required packages
run: sudo apt install -y gperf zlib1g-dev ninja-build
- name: Compile AtomVM and test modules
run: |
set -e
mkdir build
cd build
cmake .. -G Ninja
ninja AtomVM atomvmlib test_eavmlib test_alisp hello_world run_script call_cast html5_events wasm_webserver
- name: Upload AtomVM and test modules
uses: actions/upload-artifact@v3
with:
name: atomvm-and-test-modules
path: |
build/**/*.avm
build/**/*.beam
build/src/AtomVM
retention-days: 1
- name: Compile emscripten test modules
run: |
set -e
cd src/platforms/emscripten
mkdir -p build/tests/src/
cd build/tests/src
cmake ../../../tests/src -G Ninja
ninja emscripten_erlang_test_modules
- name: Upload emscripten test modules
uses: actions/upload-artifact@v3
with:
name: emscripten-test-modules
path: |
src/platforms/emscripten/build/**/*.beam
retention-days: 1
wasm_build_and_test_node:
needs: compile_tests
runs-on: ubuntu-latest
container: emscripten/emsdk
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: "Install deps"
run: sudo apt update -y && sudo apt install -y cmake gperf
- name: Build
shell: bash
working-directory: ./src/platforms/emscripten/
run: |
set -euo pipefail
mkdir build
cd build
emcmake cmake ..
emmake make -j
- name: Download AtomVM and test modules
uses: actions/download-artifact@v3
with:
name: atomvm-and-test-modules
path: build
- name: Test
shell: bash
working-directory: ./src/platforms/emscripten/build
run: |
set -euxo pipefail
# Test compressed beams
node src/AtomVM.js ../../../../build/examples/erlang/hello_world.beam ../../../../build/libs/eavmlib/src/eavmlib.avm
# Run tests that pass
node src/AtomVM.js ../../../../build/tests/libs/alisp/test_alisp.avm
node src/AtomVM.js ../../../../build/tests/libs/eavmlib/test_eavmlib.avm
wasm_build_web:
runs-on: ubuntu-latest
container: emscripten/emsdk
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: "Install deps"
run: sudo apt update -y && sudo apt install -y cmake gperf
- name: Build wasm build for web
shell: bash
working-directory: ./src/platforms/emscripten/
run: |
set -euo pipefail
mkdir build
cd build
emcmake cmake .. -DAVM_EMSCRIPTEN_ENV=web
emmake make -j
- name: Upload wasm build for web
uses: actions/upload-artifact@v3
with:
name: atomvm-js-web
path: |
src/platforms/emscripten/build/**/*.wasm
src/platforms/emscripten/build/**/*.js
retention-days: 1
wasm_test_web:
needs: [compile_tests, wasm_build_web]
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Download AtomVM and test modules
uses: actions/download-artifact@v3
with:
name: atomvm-and-test-modules
path: build
- name: Download wasm build for web
uses: actions/download-artifact@v3
with:
name: atomvm-js-web
path: src/platforms/emscripten/build
- name: Download emscripten test modules
uses: actions/download-artifact@v3
with:
name: emscripten-test-modules
path: src/platforms/emscripten/build
- name: Test using cypress
shell: bash
run: |
set -euxo pipefail
cd build
chmod +x ./src/AtomVM
./src/AtomVM examples/emscripten/wasm_webserver.avm &
cd ../src/platforms/emscripten/tests/
docker run --network host -v $PWD:/mnt -w /mnt cypress/included:12.17.1 --browser chrome
killall AtomVM