forked from wasmerio/wasmer
-
Notifications
You must be signed in to change notification settings - Fork 0
290 lines (284 loc) · 10.5 KB
/
test-sys.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
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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
name: Runtime tests
env:
RUST_BACKTRACE: 1
on:
workflow_dispatch:
push:
branches:
- 'master'
- 'staging'
- 'trying'
paths:
- 'lib/**'
tags:
# this is _not_ a regex, see: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
- '[0-9]+.[0-9]+.[0-9]+*'
pull_request:
paths:
- 'lib/**'
jobs:
setup:
name: Set up
runs-on: ubuntu-latest
outputs:
VERSION: ${{ steps.setup.outputs.VERSION }}
DOING_RELEASE: ${{ steps.setup.outputs.DOING_RELEASE }}
steps:
- name: Set up env vars
id: setup
shell: bash
run: |
VERSION=${GITHUB_REF/refs\/tags\//}
echo ::set-output name=VERSION::${VERSION}
DOING_RELEASE=$(echo $VERSION | grep -c '^[0-9]\+\.[0-9]\+\.[0-9]\+\(-\([a-zA-Z]\+\)\?[0-9]*\)\?$' || true)
echo ::set-output name=DOING_RELEASE::${DOING_RELEASE}
echo $VERSION
echo $DOING_RELEASE
test:
name: Test on ${{ matrix.build }}
runs-on: ${{ matrix.os }}
needs: setup
strategy:
fail-fast: false
matrix:
include:
- build: linux-x64
os: ubuntu-18.04
target: x86_64-unknown-linux-gnu
llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/clang+llvm-13.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz'
run_test: true
run_test_capi: true
run_integration_tests: true
run_build_docs: true
use_sccache: true
- build: macos-x64
os: macos-11
target: x86_64-apple-darwin
llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/clang+llvm-13.0.0-x86_64-apple-darwin.tar.xz'
run_test: true
run_test_capi: true
use_sccache: true
run_integration_tests: true
run_ios_tests: true
run_build_docs: false
- build: macos-arm64
os: macos-11.0
target: aarch64-apple-darwin
use_sccache: true
run_test: false
run_test_capi: false
run_build_docs: false
- build: windows-x64
os: windows-2019
#target: x86_64-pc-windows-msvc commented because of bug in rust setup action
# llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/12.x/windows-amd64.tar.gz'
llvm_choco_version: 13.0.0
run_integration_tests: true
use_sccache: true
run_test: true
run_test_capi: false # We can't run yet the capi tests on Windows
run_build_docs: false
- build: linux-musl-x64
target: x86_64-unknown-linux-musl
os: ubuntu-latest
container: alpine:latest
run_test: true
run_test_capi: false # It can't run the capi tests because of a cc linker issue (`wasm_engine_new` is redefined)
run_integration_tests: false
run_build_docs: false
use_sccache: false
container: ${{ matrix.container }}
env:
SCCACHE_AZURE_BLOB_CONTAINER: wasmerstoragesccacheblob
SCCACHE_AZURE_CONNECTION_STRING: ${{ secrets.SCCACHE_AZURE_CONNECTION_STRING }}
steps:
- uses: actions/checkout@v3
- uses: goto-bus-stop/setup-zig@v2
with:
version: 0.10.0
- name: Set up libstdc++ on Linux
if: matrix.build == 'linux-x64'
run: |
sudo apt-get update -y
sudo apt-get install -y --allow-downgrades libstdc++6=8.4.0-1ubuntu1~18.04
sudo apt-get install --reinstall g++-8
- name: Set up base deps on musl
if: matrix.build == 'linux-musl-x64'
run: |
apk add build-base bash musl-dev curl make libtool libffi-dev gcc automake autoconf git openssl-dev g++
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.63
target: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v1
if: matrix.use_sccache != true
- name: Install LLVM (Choco - Windows)
if: matrix.llvm_choco_version
shell: bash
run: |
choco install llvm --version ${{ matrix.llvm_choco_version }} --allow-downgrade
cd 'C:\Program Files\LLVM\'
LLVM_DIR=$(pwd)
echo "LLVM_SYS_120_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV
- name: Install LLVM (macOS Apple Silicon)
if: matrix.os == 'macos-11.0' && !matrix.llvm_url
run: |
brew install llvm
- name: Install LLVM
if: matrix.llvm_url
shell: bash
run: |
curl --proto '=https' --tlsv1.2 -sSf ${{ matrix.llvm_url }} -L -o llvm.tar.xz
LLVM_DIR=$(pwd)/${{ env.LLVM_DIR }}
mkdir ${LLVM_DIR}
tar xf llvm.tar.xz --strip-components=1 -C ${LLVM_DIR}
echo "${LLVM_DIR}/bin" >> $GITHUB_PATH
echo "LLVM_SYS_120_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV
env:
LLVM_DIR: .llvm
- name: Set up dependencies for Mac OS
run: |
brew install automake
# using gnu-tar is a workaround for https://github.com/actions/cache/issues/403
brew install gnu-tar
echo PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH" >> $GITHUB_ENV
if: matrix.os == 'macos-latest' || matrix.os == 'macos-11.0'
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ matrix.build }}-${{ matrix.target }}-cargo-${{ hashFiles('Cargo.lock') }}-v1
- uses: actions/cache@v2
if: matrix.use_sccache
with:
path: ${{ runner.tool_cache }}/cargo-sccache
key: ${{ matrix.build }}-${{ matrix.target }}-sccache-bin-${{ env.CARGO_SCCACHE_VERSION }}-v1
- name: Install sccache
if: matrix.use_sccache
run: |
if [ ! -f '${{ runner.tool_cache }}/cargo-sccache/bin/sccache' ]; then
cargo install sccache --no-default-features --features=dist-client,azure --root '${{ runner.tool_cache }}/cargo-sccache'
fi
shell: bash
- name: Setup Rust target
run: |
mkdir -p .cargo
cat << EOF > .cargo/config.toml
[build]
target = "${{ matrix.target }}"
EOF
if: matrix.target
- name: Set sccache port
if: matrix.use_sccache && matrix.random_sccache_port
run: |
netstat -aln | awk '
$6 == "LISTEN" {
if ($4 ~ "[.:][0-9]+$") {
n = split($4, a, /[:.]/);
port = a[n];
p[port] = 1
}
}
END {
for (i = 3000; i < 65000 && p[i]; i++){};
if (i == 65000) {exit 1};
print "SCCACHE_SERVER_PORT=" i
}
' >> $GITHUB_ENV
# echo "SCCACHE_SERVER_PORT=9000"
echo "Setting random sccache port to: $SCCACHE_SERVER_PORT"
shell: bash
- name: Start sccache
if: matrix.use_sccache
run: |
chmod +x '${{ runner.tool_cache }}/cargo-sccache/bin/sccache'
'${{ runner.tool_cache }}/cargo-sccache/bin/sccache' --start-server
'${{ runner.tool_cache }}/cargo-sccache/bin/sccache' -s
echo 'RUSTC_WRAPPER=${{ runner.tool_cache }}/cargo-sccache/bin/sccache' >> $GITHUB_ENV
shell: bash
- name: Test integration CLI
if: matrix.run_test && matrix.os != 'windows-2019'
shell: bash
run: |
make build-wasmer && make build-capi && make package-capi && make package && export WASMER_DIR=`pwd`/package && make test-integration-cli
env:
TARGET: ${{ matrix.target }}
TARGET_DIR: target/${{ matrix.target }}/release
CARGO_TARGET: --target ${{ matrix.target }}
WAPM_DEV_TOKEN: ${{ secrets.WAPM_DEV_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#- name: Test integration CLI
# if: matrix.run_test && matrix.os == 'windows-2019'
# shell: bash
# run: |
# make && make build-wasmer && make build-capi && make package-capi && make package
# export WASMER_DIR=`pwd`/package
# make test-integration-cli
# env:
# TARGET: x86_64-pc-windows-msvc
# TARGET_DIR: target/x86_64-pc-windows-msvc/release
# CARGO_TARGET: --target x86_64-pc-windows-msvc
- name: Test
if: matrix.run_test && matrix.os != 'windows-2019'
run: |
make
env:
TARGET: ${{ matrix.target }}
TARGET_DIR: target/${{ matrix.target }}/release
CARGO_TARGET: --target ${{ matrix.target }}
- name: Test
if: matrix.run_test && matrix.os != 'windows-2019'
run: |
make build-capi && make package-capi && export WASMER_DIR=`pwd`/package && make test
env:
TARGET: ${{ matrix.target }}
TARGET_DIR: target/${{ matrix.target }}/release
CARGO_TARGET: --target ${{ matrix.target }}
- name: Test C API
if: matrix.run_test_capi && matrix.os != 'windows-2019'
run: |
make test-capi
env:
TARGET: ${{ matrix.target }}
TARGET_DIR: target/${{ matrix.target }}/release
CARGO_TARGET: --target ${{ matrix.target }}
- name: Test
if: matrix.run_test && matrix.os == 'windows-2019'
shell: bash
run: |
make build-capi && make package-capi && export WASMER_DIR=`pwd`/package && make test
- name: Test C API
if: matrix.run_test_capi && matrix.os == 'windows-2019'
shell: bash
run: |
export WASMER_DIR=`pwd`/package && make test-capi
- name: Build Doc
if: matrix.run_build_docs
run: |
make package-docs
audit:
name: Audit
env:
CARGO_AUDIT_VERSION: 0.16.0
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@master
with:
path: ${{ runner.tool_cache }}/cargo-audit
key: cargo-audit-bin-${{ env.CARGO_AUDIT_VERSION }}
- run: |
echo "'${{ runner.tool_cache }}/cargo-audit/bin'" >> $GITHUB_PATH
- run: |
cargo install cargo-audit --version ${{ env.CARGO_AUDIT_VERSION }} --root '${{ runner.tool_cache }}/cargo-audit'
cargo audit
test-wasm-build:
name: Test wasm build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
rustup target add wasm32-wasi
make build-wasmer-wasm