Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,12 @@ jobs:
- run: rustup component add clippy
- run: cargo clippy --workspace

# Re-vendor all WIT files and ensure that they're all up-to-date by ensuring
# that there's no git changes.
- name: Re-vendor WIT
run: ./ci/vendor-wit.sh
- run: git diff --exit-code

# common logic to cancel the entire run if this job fails
- run: gh run cancel ${{ github.run_id }}
if: failure() && github.event_name != 'pull_request'
Expand Down Expand Up @@ -526,12 +532,6 @@ jobs:
RUST_BACKTRACE: 1
if: matrix.target == '' && matrix.os != 'windows-latest' && needs.determine.outputs.test-capi

# Ensure wit definitions are in sync: both wasmtime-wasi and wasmtime-wasi-http need their own
# copy of the wit definitions so publishing works, but we need to ensure they are identical copies.
- name: Check that the wasi and wasi-http wit directories agree
run: |
diff -ru crates/wasi/wit crates/wasi-http/wit

# Record some CPU details; this is helpful information if tests fail due
# to CPU-specific features.
- name: CPU information
Expand Down
33 changes: 33 additions & 0 deletions ci/vendor-wit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/sh

# Script to re-vendor the WIT files that Wasmtime uses as defined by a
# particular tag in upstream repositories.
#
# This script is executed on CI to ensure that everything is up-to-date.

# Space-separated list of wasi proposals that are vendored here along with the
# tag that they're all vendored at.
#
# This assumes that the repositories all have the pattern:
# https://github.com/WebAssembly/wasi-$repo
# and every repository has a tag `v$tag` here. That is currently done as part
# of the WASI release process.
repos="cli clocks filesystem http io random sockets"
tag=0.2.0

set -ex

dst=crates/wasi/wit/deps

rm -rf $dst

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe check git diff --exit-code before this and exit the script before doing any permanent deletions if there are local, uncommitted changes? Just to be safe.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I'd prefer to leave that to CI because it makes editing a script like this hard to work with and git is otherwise pretty good about making sure things aren't overwritten.

mkdir -p $dst

for repo in $repos; do
mkdir $dst/$repo
curl -L https://github.com/WebAssembly/wasi-$repo/archive/refs/tags/v$tag.tar.gz | \
tar xzf - --strip-components=2 -C $dst/$repo wasi-$repo-$tag/wit
rm -rf $dst/$repo/deps*
done

rm -rf crates/wasi-http/wit/deps
cp -r $dst crates/wasi-http/wit
5 changes: 2 additions & 3 deletions crates/wasi-http/wit/deps/io/poll.wit
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ interface poll {
/// The result `list<u32>` contains one or more indices of handles in the
/// argument list that is ready for I/O.
///
/// This function traps if either:
/// - the list is empty, or:
/// - the list contains more elements than can be indexed with a `u32` value.
/// If the list contains more elements than can be indexed with a `u32`
/// value, this function traps.
///
/// A timeout can be implemented by adding a pollable from the
/// wasi-clocks API to the list.
Expand Down
5 changes: 2 additions & 3 deletions crates/wasi/wit/deps/io/poll.wit
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ interface poll {
/// The result `list<u32>` contains one or more indices of handles in the
/// argument list that is ready for I/O.
///
/// This function traps if either:
/// - the list is empty, or:
/// - the list contains more elements than can be indexed with a `u32` value.
/// If the list contains more elements than can be indexed with a `u32`
/// value, this function traps.
///
/// A timeout can be implemented by adding a pollable from the
/// wasi-clocks API to the list.
Expand Down