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
4 changes: 3 additions & 1 deletion .github/actions/setup-test-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ runs:
# https://github.com/jetli/wasm-pack-action/issues/23
version: v0.14.0

# cargo-expand's output shape feeds the snapshots, so an unpinned
# upgrade would read as codegen drift and misattribute the cause.
- name: Add cargo-expand
shell: bash
run: cargo install cargo-expand
run: cargo install cargo-expand --version 1.0.124 --locked

# Log the resolved wasm-bindgen version so failures can be attributed
# to a dependency release vs. a toolchain change.
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/check-wasmbindgen-changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ on:
- cron: "0 0 * * *" # every day at midnight GMT
workflow_dispatch:

# The bot branch is force-pushed, so a manual run overlapping the nightly one
# would have them overwrite each other's work.
concurrency:
group: check-wasmbindgen-changes
cancel-in-progress: false

env:
TARGET_BRANCH: ${{ github.event.pull_request.base.ref || github.ref_name }}

Expand Down Expand Up @@ -67,13 +73,15 @@ jobs:

- name: Check for changes
run: |
if git diff --quiet -- tests; then
# `git diff` alone would miss a snapshot for a newly added
# test, which is untracked until it is staged.
git add -A tests
if git diff --cached --quiet -- tests; then
echo "Expanded test artifacts are unchanged; nothing to do."
exit 0
fi

echo "Creating PR with changes..."
git add tests
git commit -m "Update expanded test artifacts for wasm-bindgen ${{ steps.setup.outputs.wasm-bindgen-version }}"
git push --force --set-upstream origin update-expanded-test-artifacts

Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/latest-deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ on:
- cron: "0 2 * * 1" # every Monday 02:00 GMT
workflow_dispatch:

# Two runs racing would each decide independently whether to file or close the
# tracking issue.
concurrency:
group: latest-deps
cancel-in-progress: false

permissions:
contents: read
issues: write
Expand All @@ -34,6 +40,9 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v6
with:
# Nothing here pushes, so don't leave the token to the build.
persist-credentials: false

- name: Setup test environment
id: setup
Expand Down
53 changes: 9 additions & 44 deletions .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,13 @@ jobs:
uses: actions/checkout@v6

- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
run: rustup toolchain install stable --profile minimal --override

- name: Check
uses: actions-rs/cargo@v1
with:
command: check
run: cargo check

- name: Build
uses: actions-rs/cargo@v1
with:
command: build
run: cargo build
test:
name: Test
runs-on: ubuntu-latest
Expand All @@ -39,30 +31,11 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v6

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
# This job compares the expansion snapshots that the nightly
# workflow regenerates, so both must use the same cargo-expand.
- name: Setup test environment
uses: ./.github/actions/setup-test-env

- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt

- name: Install wasm-pack
uses: jetli/wasm-pack-action@v0.4.0
with:
# specify exact version to work around
# https://github.com/jetli/wasm-pack-action/issues/23
version: v0.14.0

- name: Add cargo-expand
run: cargo install cargo-expand

# Run the ./test.sh script
- name: Test
run: ./test.sh
lint:
Expand All @@ -74,18 +47,10 @@ jobs:
uses: actions/checkout@v6

- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy
run: rustup toolchain install stable --profile minimal --component rustfmt --component clippy --override

- name: Cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
run: cargo fmt --all -- --check

- name: Cargo clippy
run: cargo clippy -- -D warnings
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ Required tools: stable Rust, [wasm-pack](https://rustwasm.github.io/wasm-pack/),
[cargo-expand](https://github.com/dtolnay/cargo-expand) (for the expand tests),
and Node.js (for the wasm/e2e tests).

CI pins cargo-expand to the version in `.github/actions/setup-test-env`. Its
output shape feeds the snapshots, so regenerate them with that version.

## Expansion snapshots (`tests/expand/*.expanded.rs`)

The snapshot files record the full macro expansion of `#[derive(Tsify)]`,
Expand Down
Loading