Skip to content

Commit

Permalink
Use wasm32-wasip1 target.
Browse files Browse the repository at this point in the history
Note that @rules_rust//rust/platform:wasi evaluates to wasm32-wasi,
and there is no platform defined for wasm32-wasip1, so this doesn't
change anything for Bazel builds.

Signed-off-by: Piotr Sikora <[email protected]>
  • Loading branch information
PiotrSikora committed Oct 23, 2024
1 parent 3f4274e commit 76f81aa
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 41 deletions.
58 changes: 29 additions & 29 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
- name: Build (wasm32-unknown-unknown)
run: bazelisk --noworkspace_rc build --noenable_bzlmod --platforms=@rules_rust//rust/platform:wasm //...

- name: Build (wasm32-wasi)
- name: Build (wasm32-wasip1)
run: bazelisk --noworkspace_rc build --noenable_bzlmod --platforms=@rules_rust//rust/platform:wasi //...

- name: Format (buildifier)
Expand Down Expand Up @@ -111,19 +111,19 @@ jobs:
rustup toolchain install 1.64.0 --component clippy --component rustfmt
rustup default 1.64.0
rustup target add wasm32-unknown-unknown
rustup target add wasm32-wasi
rustup target add wasm32-wasip1
- name: Build (wasm32-unknown-unknown)
run: cargo build --release --all-targets --target=wasm32-unknown-unknown

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

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

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

- name: Format (rustfmt)
run: cargo fmt -- --check
Expand Down Expand Up @@ -159,19 +159,19 @@ jobs:
run: |
rustup toolchain install stable --component clippy --component rustfmt
rustup target add wasm32-unknown-unknown
rustup target add wasm32-wasi
rustup target add wasm32-wasip1
- name: Build (wasm32-unknown-unknown)
run: cargo build --release --all-targets --target=wasm32-unknown-unknown

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

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

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

- name: Format (rustfmt)
run: cargo fmt -- --check
Expand Down Expand Up @@ -208,19 +208,19 @@ jobs:
rustup toolchain install nightly --component clippy --component rustfmt
rustup default nightly
rustup target add wasm32-unknown-unknown
rustup target add wasm32-wasi
rustup target add wasm32-wasip1
- name: Build (wasm32-unknown-unknown)
run: cargo build --release --all-targets --target=wasm32-unknown-unknown

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

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

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

- name: Format (rustfmt)
run: cargo fmt -- --check
Expand Down Expand Up @@ -311,13 +311,13 @@ jobs:
- name: Update Rust
run: |
rustup toolchain install stable --component clippy --component rustfmt
rustup target add wasm32-wasi
rustup target add wasm32-wasip1
- name: Build (wasm32-wasi)
run: cargo build --release --target=wasm32-wasi
- name: Build (wasm32-wasip1)
run: cargo build --release --target=wasm32-wasip1

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

- name: Format (rustfmt)
run: cargo fmt -- --check
Expand All @@ -335,7 +335,7 @@ jobs:
run: |
docker run --rm \
-v $(pwd)/envoy.yaml:/envoy.yaml \
-v $(pwd)/target/wasm32-wasi/release:/etc/envoy/proxy-wasm-plugins \
-v $(pwd)/target/wasm32-wasip1/release:/etc/envoy/proxy-wasm-plugins \
envoyproxy/envoy:v1.31-latest \
--mode validate \
-c envoy.yaml
Expand Down Expand Up @@ -375,20 +375,20 @@ jobs:
- name: Update Rust
run: |
rustup toolchain install nightly --component clippy --component rustfmt
rustup +nightly target add wasm32-wasi
rustup default nightly
rustup target add wasm32-wasip1
- 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: Build (wasm32-wasip1)
run: cargo build --release --target=wasm32-wasip1

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

- name: Format (rustfmt)
run: cargo fmt -- --check
Expand All @@ -404,7 +404,7 @@ jobs:

- name: Rename .wasm to match expected filename
run: |
cd target/wasm32-wasi/release
cd target/wasm32-wasip1/release
for file in $(ls -1 *.wasm); do \
mv $file $(echo $file | sed 's/-/_/g'); \
done
Expand All @@ -413,7 +413,7 @@ jobs:
run: |
docker run --rm \
-v $(pwd)/envoy.yaml:/envoy.yaml \
-v $(pwd)/target/wasm32-wasi/release:/etc/envoy/proxy-wasm-plugins \
-v $(pwd)/target/wasm32-wasip1/release:/etc/envoy/proxy-wasm-plugins \
envoyproxy/envoy:v1.31-latest \
--mode validate \
-c envoy.yaml
2 changes: 1 addition & 1 deletion examples/grpc_auth_random/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Proxy-Wasm plugin that grants access based on a result of gRPC callout.
### Building

