Skip to content

Commit

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

Signed-off-by: Piotr Sikora <[email protected]>
  • Loading branch information
PiotrSikora authored Oct 27, 2024
1 parent 7266794 commit 6d88ed5
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 36 deletions.
48 changes: 24 additions & 24 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,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 @@ -196,19 +196,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 @@ -259,19 +259,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 @@ -402,13 +402,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 @@ -428,7 +428,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 @@ -482,20 +482,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 @@ -515,7 +515,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 @@ -524,7 +524,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 6d88ed5

Please sign in to comment.