forked from guybedford/es-module-lexer
-
Notifications
You must be signed in to change notification settings - Fork 0
158 lines (139 loc) · 4.38 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
name: Test es-module-lexer
on:
push:
# Sequence of patterns matched against refs/heads
branches:
- 'feat/**'
- 'fix/**'
- 'main'
pull_request:
branches:
- 'main'
env:
WASI_VERSION: 12
WASI_VERSION_FULL: "12.0"
WABT_VERSION: "1.0.24"
EMCC_VERSION: "1.40.1-fastcomp"
jobs:
build:
runs-on: ${{ matrix.os }}
continue-on-error: true
strategy:
matrix:
os: [ubuntu-18.04, windows-2016, macos-10.15]
steps:
- name: Check out Git repository
uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Prepare
id: preparation
shell: bash
run: |
export PWD=$(pwd);
echo "::set-output name=PROJ_ROOT::$PWD";
npm install;
- name: Install wasi-sdk
shell: bash
if: runner.os != 'Windows'
env:
PROJ_ROOT: ${{ steps.preparation.outputs.PROJ_ROOT }}
run: |
cd $PROJ_ROOT;
cd ../;
if [[ "$RUNNER_OS" == "Linux" ]]; then
export WASI_OS="linux";
fi
if [[ "$RUNNER_OS" == "macOS" ]]; then
export WASI_OS="macos";
fi
curl -sL https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VERSION}/wasi-sdk-${WASI_VERSION_FULL}-${WASI_OS}.tar.gz -O
# check if package downloaded
ls -la
tar xvf wasi-sdk-${WASI_VERSION_FULL}-${WASI_OS}.tar.gz
# print clang version
./wasi-sdk-${WASI_VERSION_FULL}/bin/clang --version
- name: Install wabt
shell: bash
env:
PROJ_ROOT: ${{ steps.preparation.outputs.PROJ_ROOT }}
run: |
cd $PROJ_ROOT;
cd ../;
if [[ "$RUNNER_OS" == "Linux" ]]; then
export WABT_OS="ubuntu";
fi
if [[ "$RUNNER_OS" == "macOS" ]]; then
export WABT_OS="macos";
fi
if [[ "$RUNNER_OS" == "Windows" ]]; then
export WABT_OS="windows";
fi
curl -sL https://github.com/WebAssembly/wabt/releases/download/${WABT_VERSION}/wabt-${WABT_VERSION}-${WABT_OS}.tar.gz -O
# check if package downloaded
ls -la
tar xvf wabt-${WABT_VERSION}-${WABT_OS}.tar.gz
# check if wabt binaries installed
ls -la ./wabt-${WABT_VERSION}/bin/
- name: Add make.exe on Windows
if: runner.os == 'Windows'
shell: bash
env:
PROJ_ROOT: ${{ steps.preparation.outputs.PROJ_ROOT }}
run: |
# install make.exe
cd "C:/Program Files/Git/mingw64/"
if [ ! -e make.zip ]; then
curl -sL -o "make.zip" https://netix.dl.sourceforge.net/project/ezwinports/make-4.3-without-guile-w32-bin.zip
fi
unzip -n "make.zip"
cd $PROJ_ROOT;
# test if make valid
which make;
- name: Compile to Wasm & Test Wasm
shell: bash
env:
PROJ_ROOT: ${{ steps.preparation.outputs.PROJ_ROOT }}
run: |
cd $PROJ_ROOT;
make lib/lexer.wasm && npm run build:wasm;
# test
npm run test:wasm;
- name: Install Emscripten
id: emcc_steup
shell: bash
env:
PROJ_ROOT: ${{ steps.preparation.outputs.PROJ_ROOT }}
run: |
cd $PROJ_ROOT;
cd ../;
git clone https://github.com/emscripten-core/emsdk.git;
cd ./emsdk;
./emsdk install $EMCC_VERSION;
./emsdk activate $EMCC_VERSION;
EMCC_REPO=$(pwd);
echo "::set-output name=EMCC_REPO::$EMCC_REPO"
cd $PROJ_ROOT;
source $EMCC_REPO/emsdk_env.sh;
# check if emcc valid
emcc -v
- name: Benchmark
continue-on-error: false
shell: bash
env:
PROJ_ROOT: ${{ steps.preparation.outputs.PROJ_ROOT }}
run: |
cd $PROJ_ROOT;
npm run bench;
- name: Compile to Asm.js & Test Asm.js (Experimental)
continue-on-error: true
shell: bash
env:
PROJ_ROOT: ${{ steps.preparation.outputs.PROJ_ROOT }}
EMCC_REPO: ${{ steps.emcc_steup.outputs.EMCC_REPO }}
run: |
cd $PROJ_ROOT;
source $EMCC_REPO/emsdk_env.sh;
make lib/lexer.asm.js && npm run build:asm;
# test
npm run build:cjs && npm run test:js;