Skip to content

Commit

Permalink
Merge branch 'main' into wasip1
Browse files Browse the repository at this point in the history
  • Loading branch information
PiotrSikora authored Oct 27, 2024
2 parents 00e1e90 + 7266794 commit 8f6f2cd
Show file tree
Hide file tree
Showing 23 changed files with 219 additions and 1,095 deletions.
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.2.1
7.4.0
141 changes: 126 additions & 15 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ jobs:
with:
go-version: '^1.16'

- name: Cache
if: ${{ env.ACT }}
uses: actions/cache@v2
with:
path: |
~/go/pkg/mod
key: licenses-${{ hashFiles('.github/workflows/rust.yml') }}

- name: Check licenses
run: |
go install github.com/google/addlicense@latest
Expand All @@ -53,11 +61,6 @@ jobs:
with:
go-version: '^1.16'

- name: Install dependencies
if: ${{ env.ACT }}
run: |
go install github.com/bazelbuild/[email protected]
- name: Cache
uses: actions/cache@v2
with:
Expand All @@ -66,9 +69,16 @@ jobs:
~/.cache/bazelisk
~/.cargo/.crates.toml
~/.cargo/.crates2.json
~/.cargo/advisory-db
~/.cargo/bin
~/.cargo/registry
key: ${{ hashFiles('WORKSPACE', '.bazelrc', '.bazelversion', 'bazel/cargo/Cargo.Bazel.lock', 'bazel/dependencies.bzl', 'bazel/repositories.bzl') }}
~/go/pkg/mod
key: bazel-${{ hashFiles('BUILD', 'WORKSPACE', '.bazelrc', '.bazelversion', 'bazel/cargo/Cargo.Bazel.lock', 'bazel/dependencies.bzl', 'bazel/repositories.bzl') }}

- name: Install dependencies
if: ${{ env.ACT }}
run: |
go install github.com/bazelbuild/[email protected]
- name: Build (wasm32-unknown-unknown)
run: bazelisk --noworkspace_rc build --noenable_bzlmod --platforms=@rules_rust//rust/platform:wasm //...
Expand All @@ -80,8 +90,7 @@ jobs:
run: |
go install github.com/bazelbuild/buildtools/buildifier@latest
export PATH=$PATH:$(go env GOPATH)/bin
buildifier -mode=check WORKSPACE
buildifier -mode=check BUILD
buildifier -mode=check -r .
- name: Format (rules_rust)
run: |
Expand All @@ -97,6 +106,20 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Cache
if: ${{ env.ACT }}
uses: actions/cache@v2
with:
path: |
~/.cargo/.crates.toml
~/.cargo/.crates2.json
~/.cargo/advisory-db
~/.cargo/bin
~/.cargo/registry
~/.rustup
**/target
key: msrv-${{ hashFiles('Cargo.toml') }}

- name: Install dependencies
if: ${{ env.ACT }}
run: |
Expand Down Expand Up @@ -146,6 +169,20 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Cache
if: ${{ env.ACT }}
uses: actions/cache@v2
with:
path: |
~/.cargo/.crates.toml
~/.cargo/.crates2.json
~/.cargo/advisory-db
~/.cargo/bin
~/.cargo/registry
~/.rustup
**/target
key: stable-${{ hashFiles('Cargo.toml') }}

- name: Install dependencies
if: ${{ env.ACT }}
run: |
Expand Down Expand Up @@ -194,6 +231,20 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Cache
if: ${{ env.ACT }}
uses: actions/cache@v2
with:
path: |
~/.cargo/.crates.toml
~/.cargo/.crates2.json
~/.cargo/advisory-db
~/.cargo/bin
~/.cargo/registry
~/.rustup
**/target
key: nightly-${{ hashFiles('Cargo.toml') }}

- name: Install dependencies
if: ${{ env.ACT }}
run: |
Expand Down Expand Up @@ -240,6 +291,19 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Cache
if: ${{ env.ACT }}
uses: actions/cache@v2
with:
path: |
~/.cargo/.crates.toml
~/.cargo/.crates2.json
~/.cargo/advisory-db
~/.cargo/bin
~/.cargo/registry
~/.rustup
key: outdated-${{ hashFiles('Cargo.toml') }}

- name: Install dependencies
if: ${{ env.ACT }}
run: |
Expand All @@ -260,6 +324,19 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Cache
if: ${{ env.ACT }}
uses: actions/cache@v2
with:
path: |
~/.cargo/.crates.toml
~/.cargo/.crates2.json
~/.cargo/advisory-db
~/.cargo/bin
~/.cargo/registry
~/.rustup
key: audit-${{ hashFiles('Cargo.toml') }}

