Skip to content

Commit 799254e

Browse files
committed
Merge remote-tracking branch 'upstream/master' into shared-data-keys
2 parents d9d3c9a + bab2ef1 commit 799254e

File tree

151 files changed

+4426
-2587
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

151 files changed

+4426
-2587
lines changed

.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.1.0
1+
5.0.0

.github/workflows/cargo.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ jobs:
3838
- name: Format (cargo raze)
3939
working-directory: bazel/cargo
4040
run: |
41-
cargo install cargo-raze --version 0.12.0
42-
cargo raze
41+
cargo install cargo-raze --version 0.14.1
42+
cd wasmsign && cargo raze && cd ..
43+
cd wasmtime && cargo raze && cd ..
4344
# Ignore manual changes in "errno" crate until fixed in cargo-raze.
4445
# See: https://github.com/google/cargo-raze/issues/451
45-
git diff --exit-code -- ':!remote/BUILD.errno-0.2.8.bazel'
46+
git diff --exit-code -- ':!wasmtime/remote/BUILD.errno-0.2.8.bazel'

.github/workflows/cpp.yml

Lines changed: 119 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ on:
3131
jobs:
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)

BUILD

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,16 @@ cc_library(
5656
"include/proxy-wasm/bytecode_util.h",
5757
"include/proxy-wasm/signature_util.h",
5858
],
59+
linkopts = select({
60+
"//bazel:crypto_system": ["-lcrypto"],
61+
"//conditions:default": [],
62+
}),
5963
deps = [
6064
":headers",
61-
"@boringssl//:crypto",
62-
],
65+
] + select({
66+
"//bazel:crypto_system": [],
67+
"//conditions:default": ["@boringssl//:crypto"],
68+
}),
6369
)
6470

6571
cc_library(

WORKSPACE

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,3 @@ proxy_wasm_cpp_host_repositories()
77
load("@proxy_wasm_cpp_host//bazel:dependencies.bzl", "proxy_wasm_cpp_host_dependencies")
88

99
proxy_wasm_cpp_host_dependencies()
10-
11-
load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")
12-
13-
rules_foreign_cc_dependencies()

bazel/BUILD

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
load("@bazel_skylib//lib:selects.bzl", "selects")
2+
13
config_setting(
24
name = "runtime_v8",
35
values = {"define": "runtime=v8"},
@@ -17,3 +19,21 @@ config_setting(
1719
name = "runtime_wavm",
1820
values = {"define": "runtime=wavm"},
1921
)
22+
23+
config_setting(
24+
name = "requested_crypto_system",
25+
values = {"define": "crypto=system"},
26+
)
27+
28+
config_setting(
29+
name = "linux_s390x",
30+
values = {"cpu": "s390x"},
31+
)
32+
33+
selects.config_setting_group(
34+
name = "crypto_system",
35+
match_any = [
36+
":requested_crypto_system",
37+
":linux_s390x",
38+
],
39+
)

0 commit comments

Comments
 (0)