-
Notifications
You must be signed in to change notification settings - Fork 756
239 lines (208 loc) · 7.29 KB
/
create_release.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
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
name: Create Release
# Trigger whenever a tag is created/updated
on:
push:
tags:
- "*"
permissions:
contents: write
jobs:
build:
name: build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest]
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: install ninja (macos)
run: brew install ninja
if: matrix.os == 'macos-latest'
- name: install ninja (win)
run: choco install ninja
if: matrix.os == 'windows-latest'
- name: mkdir
run: mkdir -p out
- name: cmake (macos)
run: |
cmake -S . -B out -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=out/install -DCMAKE_OSX_ARCHITECTURES=x86_64
cmake -S . -B out-arm64 -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=out-arm64/install -DCMAKE_OSX_ARCHITECTURES=arm64
if: matrix.os == 'macos-latest'
- name: cmake (win)
# -G "Visual Studio 15 2017"
run: cmake -S . -B out -DCMAKE_INSTALL_PREFIX=out/install
if: matrix.os == 'windows-latest'
- name: build
run: cmake --build out -v --config Release --target install
- name: build-arm64
run: cmake --build out-arm64 -v --config Release --target install
if: matrix.os == 'macos-latest'
- name: strip
run: find out*/install/ -type f -perm -u=x -exec strip -x {} +
if: matrix.os != 'windows-latest'
- name: archive
id: archive
run: |
OSNAME=$(echo ${{ matrix.os }} | sed 's/-latest//')
VERSION=$GITHUB_REF_NAME
PKGNAME="binaryen-$VERSION-x86_64-$OSNAME"
TARBALL=$PKGNAME.tar.gz
SHASUM=$PKGNAME.tar.gz.sha256
rm -rf binaryen-$VERSION
mv out/install binaryen-$VERSION
tar -czf $TARBALL binaryen-$VERSION
# on Windows, MSYS2 will strip the carriage return from CMake output
cmake -E sha256sum $TARBALL > $SHASUM
echo "::set-output name=tarball::$TARBALL"
echo "::set-output name=shasum::$SHASUM"
- name: archive-arm64
id: archive-arm64
run: |
OSNAME=$(echo ${{ matrix.os }} | sed 's/-latest//')
VERSION=$GITHUB_REF_NAME
PKGNAME="binaryen-$VERSION-arm64-$OSNAME"
TARBALL=$PKGNAME.tar.gz
SHASUM=$PKGNAME.tar.gz.sha256
rm -rf binaryen-$VERSION
mv out-arm64/install binaryen-$VERSION
tar -czf $TARBALL binaryen-$VERSION
# on Windows, MSYS2 will strip the carriage return from CMake output
cmake -E sha256sum $TARBALL > $SHASUM
echo "::set-output name=tarball::$TARBALL"
echo "::set-output name=shasum::$SHASUM"
if: matrix.os == 'macos-latest'
- name: upload tarball
uses: softprops/action-gh-release@v1
with:
draft: true
files: |
${{ steps.archive.outputs.tarball }}
${{ steps.archive.outputs.shasum }}
${{ steps.archive-arm64.outputs.tarball }}
${{ steps.archive-arm64.outputs.shasum }}
# Build with gcc 6.3 and run tests on Alpine Linux (inside chroot).
# Note: Alpine uses musl libc.
build-alpine:
name: alpine
runs-on: ubuntu-latest
strategy:
matrix:
docker_platform: [amd64, arm64]
steps:
- uses: actions/setup-python@v1
with:
python-version: '3.x'
- uses: actions/checkout@v1
with:
submodules: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
if: matrix.docker_platform != 'amd64'
- name: start docker
run: |
docker run -w /src -dit --platform=linux/${{ matrix.docker_platform }} --name alpine -v $PWD:/src node:lts-alpine
echo 'docker exec alpine "$@";' > ./alpine.sh
chmod +x ./alpine.sh
- name: install packages
run: |
./alpine.sh apk update
./alpine.sh apk add build-base cmake git python3 clang ninja py3-pip
- name: avoid d8 tests (jsvu is not compatible with alpine)
run: |
./alpine.sh rm -Rf test/lit/d8
- name: install python dev dependencies
run: ./alpine.sh pip3 install --break-system-packages -r requirements-dev.txt
- name: cmake
run: |
./alpine.sh cmake . -G Ninja -DCMAKE_CXX_FLAGS="-static" -DCMAKE_C_FLAGS="-static" -DCMAKE_BUILD_TYPE=Release -DBUILD_STATIC_LIB=ON -DCMAKE_INSTALL_PREFIX=install
- name: build
run: |
./alpine.sh ninja install
- name: test
run: ./alpine.sh python3 ./check.py
- name: archive
id: archive
run: |
VERSION=$GITHUB_REF_NAME
ARCH=$(./alpine.sh uname -m)
PKGNAME="binaryen-$VERSION-$ARCH-linux"
TARBALL=$PKGNAME.tar.gz
SHASUM=$PKGNAME.tar.gz.sha256
./alpine.sh find install/ -type f -perm -u=x -exec strip {} +
mv install binaryen-$VERSION
tar -czf $TARBALL binaryen-$VERSION
cmake -E sha256sum $TARBALL > $SHASUM
echo "::set-output name=tarball::$TARBALL"
echo "::set-output name=shasum::$SHASUM"
- name: upload tarball
uses: softprops/action-gh-release@v1
with:
draft: true
files: |
${{ steps.archive.outputs.tarball }}
${{ steps.archive.outputs.shasum }}
# Build using Emscripten to JavaScript+WebAssembly.
build-node:
name: node
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- uses: actions/setup-python@v1
with:
python-version: '3.x'
- uses: actions/checkout@v1
with:
submodules: true
- name: install ninja
run: sudo apt-get install ninja-build
- name: emsdk install
run: |
mkdir $HOME/emsdk
git clone --depth 1 https://github.com/emscripten-core/emsdk.git $HOME/emsdk
$HOME/emsdk/emsdk update-tags
$HOME/emsdk/emsdk install tot
$HOME/emsdk/emsdk activate tot
- name: update path
run: echo "PATH=$PATH:$HOME/emsdk" >> $GITHUB_ENV
# Configure with wasm EH and pthreads for maximal performance.
- name: cmake
run: |
source $HOME/emsdk/emsdk_env.sh
emcmake cmake -S . -B out -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=out/install -DEMSCRIPTEN_ENABLE_WASM_EH=ON -DEMSCRIPTEN_ENABLE_PTHREADS=ON
# Build wasm-opt for now TODO add other tools as desired
- name: build
run: ninja -C out wasm-opt
# Minimal smoke test: roundtrip a file.
# TODO: Add more testing here, but the full test suite is overkill as there
# is a 0.5 second cost to each run of wasm-opt.js
- name: test
run: |
node out/bin/wasm-opt.js test/hello_world.wat --print > out/t.wat
diff test/hello_world.wat out/t.wat
- name: archive
id: archive
run: |
VERSION=$GITHUB_REF_NAME
PKGNAME="binaryen-$VERSION-node"
TARBALL=$PKGNAME.tar.gz
SHASUM=$PKGNAME.tar.gz.sha256
mkdir binaryen-$VERSION
cp out/bin/wasm-opt* binaryen-$VERSION/
tar -czf $TARBALL binaryen-$VERSION
cmake -E sha256sum $TARBALL > $SHASUM
echo "::set-output name=tarball::$TARBALL"
echo "::set-output name=shasum::$SHASUM"
- name: upload tarball
uses: softprops/action-gh-release@v1
with:
draft: true
files: |
${{ steps.archive.outputs.tarball }}
${{ steps.archive.outputs.shasum }}