31
31
jobs :
32
32
33
33
format :
34
- runs-on : ubuntu-latest
34
+ runs-on : ubuntu-20.04
35
35
36
36
steps :
37
37
- uses : actions/checkout@v2
@@ -58,33 +58,136 @@ jobs:
58
58
addlicense -check .
59
59
60
60
build :
61
- name : build ( ${{ matrix.runtime }})
61
+ name : ${{ matrix.action }} with ${{ matrix.name }}
62
62
63
- runs-on : ubuntu-latest
63
+ runs-on : ${{ matrix.os }}
64
64
65
65
strategy :
66
66
fail-fast : false
67
67
matrix :
68
- runtime : ["wamr", "wasmtime", "wavm"]
68
+ include :
69
+ - name : ' V8 on Linux/x86_64'
70
+ runtime : ' v8'
71
+ repo : ' v8'
72
+ os : ubuntu-20.04
73
+ arch : x86_64
74
+ action : test
75
+ flags : ' --define crypto=system'
76
+ - name : ' V8 on macOS/x86_64'
77
+ runtime : ' v8'
78
+ repo : ' v8'
79
+ os : macos-11
80
+ arch : x86_64
81
+ action : test
82
+ - name : ' WAMR on Linux/x86_64'
83
+ runtime : ' wamr'
84
+ repo : ' com_github_bytecodealliance_wasm_micro_runtime'
85
+ os : ubuntu-20.04
86
+ arch : x86_64
87
+ action : test
88
+ - name : ' WAMR on macOS/x86_64'
89
+ runtime : ' wamr'
90
+ repo : ' com_github_bytecodealliance_wasm_micro_runtime'
91
+ os : macos-11
92
+ arch : x86_64
93
+ action : test
94
+ - name : ' Wasmtime on Linux/x86_64'
95
+ runtime : ' wasmtime'
96
+ repo : ' com_github_bytecodealliance_wasmtime'
97
+ os : ubuntu-20.04
98
+ arch : x86_64
99
+ action : test
100
+ - name : ' Wasmtime on Linux/aarch64'
101
+ runtime : ' wasmtime'
102
+ repo : ' com_github_bytecodealliance_wasmtime'
103
+ os : ubuntu-20.04
104
+ arch : aarch64
105
+ action : build
106
+ run_under : docker run --rm --env HOME=$HOME --env USER=$(id -un) --volume "$HOME:$HOME" --workdir $(pwd) --user $(id -u):$(id -g) --platform linux/arm64 piotrsikora/build-tools:bazel-5.0.0-clang-13-gcc-11
107
+ - name : ' Wasmtime on Linux/s390x'
108
+ runtime : ' wasmtime'
109
+ repo : ' com_github_bytecodealliance_wasmtime'
110
+ os : ubuntu-20.04
111
+ arch : s390x
112
+ action : build
113
+ run_under : docker run --rm --env HOME=$HOME --env USER=$(id -un) --volume "$HOME:$HOME" --workdir $(pwd) --user $(id -u):$(id -g) --platform linux/s390x piotrsikora/build-tools:bazel-5.0.0-clang-13-gcc-11
114
+ - name : ' Wasmtime on macOS/x86_64'
115
+ runtime : ' wasmtime'
116
+ repo : ' com_github_bytecodealliance_wasmtime'
117
+ os : macos-11
118
+ arch : x86_64
119
+ action : test
120
+ - name : ' WAVM on Linux/x86_64'
121
+ runtime : ' wavm'
122
+ repo : ' com_github_wavm_wavm'
123
+ os : ubuntu-20.04
124
+ arch : x86_64
125
+ action : test
69
126
70
127
steps :
71
128
- uses : actions/checkout@v2
72
129
73
- - name : Install dependency
74
- run : sudo apt-get install ninja-build
130
+ - name : Activate Docker/QEMU
131
+ if : startsWith(matrix.run_under, 'docker')
132
+ run : docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
75
133
76
- - name : Mount Bazel cache
134
+ - name : Set cache key
135
+ id : cache-key
136
+ run : echo "::set-output name=uniq::$(bazel query --output build //external:${{ matrix.repo }} | grep -E 'sha256|commit' | cut -d\" -f2)"
137
+
138
+ - name : Bazel cache
139
+ if : ${{ matrix.runtime != 'wasmtime' || startsWith(matrix.run_under, 'docker') }}
77
140
uses : actions/cache@v2
78
141
with :
79
142
path : |
80
143
~/.cache/bazel
81
- ~/.cache/bazelisk
82
- key : bazel-${{ matrix.runtime }}-${{ hashFiles('WORKSPACE', '.bazelrc', '.bazelversion', 'bazel/cargo/Cargo.raze.lock', 'bazel/dependencies.bzl', 'bazel/repositories.bzl') }}
83
-
84
- - name : Test
85
- run : |
86
- bazel test --define runtime=${{ matrix.runtime }} //test/...
87
-
88
- - name : Test (signed Wasm module)
144
+ /private/var/tmp/_bazel_runner/
145
+ key : ${{ matrix.arch }}-${{ matrix.os }}-${{ matrix.runtime }}-${{ steps.cache-key.outputs.uniq }}-${{ hashFiles('WORKSPACE', '.bazelrc', '.bazelversion', 'bazel/dependencies.bzl', 'bazel/repositories.bzl') }}
146
+ restore-keys : |
147
+ ${{ matrix.arch }}-${{ matrix.os }}-${{ matrix.runtime }}-${{ steps.cache-key.outputs.uniq }}-
148
+ ${{ matrix.arch }}-${{ matrix.os }}-${{ matrix.runtime }}
149
+
150
+ - name : Bazel build/test
151
+ run : >
152
+ ${{ matrix.run_under }}
153
+ bazel ${{ matrix.action }}
154
+ --verbose_failures
155
+ --test_output=errors
156
+ --define runtime=${{ matrix.runtime }}
157
+ ${{ matrix.flags }}
158
+ //test/...
159
+
160
+ - name : Bazel build/test (signed Wasm module)
161
+ run : >
162
+ ${{ matrix.run_under }}
163
+ bazel ${{ matrix.action }}
164
+ --verbose_failures
165
+ --test_output=errors
166
+ --define runtime=${{ matrix.runtime }}
167
+ ${{ matrix.flags }}
168
+ --per_file_copt=src/signature_util.cc,test/signature_util_test.cc@-DPROXY_WASM_VERIFY_WITH_ED25519_PUBKEY=\"$(xxd -p -c 256 test/test_data/signature_key1.pub | cut -b9-)\"
169
+ //test:signature_util_test
170
+
171
+ - name : Cleanup Bazel cache
172
+ if : ${{ matrix.runtime != 'wasmtime' || startsWith(matrix.run_under, 'docker') }}
89
173
run : |
90
- bazel test --define runtime=${{ matrix.runtime }} --per_file_copt=//...@-DPROXY_WASM_VERIFY_WITH_ED25519_PUBKEY=\"$(xxd -p -c 256 test/test_data/signature_key1.pub | cut -b9-)\" //test:signature_util_test
174
+ export OUTPUT=$(bazel info output_base)
175
+ # BoringSSL's test data (90 MiB).
176
+ rm -rf ${OUTPUT}/external/boringssl/crypto_test_data.cc
177
+ rm -rf ${OUTPUT}/external/boringssl/src/crypto/*/test/
178
+ rm -rf ${OUTPUT}/external/boringssl/src/third_party/wycheproof_testvectors/
179
+ # LLVM's tests (500 MiB).
180
+ rm -rf ${OUTPUT}/external/llvm*/test/
181
+ # V8's tests (100 MiB).
182
+ if [ -d "${OUTPUT}/external/v8/test/torque" ]; then
183
+ mv ${OUTPUT}/external/v8/test/torque ${OUTPUT}/external/v8/test_torque
184
+ rm -rf ${OUTPUT}/external/v8/test/*
185
+ mv ${OUTPUT}/external/v8/test_torque ${OUTPUT}/external/v8/test/torque
186
+ fi
187
+ # Unnecessary CMake tools (65 MiB).
188
+ rm -rf ${OUTPUT}/external/cmake-*/bin/{ccmake,cmake-gui,cpack,ctest}
189
+ # Distfiles for Rust toolchains (350 MiB).
190
+ rm -rf ${OUTPUT}/external/rust_*/*.tar.gz
191
+ # Bazel's repository cache (650-800 MiB) and install base (155 MiB).
192
+ rm -rf $(bazel info repository_cache)
193
+ rm -rf $(bazel info install_base)
0 commit comments