Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
abf9d5f
chore: move hello_world into folder
Swaagie Apr 7, 2022
9ff5fd0
doc: typo
Swaagie Apr 7, 2022
38a7cda
chore: add license
Swaagie Apr 7, 2022
1a9e9e7
chore: fix build target
Swaagie Apr 7, 2022
ccea196
doc: add prereq requirements
Swaagie Apr 7, 2022
9440cb2
doc: update subtitle from @PiotrSikora comment
Swaagie Apr 7, 2022
9791581
feat: move hello_world example to self contained package
Swaagie Apr 7, 2022
fa88fba
fix: remove ignore rustsec vuln
Swaagie Apr 7, 2022
db1f15e
dist: regen lockfile
Swaagie Apr 7, 2022
349b47b
fix: remove hello_world from bazel BUILD file
Swaagie Apr 7, 2022
0d4a60d
fix: remove hello_world as example definition from main Cargo.toml
Swaagie Apr 7, 2022
bbb7d25
dist: rebuild using latest raze
Swaagie Apr 7, 2022
76e76f2
chore: migrate http_auth_random
Swaagie Apr 7, 2022
00b997b
fix: remove wee_alloc from hello_world
Swaagie Apr 7, 2022
5d9476e
fix: move http_auth_random
Swaagie Apr 9, 2022
c09978c
fix: move http_body
Swaagie Apr 9, 2022
ab9efc3
chore: move http_config example
Swaagie Apr 9, 2022
d6cd9d5
chore: migrate http_headers
Swaagie Apr 9, 2022
cfd8ed9
fix: build paths
Swaagie Apr 9, 2022
674d607
chore: build examples as part of CICD
Swaagie Apr 9, 2022
711e65e
fix: GHA example steps
Swaagie Apr 9, 2022
d67eed7
fix: GHA
Swaagie Apr 9, 2022
23f9bfe
fix: GHA
Swaagie Apr 9, 2022
85b2c32
fix: GHA valid expression
Swaagie Apr 9, 2022
014dcd6
fix: check wasi32 only
Swaagie Apr 9, 2022
d4fa611
fix: add toolchains
Swaagie Apr 9, 2022
f44b7f5
chore: validate Envoy config for each example
Swaagie Apr 9, 2022
32aef61
doc: update example run snippets
Swaagie Apr 9, 2022
3defdba
fix: Envoy validation step
Swaagie Apr 9, 2022
9029904
fix: build dev filters for examples
Swaagie Apr 9, 2022
eac15dc
Merge remote-tracking branch 'origin/master' into Swaagie/examples
PiotrSikora Nov 21, 2022
23ca38e
review: fix links.
PiotrSikora Nov 21, 2022
202eb0e
review: update year in new files.
PiotrSikora Nov 21, 2022
4259af0
review: update Envoy to v1.24.
PiotrSikora Nov 21, 2022
7c7b9eb
review: style.
PiotrSikora Nov 21, 2022
98d076c
review: style in GitHub Actions.
PiotrSikora Nov 22, 2022
1c21df6
review: add release profile to examples.
PiotrSikora Nov 22, 2022
374933c
review: rewrite reactor tests.
PiotrSikora Nov 22, 2022
b7f4627
review: fixup reactor tests.
PiotrSikora Nov 22, 2022
affc98e
review: fixup reactor tests (take 2).
PiotrSikora Nov 22, 2022
8ad1c19
review: move docker-compose.yaml to each example.
PiotrSikora Nov 22, 2022
4b0124b
review: run hello_world as Envoy's bootstrap extension.
PiotrSikora Nov 22, 2022
8c4f086
review: format using yamlfmt.
PiotrSikora Nov 22, 2022
1c1767b
review: drop root_id and vm_id from examples.
PiotrSikora Nov 22, 2022
0876d6d
review: add newlines to the generated responses.
PiotrSikora Nov 22, 2022
3269ffe
review: use reasonable connect_timeout.
PiotrSikora Nov 22, 2022
d6eb483
review: add README files.
PiotrSikora Nov 22, 2022
af9fe67
review: revert some text in the main README.
PiotrSikora Nov 22, 2022
34c3c75
review: authentication -> auth.
PiotrSikora Nov 22, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
160 changes: 122 additions & 38 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ jobs:
export PATH=$PATH:$(go env GOPATH)/bin
buildifier -mode=check WORKSPACE
buildifier -mode=check BUILD
buildifier -mode=check examples/BUILD

- name: Format (cargo raze)
run: |
Expand All @@ -89,6 +88,9 @@ jobs:
stable:
runs-on: ubuntu-latest

env:
RUSTFLAGS: -D warnings

steps:
- uses: actions/checkout@v2

Expand All @@ -99,23 +101,15 @@ jobs:
rustup target add wasm32-wasi

- name: Build (wasm32-unknown-unknown)
env:
RUSTFLAGS: -D warnings
run: cargo build --release --all-targets --target=wasm32-unknown-unknown

- name: Clippy (wasm32-unknown-unknown)
env:
RUSTFLAGS: -D warnings
run: cargo clippy --release --all-targets --target=wasm32-unknown-unknown

- name: Build (wasm32-wasi)
env:
RUSTFLAGS: -D warnings
run: cargo build --release --all-targets --target=wasm32-wasi

- name: Clippy (wasm32-wasi)
env:
RUSTFLAGS: -D warnings
run: cargo clippy --release --all-targets --target=wasm32-wasi

- name: Format (rustfmt)
Expand All @@ -133,6 +127,9 @@ jobs:
nightly:
runs-on: ubuntu-latest

env:
RUSTFLAGS: -D warnings

steps:
- uses: actions/checkout@v2

Expand All @@ -144,23 +141,15 @@ jobs:
rustup default nightly

- name: Build (wasm32-unknown-unknown)
env:
RUSTFLAGS: -D warnings
run: cargo build --release --all-targets --target=wasm32-unknown-unknown

- name: Clippy (wasm32-unknown-unknown)
env:
RUSTFLAGS: -D warnings
run: cargo clippy --release --all-targets --target=wasm32-unknown-unknown

- name: Build (wasm32-wasi)
env:
RUSTFLAGS: -D warnings
run: cargo build --release --all-targets --target=wasm32-wasi

- name: Clippy (wasm32-wasi)
env:
RUSTFLAGS: -D warnings
run: cargo clippy --release --all-targets --target=wasm32-wasi

- name: Format (rustfmt)
Expand All @@ -175,49 +164,144 @@ jobs:
- name: Package (publish)
run: cargo publish --dry-run --target=wasm32-unknown-unknown

reactor:
outdated:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Update Rust
- name: Run cargo outdated
run: cargo outdated --root-deps-only --exit-code 1

audit:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Run cargo audit
run: |
rustup toolchain install nightly --component clippy
rustup +nightly target add wasm32-wasi
rustup default nightly
cp -p bazel/cargo/Cargo.raze.lock .
cargo audit

- name: Rewrite Cargo.toml examples
example:
runs-on: ubuntu-latest

strategy:
matrix:
example:
- 'hello_world'
- 'http_auth_random'
- 'http_body'
- 'http_config'
- 'http_headers'

defaults:
run:
working-directory: ./examples/${{ matrix.example }}

env:
RUSTFLAGS: -D warnings

steps:
- uses: actions/checkout@v2

- name: Update Rust
run: |
grep -v '^crate-type' Cargo.toml > Cargo.tmp
mv Cargo.tmp Cargo.toml
rustup toolchain install stable --component clippy --component rustfmt
rustup target add wasm32-wasi

- name: Build (wasm32-wasi)
env:
RUSTFLAGS: -D warnings -Z wasi-exec-model=reactor
run: cargo build --release --all-targets --target=wasm32-wasi
run: cargo build --release --target=wasm32-wasi

- name: Clippy (wasm32-wasi)
env:
RUSTFLAGS: -D warnings -Z wasi-exec-model=reactor
run: cargo clippy --release --all-targets --target=wasm32-wasi
run: cargo clippy --release --target=wasm32-wasi

outdated:
runs-on: ubuntu-latest
- name: Format (rustfmt)
run: cargo fmt -- --check

steps:
- uses: actions/checkout@v2
- name: Format (manifest)
run: cargo verify-project

- name: Run cargo audit
run: cargo audit

- name: Run cargo outdated
run: cargo outdated --root-deps-only --exit-code 1

audit:
- name: Validate Envoy config
run: |
docker run --rm \
-v $(pwd)/envoy.yaml:/envoy.yaml \
-v $(pwd)/target/wasm32-wasi/release:/etc/envoy/proxy-wasm-plugins \
envoyproxy/envoy:v1.24-latest \
--mode validate \
-c envoy.yaml

reactor:
runs-on: ubuntu-latest

strategy:
matrix:
example:
- 'hello_world'
- 'http_auth_random'
- 'http_body'
- 'http_config'
- 'http_headers'

defaults:
run:
working-directory: ./examples/${{ matrix.example }}

env:
RUSTFLAGS: -D warnings -Z wasi-exec-model=reactor

steps:
- uses: actions/checkout@v2

- name: Update Rust
run: |
rustup toolchain install nightly --component clippy --component rustfmt
rustup +nightly target add wasm32-wasi
rustup default nightly

- name: Change crate type from library to binary
run: |
grep -v '^\[lib\]' Cargo.toml > Cargo.tmp
grep -v '^crate-type' Cargo.tmp > Cargo.toml
mv src/lib.rs src/main.rs

- name: Build (wasm32-wasi)
run: cargo build --release --target=wasm32-wasi

- name: Clippy (wasm32-wasi)
run: cargo clippy --release --target=wasm32-wasi

- name: Format (rustfmt)
run: cargo fmt -- --check

- name: Format (manifest)
run: cargo verify-project

- name: Run cargo audit
run: cargo audit

- name: Run cargo outdated
run: cargo outdated --root-deps-only --exit-code 1

- name: Rename .wasm to match expected filename
run: |
cp -p bazel/cargo/Cargo.raze.lock .
cargo audit --ignore RUSTSEC-2020-0159
cd target/wasm32-wasi/release
for file in $(ls -1 *.wasm); do \
mv $file $(echo $file | sed 's/-/_/g'); \
done

- name: Validate Envoy config
run: |
docker run --rm \
-v $(pwd)/envoy.yaml:/envoy.yaml \
-v $(pwd)/target/wasm32-wasi/release:/etc/envoy/proxy-wasm-plugins \
envoyproxy/envoy:v1.24-latest \
--mode validate \
-c envoy.yaml
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/bazel-*
/target
/Cargo.lock
target
Cargo.lock
32 changes: 0 additions & 32 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@ build = "build.rs"
hashbrown = "0.13"
log = "0.4"

[dev-dependencies]
cfg-if = "1.0"
chrono = { version = "0.4", default-features = false, features = ["clock", "std"] }

[target.'cfg(not(all(target_arch = "wasm32", target_os = "unknown")))'.dev-dependencies]
getrandom = "0.2"

[profile.release]
lto = true
opt-level = 3
Expand All @@ -32,28 +25,3 @@ strip = "debuginfo"
package_aliases_dir = "bazel/cargo"
workspace_path = "//bazel/cargo"
genmode = "Remote"

[[example]]
name = "hello_world"
path = "examples/hello_world.rs"
crate-type = ["cdylib"]

[[example]]
name = "http_auth_random"
path = "examples/http_auth_random.rs"
crate-type = ["cdylib"]

[[example]]
name = "http_headers"
path = "examples/http_headers.rs"
crate-type = ["cdylib"]

[[example]]
name = "http_body"
path = "examples/http_body.rs"
crate-type = ["cdylib"]

[[example]]
name = "http_config"
path = "examples/http_config.rs"
crate-type = ["cdylib"]
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

## Examples

- [Hello World](./examples/hello_world.rs)
- [HTTP Auth random](./examples/http_auth_random.rs)
- [HTTP Headers](./examples/http_headers.rs)
- [HTTP Response body](./examples/http_body.rs)
- [HTTP Configuration](./examples/http_config.rs)
- [Hello World](./examples/hello_world/)
- [HTTP Auth (random)](./examples/http_auth_random/)
- [HTTP Headers](./examples/http_headers/)
- [HTTP Response body](./examples/http_body/)
- [HTTP Configuration](./examples/http_config/)

## Articles & blog posts from the community

Expand Down
27 changes: 0 additions & 27 deletions bazel/cargo/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,6 @@ licenses([
])

# Aliased targets
alias(
name = "cfg_if",
actual = "@raze__cfg_if__1_0_0//:cfg_if",
tags = [
"cargo-raze",
"manual",
],
)

alias(
name = "chrono",
actual = "@raze__chrono__0_4_19//:chrono",
tags = [
"cargo-raze",
"manual",
],
)

alias(
name = "getrandom",
actual = "@raze__getrandom__0_2_6//:getrandom",
tags = [
"cargo-raze",
"manual",
],
)

alias(
name = "hashbrown",
actual = "@raze__hashbrown__0_13_1//:hashbrown",
Expand Down
Loading