Skip to content

Commit 596e006

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

30 files changed

Lines changed: 488 additions & 52 deletions

.bazelignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
.github
12
node_modules
3+
wasm-cc

.bazelrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,7 @@ common:examples --action_env=BUILDKIT_PROGRESS
1616
common:examples --host_action_env=BUILDKIT_PROGRESS
1717
common:examples --sandbox_writable_path=/var/run/docker.sock
1818

19+
common --@rules_python//python/config_settings:bootstrap_impl=script
20+
1921
try-import %workspace%/user.bazelrc
2022
try-import %workspace%/repo.bazelrc

.github/workflows/_verify_wasm.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Verify/Wasm
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
workflow_call:
8+
9+
10+
jobs:
11+
wasm:
12+
runs-on: ubuntu-24.04
13+
steps:
14+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
15+
- run: |
16+
docker pull envoyproxy/envoy:dev
17+
DEV_CONTAINER_ID=$(docker inspect --format='{{.Id}}' envoyproxy/envoy:dev)
18+
echo "DEV_CONTAINER_ID=${DEV_CONTAINER_ID}" >> $GITHUB_ENV
19+
- run: |
20+
./verify.sh
21+
working-directory: wasm-cc

.github/workflows/docs.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,16 @@ jobs:
2727
path: examples
2828
- run: |
2929
export UID
30+
echo 'load("@envoy_examples//bazel:env.bzl", "envoy_examples_env")' >> WORKSPACE
31+
echo 'envoy_examples_env()' >> WORKSPACE
3032
docker compose run --quiet --quiet-pull --quiet-build docs
3133
working-directory: examples
3234
env:
3335
BAZEL_BUILD_EXTRA_OPTIONS: >-
3436
--override_repository=envoy_examples=../examples
3537
--config=ci
3638
--@rules_python//python/config_settings:bootstrap_impl=script
37-
DOCKER_BUILDKIT: 1
38-
COMPOSE_BAKE: true
3939
BUILDKIT_PROGRESS: quiet
40+
COMPOSE_BAKE: true
41+
DOCKER_BUILDKIT: 1
42+
# ENVOY_EXAMPLES_BUILD_DOCS: 1

.github/workflows/verify.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ concurrency:
1717
jobs:
1818
examples:
1919
uses: ./.github/workflows/_verify_examples.yml
20+
wasm:
21+
uses: ./.github/workflows/_verify_wasm.yml

BUILD

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ load("//:examples.bzl", "envoy_examples")
44

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

7+
# Excluding build tests - eg wasm - these should be run directly
78
EXAMPLE_TESTS = [
89
"brotli",
910
"cache",
@@ -40,7 +41,6 @@ EXAMPLE_TESTS = [
4041
"udp",
4142
"vrp-litmus",
4243
# "vrp-local",
43-
# "wasm-cc",
4444
"websocket",
4545
"zipkin",
4646
"zstd",
@@ -66,7 +66,7 @@ filegroup(
6666
"postgres/*",
6767
"kafka/*.yaml",
6868
],
69-
),
69+
) + ["@envoy-example-wasmcc//:configs"],
7070
visibility = ["//visibility:public"],
7171
)
7272

@@ -95,7 +95,7 @@ filegroup(
9595

9696
filegroup(
9797
name = "docs_rst",
98-
srcs = glob(["**/example.rst"]) + ["//wasm-cc:example.rst"],
98+
srcs = glob(["**/example.rst"]),
9999
)
100100

101101
pkg_files(
@@ -107,10 +107,14 @@ pkg_files(
107107

108108
genrule(
109109
name = "examples_docs",
110-
srcs = [":docs_rst"],
110+
srcs = [
111+
":docs_rst",
112+
"@envoy-example-wasmcc//:example.rst",
113+
],
111114
outs = ["examples_docs.tar.gz"],
112115
cmd = """
113116
TEMP=$$(mktemp -d)
117+
mv $(location @envoy-example-wasmcc//:example.rst) "$${TEMP}/wasm-cc.rst"
114118
for location in $(locations :docs_rst); do
115119
example=$$(echo $$location | sed -e 's#^external/[^/]*/##' | cut -d/ -f1)
116120
cp -a $$location "$${TEMP}/$${example}.rst"
@@ -143,23 +147,25 @@ filegroup(
143147
"**/#*",
144148
".*/**/*",
145149
"BUILD",
146-
".git/**/*",
150+
"README.md",
151+
"WORKSPACE",
147152
"bazel-*/**/*",
148153
"**/node_modules/**",
149154
"**/*.rst",
150155
"win32*",
151156
],
152-
) + [
153-
"//wasm-cc:files",
154-
],
157+
),
155158
)
156159

157160
pkg_tar(
158161
name = "docs",
159162
srcs = [":examples_files"],
160163
extension = "tar.gz",
161164
package_dir = "start/sandboxes",
162-
deps = [":examples_docs"],
165+
deps = [
166+
":examples_docs",
167+
"@envoy-example-wasmcc//:includes",
168+
],
163169
visibility = ["//visibility:public"],
164170
)
165171

WORKSPACE

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
workspace(name = "envoy-examples")
1+
workspace(name = "envoy_examples")
2+
3+
load("//bazel:env.bzl", "envoy_examples_env")
4+
envoy_examples_env()
25

36
load("//bazel:archives.bzl", "load_envoy_examples_archives")
47
load_envoy_examples_archives()
@@ -8,3 +11,6 @@ resolve_envoy_examples_dependencies()
811

912
load("//bazel:toolchains.bzl", "load_envoy_examples_toolchains")
1013
load_envoy_examples_toolchains()
14+
15+
load("//bazel:packages.bzl", "load_envoy_examples_packages")
16+
load_envoy_examples_packages()

bazel/archives.bzl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
2+
load("@envoy-example-wasmcc//bazel:archives.bzl", "load_envoy_example_wasmcc_archives")
23
load("//bazel:versions.bzl", "VERSIONS")
34

45
def load_github_archives():
@@ -36,3 +37,4 @@ def load_http_archives():
3637
def load_envoy_examples_archives():
3738
load_github_archives()
3839
load_http_archives()
40+
load_envoy_example_wasmcc_archives()

bazel/deps.bzl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
load("@envoy-example-wasmcc//bazel:deps.bzl", "resolve_envoy_example_wasmcc_dependencies")
12
load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies")
23
load("@rules_python//python:repositories.bzl", "py_repositories")
34

45
def resolve_envoy_examples_dependencies():
56
go_rules_dependencies()
67
py_repositories()
8+
resolve_envoy_example_wasmcc_dependencies()

bazel/env.bzl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
load("//bazel:nested.bzl", "load_envoy_nested_examples")
2+
3+
def _impl(ctx):
4+
need = ctx.os.environ.get("ENVOY_EXAMPLES_BUILD_DOCS") == "1"
5+
ctx.file("llvm_flag.bzl", content = "LLVM_ENABLED = %s\n" % need)
6+
ctx.file("WORKSPACE", content = "")
7+
ctx.file("BUILD", content = "")
8+
9+
_envoy_examples_env = repository_rule(
10+
implementation = _impl,
11+
environ = ["ENVOY_EXAMPLES_BUILD_DOCS"],
12+
)
13+
14+
def envoy_examples_env():
15+
_envoy_examples_env(name = "envoy_examples_env")
16+
load_envoy_nested_examples()

0 commit comments

Comments
 (0)