3131jobs :
3232
3333 format :
34- runs-on : ubuntu-latest
34+ runs-on : ubuntu-20.04
3535
3636 steps :
3737 - uses : actions/checkout@v2
@@ -58,33 +58,136 @@ jobs:
5858 addlicense -check .
5959
6060 build :
61- name : build ( ${{ matrix.runtime }})
61+ name : ${{ matrix.action }} with ${{ matrix.name }}
6262
63- runs-on : ubuntu-latest
63+ runs-on : ${{ matrix.os }}
6464
6565 strategy :
6666 fail-fast : false
6767 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
69126
70127 steps :
71128 - uses : actions/checkout@v2
72129
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
75133
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') }}
77140 uses : actions/cache@v2
78141 with :
79142 path : |
80143 ~/.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') }}
89173 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