- name: Install dependencies
if: ${{ env.ACT }}
run: |
Expand All @@ -276,7 +353,7 @@ jobs:
cp -p bazel/cargo/Cargo.Bazel.lock Cargo.lock
cargo audit
example:
examples:
runs-on: ubuntu-latest

strategy:
Expand All @@ -299,6 +376,20 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Cache
if: ${{ env.ACT }}
uses: actions/cache@v2
with:
path: |
~/.cargo/.crates.toml
~/.cargo/.crates2.json
~/.cargo/advisory-db
~/.cargo/bin
~/.cargo/registry
~/.rustup
**/target
key: example-${{ matrix.example }}-${{ hashFiles('Cargo.toml') }}

- name: Install dependencies
if: ${{ env.ACT }}
run: |
Expand Down Expand Up @@ -326,9 +417,11 @@ jobs:
run: cargo verify-project

- name: Run cargo audit
if: ${{ !env.ACT }}
run: cargo audit

- name: Run cargo outdated
if: ${{ !env.ACT }}
run: cargo outdated --root-deps-only --exit-code 1

- name: Validate Envoy config
Expand All @@ -340,7 +433,7 @@ jobs:
--mode validate \
-c envoy.yaml
reactor:
reactors:
runs-on: ubuntu-latest

strategy:
Expand All @@ -363,12 +456,26 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Cache
if: ${{ env.ACT }}
uses: actions/cache@v2
with:
path: |
~/.cargo/.crates.toml
~/.cargo/.crates2.json
~/.cargo/advisory-db
~/.cargo/bin
~/.cargo/registry
~/.rustup
**/target
key: reactor-${{ matrix.example }}-${{ hashFiles('Cargo.toml') }}

- name: Install dependencies
if: ${{ env.ACT }}
run: |
curl -OL https://static.rust-lang.org/rustup/rustup-init.sh
chmod +x ./rustup-init.sh
./rustup-init.sh -y
./rustup-init.sh -y --default-toolchain nightly
rm rustup-init.sh
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
Expand Down Expand Up @@ -396,11 +503,15 @@ jobs:
- name: Format (manifest)
run: cargo verify-project

- name: Run cargo audit
run: cargo audit
# TODO: Re-enable once cargo audit supports Cargo lockfile v4.
#- name: Run cargo audit
# if: ${{ !env.ACT }}
# run: cargo audit

- name: Run cargo outdated
run: cargo outdated --root-deps-only --exit-code 1
# TODO: Re-enable once cargo outdated supports Cargo lockfile v4.
#- name: Run cargo outdated
# if: ${{ !env.ACT }}
# run: cargo outdated --root-deps-only --exit-code 1

- name: Rename .wasm to match expected filename
run: |
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "proxy-wasm"
version = "0.2.2"
version = "0.2.3-dev"
authors = ["Piotr Sikora <[email protected]>"]
rust-version = "1.64"
description = "WebAssembly for Proxies"
Expand All @@ -11,7 +11,7 @@ edition = "2018"
build = "build.rs"

[dependencies]
hashbrown = "0.14"
hashbrown = "0.15"
log = "0.4"

[profile.release]
Expand Down
32 changes: 32 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Development

## Testing

GitHub Actions can be executed locally using the [`act`] tool.

All tests can be executed using:

act

Individual tests can be executed using `-j` and `--matrix` parameters, e.g.:

act -j bazel
act -j stable
act -j nightly
act -j examples --matrix example:http_auth_random

By default, all jobs are cached in `~/.cache/actcache`. This can be disabled
using the `--no-cache-server` parameter.

## Updating Bazel dependencies

When adding or updating Cargo dependencies, the existing Bazel `BUILD` files
must be regenerated using the [`bazelisk`] tool:

```sh
bazelisk run //bazel/cargo:crates_vendor -- --repin all
```


[`act`]: https://github.com/nektos/act
[`bazelisk`]: https://github.com/bazelbuild/bazelisk
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@
- [Extending Envoy with WASM and Rust](https://antweiss.com/blog/extending-envoy-with-wasm-and-rust/)
- [Writing Envoy filters in Rust with WebAssembly](https://content.red-badger.com/resources/extending-istio-with-rust-and-webassembly)

## Updating dependencies
## Contributing changes

When updating dependencies, you need to regenerate Bazel `BUILD` files to match updated `Cargo.toml`:

```sh
bazel run //bazel/cargo:crates_vendor -- --repin all
```
See [CONTRIBUTING.md](./CONTRIBUTING.md) and [DEVELOPMENT.md](./DEVELOPMENT.md) files.
1 change: 0 additions & 1 deletion bazel/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

Loading

0 comments on commit 8f6f2cd

Please sign in to comment.