diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5f7c9ea..fa956fd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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 @@ -55,4 +61,4 @@ jobs: uses: actions-rs/cargo@v1 with: command: build - args: --target wasm32-wasi --release + args: --target wasm32-wasip1 --release diff --git a/README.md b/README.md index a6acb3a..37ab477 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/example/docker-compose.yaml b/example/docker-compose.yaml index ce43ef8..6019e0a 100644 --- a/example/docker-compose.yaml +++ b/example/docker-compose.yaml @@ -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 diff --git a/example/envoy.yaml b/example/envoy.yaml index 929c5a3..24828e2 100644 --- a/example/envoy.yaml +++ b/example/envoy.yaml @@ -18,6 +18,11 @@ static_resources: domains: - "*" routes: + - match: /healthcheck + direct_response: + status: 200 + body: + inline_string: "OK\n" - match: prefix: "/" route: