Skip to content

Commit ceec28c

Browse files
committed
wasm-cc: Fix example
Signed-off-by: Ryan Northey <ryan@synca.io>
1 parent 82092dc commit ceec28c

File tree

16 files changed

+383
-46
lines changed

16 files changed

+383
-46
lines changed
Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
1-
name: Verify
1+
name: Verify/examples
22

33
permissions:
44
contents: read
55

66
on:
7-
pull_request:
8-
push:
9-
branches:
10-
- main
11-
12-
concurrency:
13-
group: >-
14-
${{ github.event.inputs.head_ref || github.run_id }}
7+
workflow_call:
8+
inputs:
9+
required: true
10+
type: string
1511

1612

1713
jobs:
18-
verify:
14+
examples:
1915
runs-on: ubuntu-24.04
16+
if: ${{ inputs.verify == 'examples' }}
2017
steps:
2118
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2219
- run: |
@@ -79,3 +76,16 @@ jobs:
7976
with:
8077
path: /cache/docker
8178
key: ${{ runner.os }}-docker-${{ hashFiles('**/Dockerfile*') }}
79+
80+
wasm:
81+
if: ${{ inputs.verify == 'wasm' }}
82+
runs-on: ubuntu-24.04
83+
steps:
84+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
85+
- run: |
86+
docker pull envoyproxy/envoy:dev
87+
DEV_CONTAINER_ID=$(docker inspect --format='{{.Id}}' envoyproxy/envoy:dev)
88+
echo "DEV_CONTAINER_ID=${DEV_CONTAINER_ID}" >> $GITHUB_ENV
89+
- run: |
90+
./verify.sh
91+
working-directory: wasm-cc

.github/workflows/verify.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Verify
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
pull_request:
8+
push:
9+
branches:
10+
- main
11+
12+
concurrency:
13+
group: >-
14+
${{ github.event.inputs.head_ref || github.run_id }}
15+
16+
17+
jobs:
18+
verify:
19+
matrix:
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
include:
24+
- examples
25+
- wasm
26+
uses: ./.github/workflows/_verify.yml
27+
with:
28+
verify: ${{ matrix.name }}

shared/build/Dockerfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
FROM envoyproxy/envoy-build-ubuntu:f94a38f62220a2b017878b790b6ea98a0f6c5f9c@sha256:2dd96b6f43c08ccabd5f4747fce5854f5f96af509b32e5cf6493f136e9833649
1+
FROM envoyproxy/envoy-build:ci-cdfbb76bc18c115270127132c6f7c67000cd2e74@sha256:48a8b1bc24ed771560126642dcbba33c50c6b837722ba9c75270b858ef7ab3a6
22
ENV DEBIAN_FRONTEND=noninteractive
33
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
44
--mount=type=cache,target=/var/lib/apt/lists,sharing=locked \
5-
apt-get -qq install --no-install-recommends -y gosu \
6-
&& groupadd -f envoygroup \
7-
&& useradd -g envoygroup -m -d /home/envoybuild envoybuild
5+
apt-get -qq update \
6+
&& apt-get -qq install --no-install-recommends -y gosu

shared/build/build-entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ set -e
55
if [[ $(id -u envoybuild) != "${BUILD_UID}" ]]; then
66
usermod -u "${BUILD_UID}" envoybuild
77
chown envoybuild /home/envoybuild
8+
chown envoybuild /home/envoybuild/.cache
89
fi
910

1011
chown envoybuild /output
11-
chmod 1777 /tmp
1212

1313
exec gosu envoybuild "$@"

wasm-cc/.bazelrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
common --enable_bzlmod=0

wasm-cc/.bazelversion

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7.6.0

wasm-cc/BUILD

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
load("@bazel_skylib//lib:selects.bzl", "selects")
2-
# load("@envoy//bazel/wasm:wasm.bzl", "envoy_wasm_cc_binary")
2+
load("@envoy//bazel/wasm:wasm.bzl", "envoy_wasm_cc_binary")
33

44
licenses(["notice"]) # Apache 2
55

@@ -31,15 +31,15 @@ filegroup(
3131
visibility = ["//visibility:public"],
3232
)
3333

34-
# envoy_wasm_cc_binary(
35-
# name = "envoy_filter_http_wasm_example.wasm",
36-
# srcs = ["envoy_filter_http_wasm_example.cc"],
37-
# )
34+
envoy_wasm_cc_binary(
35+
name = "envoy_filter_http_wasm_example.wasm",
36+
srcs = ["envoy_filter_http_wasm_example.cc"],
37+
)
3838

39-
# envoy_wasm_cc_binary(
40-
# name = "envoy_filter_http_wasm_updated_example.wasm",
41-
# srcs = ["envoy_filter_http_wasm_updated_example.cc"],
42-
# )
39+
envoy_wasm_cc_binary(
40+
name = "envoy_filter_http_wasm_updated_example.wasm",
41+
srcs = ["envoy_filter_http_wasm_updated_example.cc"],
42+
)
4343

4444
filegroup(
4545
name = "files",

wasm-cc/WORKSPACE

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
workspace(name = "envoy_examples_wasmcc")
2+
x
3+
load(":archives.bzl", "load_archives")
4+
load_archives()
5+
6+
load(":deps.bzl", "resolve_dependencies")
7+
resolve_dependencies()
8+
9+
load(":toolchains.bzl", "load_toolchains")
10+
load_toolchains()
11+
12+
load(":packages.bzl", "load_packages")
13+
load_packages()

wasm-cc/archives.bzl

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
2+
load("//:versions.bzl", "VERSIONS")
3+
4+
def load_github_archives():
5+
for k, v in VERSIONS.items():
6+
if type(v) == type("") or v.get("type") != "github_archive":
7+
continue
8+
kwargs = dict(name = k, **v)
9+
# Format string values, but not lists
10+
formatted_kwargs = {}
11+
for arg_k, arg_v in kwargs.items():
12+
if arg_k in ["repo", "type", "version"]:
13+
continue
14+
if type(arg_v) == type(""):
15+
formatted_kwargs[arg_k] = arg_v.format(**kwargs)
16+
else:
17+
formatted_kwargs[arg_k] = arg_v
18+
http_archive(**formatted_kwargs)
19+
20+
def load_http_archives():
21+
for k, v in VERSIONS.items():
22+
if type(v) == type("") or v.get("type") != "http_archive":
23+
continue
24+
kwargs = dict(name = k, **v)
25+
# Format string values, but not lists
26+
formatted_kwargs = {}
27+
for arg_k, arg_v in kwargs.items():
28+
if arg_k in ["type", "version"]:
29+
continue
30+
if type(arg_v) == type(""):
31+
formatted_kwargs[arg_k] = arg_v.format(**kwargs)
32+
else:
33+
formatted_kwargs[arg_k] = arg_v
34+
http_archive(**formatted_kwargs)
35+
36+
def load_archives():
37+
load_github_archives()
38+
load_http_archives()

wasm-cc/deps.bzl

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
load("@emsdk//:deps.bzl", emsdk_deps = "deps")
2+
load("@envoy//bazel:api_binding.bzl", "envoy_api_binding")
3+
load("@envoy_toolshed//sysroot:sysroot.bzl", "setup_sysroots")
4+
load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies")
5+
load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")
6+
load("@rules_fuzzing//fuzzing:repositories.bzl", "rules_fuzzing_dependencies")
7+
load("@rules_perl//perl:deps.bzl", "perl_register_toolchains", "perl_rules_dependencies")
8+
load("@rules_python//python:repositories.bzl", "py_repositories")
9+
load("@toolchains_llvm//toolchain:deps.bzl", "bazel_toolchain_dependencies")
10+
load("@toolchains_llvm//toolchain:rules.bzl", "llvm_toolchain")
11+
load("//:versions.bzl", "VERSIONS")
12+
13+
def resolve_dependencies(
14+
cmake_version=None,
15+
llvm_version=None,
16+
ninja_version=None,
17+
setup_autotools_toolchain=True):
18+
19+
envoy_api_binding()
20+
py_repositories()
21+
bazel_toolchain_dependencies()
22+
rules_foreign_cc_dependencies(
23+
register_preinstalled_tools = True,
24+
register_default_tools = True,
25+
cmake_version = cmake_version or VERSIONS["cmake"],
26+
ninja_version = ninja_version or VERSIONS["ninja"],
27+
)
28+
emsdk_deps()
29+
perl_rules_dependencies()
30+
perl_register_toolchains()
31+
rules_fuzzing_dependencies(
32+
oss_fuzz = True,
33+
honggfuzz = False,
34+
)
35+
setup_sysroots()
36+
37+
llvm_toolchain(
38+
name = "llvm_toolchain",
39+
llvm_version = llvm_version or VERSIONS["llvm"],
40+
sysroot = {
41+
"linux-x86_64": "@sysroot_linux_amd64//:sysroot",
42+
"linux-aarch64": "@sysroot_linux_arm64//:sysroot",
43+
}
44+
)
45+
go_rules_dependencies()

0 commit comments

Comments
 (0)