```sh
$ cargo build --target wasm32-wasi --release
$ cargo build --target wasm32-wasip1 --release
```

### Using in Envoy
Expand Down
2 changes: 1 addition & 1 deletion examples/grpc_auth_random/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ services:
- "10000:10000"
volumes:
- ./envoy.yaml:/etc/envoy/envoy.yaml
- ./target/wasm32-wasi/release:/etc/envoy/proxy-wasm-plugins
- ./target/wasm32-wasip1/release:/etc/envoy/proxy-wasm-plugins
networks:
- envoymesh
depends_on:
Expand Down
2 changes: 1 addition & 1 deletion examples/hello_world/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Proxy-Wasm background service plugin that logs time and random numbers.
### Building

```sh
$ cargo build --target wasm32-wasi --release
$ cargo build --target wasm32-wasip1 --release
```

### Using in Envoy
Expand Down
2 changes: 1 addition & 1 deletion examples/hello_world/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ services:
- "10000:10000"
volumes:
- ./envoy.yaml:/etc/envoy/envoy.yaml
- ./target/wasm32-wasi/release:/etc/envoy/proxy-wasm-plugins
- ./target/wasm32-wasip1/release:/etc/envoy/proxy-wasm-plugins
networks:
- envoymesh
networks:
Expand Down
2 changes: 1 addition & 1 deletion examples/http_auth_random/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Proxy-Wasm plugin that grants access based on a result of HTTP callout.
### Building

```sh
$ cargo build --target wasm32-wasi --release
$ cargo build --target wasm32-wasip1 --release
```

### Using in Envoy
Expand Down
2 changes: 1 addition & 1 deletion examples/http_auth_random/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ services:
- "10000:10000"
volumes:
- ./envoy.yaml:/etc/envoy/envoy.yaml
- ./target/wasm32-wasi/release:/etc/envoy/proxy-wasm-plugins
- ./target/wasm32-wasip1/release:/etc/envoy/proxy-wasm-plugins
networks:
- envoymesh
depends_on:
Expand Down
2 changes: 1 addition & 1 deletion examples/http_body/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Proxy-Wasm plugin that redacts sensitive HTTP responses.
### Building

```sh
$ cargo build --target wasm32-wasi --release
$ cargo build --target wasm32-wasip1 --release
```

### Using in Envoy
Expand Down
2 changes: 1 addition & 1 deletion examples/http_body/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ services:
- "10000:10000"
volumes:
- ./envoy.yaml:/etc/envoy/envoy.yaml
- ./target/wasm32-wasi/release:/etc/envoy/proxy-wasm-plugins
- ./target/wasm32-wasip1/release:/etc/envoy/proxy-wasm-plugins
networks:
- envoymesh
networks:
Expand Down
2 changes: 1 addition & 1 deletion examples/http_config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Proxy-Wasm plugin that injects HTTP response header with a value from Envoy conf
### Building

```sh
$ cargo build --target wasm32-wasi --release
$ cargo build --target wasm32-wasip1 --release
```

### Using in Envoy
Expand Down
2 changes: 1 addition & 1 deletion examples/http_config/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ services:
- "10000:10000"
volumes:
- ./envoy.yaml:/etc/envoy/envoy.yaml
- ./target/wasm32-wasi/release:/etc/envoy/proxy-wasm-plugins
- ./target/wasm32-wasip1/release:/etc/envoy/proxy-wasm-plugins
networks:
- envoymesh
networks:
Expand Down
2 changes: 1 addition & 1 deletion examples/http_headers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Proxy-Wasm plugin that logs HTTP request/response headers.
### Building

```sh
$ cargo build --target wasm32-wasi --release
$ cargo build --target wasm32-wasip1 --release
```

### Using in Envoy
Expand Down
2 changes: 1 addition & 1 deletion examples/http_headers/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ services:
- "10000:10000"
volumes:
- ./envoy.yaml:/etc/envoy/envoy.yaml
- ./target/wasm32-wasi/release:/etc/envoy/proxy-wasm-plugins
- ./target/wasm32-wasip1/release:/etc/envoy/proxy-wasm-plugins
networks:
- envoymesh
networks:
Expand Down

0 comments on commit 76f81aa

Please sign in to comment.