Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wasm32-wasi support with tests #677

Merged
merged 3 commits into from
May 28, 2023
Merged

Conversation

acfoltzer
Copy link
Contributor

@sunfishcode added wasm32-wasi support in #477, but somewhere along the way it appears to have been broken or dropped. Thankfully, the reason for the breakage doesn't appear too deep: the wasm-bindgen support was enabled for all wasm32 architectures, rather than just the wasm32-unknown-unknown target triple that wasm-bindgen supports.

This PR fixes the cfg expressions for wasm-bindgen-specific code so that they no longer catch wasm32-wasi, and now wasm32-wasi just works 🎉

To guard against future breakage, I added some wasm32-wasi testing infrastructure. A new CI target modeled on the wasm-bindgen target tests the wasm32-wasi implementation against wasmtime. Since test runners can't be specified at the command line, this requires a .cargo/config addition as well.

I also noticed and fixed a typo in the existing wasm-bindgen CI target that I believe has been causing the tests to not run with any of the version features enabled.

@sunfishcode added `wasm32-wasi` support in uuid-rs#477, but somewhere along the way it appears to have
been broken or dropped. Thankfully, the reason for the breakage doesn't appear too deep: the
`wasm-bindgen` support was enabled for all `wasm32` architectures, rather than just the
`wasm32-unknown-unknown` target triple that [`wasm-bindgen`
supports](https://rustwasm.github.io/wasm-bindgen/reference/rust-targets.html).

This PR fixes the `cfg` expressions for `wasm-bindgen`-specific code so that they no longer catch
`wasm32-wasi`, and now `wasm32-wasi` just works 🎉

To guard against future breakage, I added some `wasm32-wasi` testing infrastructure. A new CI
target modeled on the `wasm-bindgen` target tests the `wasm32-wasi` implementation against
`wasmtime`. Since test runners can't be specified at the command line, this requires a
`.cargo/config` addition as well.

I also noticed and fixed a typo in the existing `wasm-bindgen` CI target that I believe has been
causing the tests to not run with any of the version features enabled.
@acfoltzer acfoltzer marked this pull request as ready for review May 27, 2023 00:58
Copy link
Member

@KodrAus KodrAus left a comment

Choose a reason for hiding this comment

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

Thanks for working on this @acfoltzer! I just had one query about the .cargo/config, but am glad to have this covered in our CI.

@@ -0,0 +1,2 @@
[target.wasm32-wasi]
Copy link
Member

Choose a reason for hiding this comment

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

I’ve actually never used a Cargo config in a library before. I’m guessing this only applies to local builds of uuid?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's right, if you're doing local development and do cargo test --target wasm32-wasi, this configuration makes it automatically run the compiled Wasm by passing it to wasmtime. It has no impact on downstream consumers of the library. It's one of my favorite parlor tricks for Wasm development 😆

@KodrAus
Copy link
Member

KodrAus commented May 28, 2023

Thanks @acfoltzer! I’ll fix up the MSRV build in a subsequent PR.

@KodrAus KodrAus merged commit a0d6eb6 into uuid-rs:main May 28, 2023
@acfoltzer
Copy link
Contributor Author

@KodrAus thanks very much for the quick feedback 🙏🏻

kodiakhq bot pushed a commit to pdylanross/fatigue that referenced this pull request Jun 13, 2023
Bumps uuid from 1.3.3 to 1.3.4.

Release notes
Sourced from uuid's releases.

1.3.4
What's Changed

Add wasm32-wasi support with tests by @​acfoltzer in uuid-rs/uuid#677
Fix up MSRV build in CI by @​KodrAus in uuid-rs/uuid#679
fix: keep the order when filling random bytes by @​Hanaasagi in uuid-rs/uuid#682
Prepare for 1.3.4 release by @​KodrAus in uuid-rs/uuid#683

New Contributors

@​acfoltzer made their first contribution in uuid-rs/uuid#677
@​Hanaasagi made their first contribution in uuid-rs/uuid#682

Full Changelog: uuid-rs/uuid@1.3.3...1.3.4



Commits

07052be Merge pull request #683 from uuid-rs/cargo/1.3.4
80ec18c prepare for 1.3.4 release
4297536 Merge pull request #682 from Hanaasagi/fix-index
3af4733 fix: keep the order when filling random bytes
6188ecf Merge pull request #679 from uuid-rs/ci/msrv-build
e582a3d Just check v4 for MSRV
b466522 fix up MSRV build in CI
a0d6eb6 Merge pull request #677 from acfoltzer/wasm32-wasi
403f845 add installed wasmtime to GITHUB_PATH
f74e05e add wasm32-wasi target in CI
Additional commits viewable in compare view




Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

@dependabot rebase will rebase this PR
@dependabot recreate will recreate this PR, overwriting any edits that have been made to it
@dependabot merge will merge this PR after your CI passes on it
@dependabot squash and merge will squash and merge this PR after your CI passes on it
@dependabot cancel merge will cancel a previously requested merge and block automerging
@dependabot reopen will reopen this PR if it is closed
@dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
@dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
@dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
@dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
akrantz01 pushed a commit to akrantz01/lers that referenced this pull request Jun 13, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [uuid](https://togithub.com/uuid-rs/uuid) | dependencies | patch |
`1.3.3` -> `1.3.4` |

---

### Release Notes

<details>
<summary>uuid-rs/uuid</summary>

### [`v1.3.4`](https://togithub.com/uuid-rs/uuid/releases/tag/1.3.4)

[Compare
Source](https://togithub.com/uuid-rs/uuid/compare/1.3.3...1.3.4)

#### What's Changed

- Add `wasm32-wasi` support with tests by
[@&#8203;acfoltzer](https://togithub.com/acfoltzer) in
[uuid-rs/uuid#677
- Fix up MSRV build in CI by
[@&#8203;KodrAus](https://togithub.com/KodrAus) in
[uuid-rs/uuid#679
- fix: keep the order when filling random bytes by
[@&#8203;Hanaasagi](https://togithub.com/Hanaasagi) in
[uuid-rs/uuid#682
- Prepare for 1.3.4 release by
[@&#8203;KodrAus](https://togithub.com/KodrAus) in
[uuid-rs/uuid#683

#### New Contributors

- [@&#8203;acfoltzer](https://togithub.com/acfoltzer) made their first
contribution in
[uuid-rs/uuid#677
- [@&#8203;Hanaasagi](https://togithub.com/Hanaasagi) made their first
contribution in
[uuid-rs/uuid#682

**Full Changelog**:
uuid-rs/uuid@1.3.3...1.3.4

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/akrantz01/lers).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4xMTAuMCIsInVwZGF0ZWRJblZlciI6IjM1LjExMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
crapStone pushed a commit to Calciumdibromid/CaBr2 that referenced this pull request Jun 26, 2023
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [uuid](https://github.com/uuid-rs/uuid) | dependencies | patch | `1.3.3` -> `1.3.4` |

---

### Release Notes

<details>
<summary>uuid-rs/uuid</summary>

### [`v1.3.4`](https://github.com/uuid-rs/uuid/releases/tag/1.3.4)

[Compare Source](uuid-rs/uuid@1.3.3...1.3.4)

#### What's Changed

-   Add `wasm32-wasi` support with tests by [@&#8203;acfoltzer](https://github.com/acfoltzer) in uuid-rs/uuid#677
-   Fix up MSRV build in CI by [@&#8203;KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#679
-   fix: keep the order when filling random bytes by [@&#8203;Hanaasagi](https://github.com/Hanaasagi) in uuid-rs/uuid#682
-   Prepare for 1.3.4 release by [@&#8203;KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#683

#### New Contributors

-   [@&#8203;acfoltzer](https://github.com/acfoltzer) made their first contribution in uuid-rs/uuid#677
-   [@&#8203;Hanaasagi](https://github.com/Hanaasagi) made their first contribution in uuid-rs/uuid#682

**Full Changelog**: uuid-rs/uuid@1.3.3...1.3.4

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4xMTguMCIsInVwZGF0ZWRJblZlciI6IjM1LjExOC4wIiwidGFyZ2V0QnJhbmNoIjoiZGV2ZWxvcCJ9-->

Co-authored-by: cabr2-bot <cabr2.help@gmail.com>
Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1938
Reviewed-by: crapStone <crapstone01@gmail.com>
Co-authored-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
Co-committed-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants