Skip to content

Commit

Permalink
fix: target wasm32-wasip1
Browse files Browse the repository at this point in the history
  • Loading branch information
Swaagie committed Feb 5, 2025
1 parent ecaa6db commit 0a53dec
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
rust: [stable] # nightly doesn't build yet for wasm32-wasi
rust: [stable, nightly]
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
target: wasm32-wasi
target: wasm32-wasip1
toolchain: ${{ matrix.rust }}
components: rustfmt, clippy
- name: Run cargo check
Expand All @@ -37,8 +37,14 @@ jobs:
LOG_LEVEL: off
run: |
cd example
cargo build --target wasm32-wasi
cargo build --target wasm32-wasip1
docker compose up --detach
# Wait for Envoy to start
for i in {1..10}; do
curl -f http://localhost:10000/healthcheck && break || sleep 5
done
cargo test --test request-e2e
docker compose down
- name: Run clippy
Expand All @@ -55,4 +61,4 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: build
args: --target wasm32-wasi --release
args: --target wasm32-wasip1 --release
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ Envoy filter written in Rust to provide Reponse Body Injection (RBI). This requi
## Build

```sh
rustup target add wasm32-wasi
cargo build --target wasm32-wasi
rustup target add wasm32-wasip1
cargo build --target wasm32-wasip1
```

Release build

```sh
rustup target add wasm32-wasi
cargo build --target wasm32-wasi --release
rustup target add wasm32-wasip1
cargo build --target wasm32-wasip1 --release
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion example/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
volumes:
- ./envoy.yaml:/etc/envoy/envoy.yaml
# Use the release build in production
- ../target/wasm32-wasi/debug/envoy_rbi_filter.wasm:/etc/envoy/envoy_rbi_filter.wasm
- ../target/wasm32-wasip1/debug/envoy_rbi_filter.wasm:/etc/envoy/envoy_rbi_filter.wasm
networks:
- envoymesh

Expand Down
5 changes: 5 additions & 0 deletions example/envoy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ static_resources:
domains:
- "*"
routes:
- match: /healthcheck
direct_response:
status: 200
body:
inline_string: "OK\n"
- match:
prefix: "/"
route:
Expand Down

0 comments on commit 0a53dec

Please sign in to comment.