mirror of
https://github.com/emilk/egui.git
synced 2026-06-27 07:03:14 -04:00
Prerequisite of https://github.com/emilk/egui/pull/6744. See: https://github.com/gfx-rs/wgpu/pull/7218, https://github.com/gfx-rs/wgpu/pull/7425 Please be aware that Rust 1.84 enables some (more) WASM extensions by default, and ships with an `std` built with them enabled: https://blog.rust-lang.org/2024/09/24/webassembly-targets-change-in-default-target-features/ According to `rustc +1.84 --print=cfg --target wasm32-unknown-unknown`, these are: `multivalue`, `mutable-globals`, `reference-types`, and `sign-ext`. (c.f. `rustc +1.84 --print=cfg --target wasm32-unknown-unknown -C target-cpu=mvp` enabling none.) For reference: https://webassembly.org/features/ ---- If support is desired for ancient/esoteric browsers that don't have these implemented, there are two ways to get around this: - Target `wasm32v1-none` instead, but that's a `no-std` target, and I suppose a lot of dependencies don't work that way (e.g. https://github.com/gfx-rs/wgpu/issues/6826) - Using the `-Ctarget-cpu=mvp` and `-Zbuild-std=panic_abort,std` flags, and the `RUSTC_BOOTSTRAP=1` escape hatch to allow using the latter with non-`nightly` toolchains - until https://github.com/rust-lang/wg-cargo-std-aware is stabilized. (For reference: https://github.com/ruffle-rs/ruffle/pull/18528/files#diff-fb2896d189d77b35ace9a079c1ba9b55777d16e0f11ce79f776475a451b1825a) I don't think either of these is particularly advantageous, so I suggest just accepting that browsers will have to have some extensions implemented to run `egui`.
61 lines
1.9 KiB
YAML
61 lines
1.9 KiB
YAML
# This action builds and deploys egui_demo_app on each pull request created
|
|
# Security notes:
|
|
# The preview deployment is split in two workflows, preview_build and preview_deploy.
|
|
# `preview_build` runs on pull_request, so it won't have any access to the repositories secrets, so it is safe to
|
|
# build / execute untrusted code.
|
|
# `preview_deploy` has access to the repositories secrets (so it can push to the pr preview repo) but won't run
|
|
# any untrusted code (it will just extract the build artifact and push it to the pages branch where it will
|
|
# automatically be deployed).
|
|
|
|
name: Preview Build
|
|
|
|
on:
|
|
- pull_request
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@master
|
|
with:
|
|
toolchain: 1.84.0
|
|
targets: wasm32-unknown-unknown
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
prefix-key: "pr-preview-"
|
|
|
|
- name: Install wasm-opt
|
|
uses: sigoden/install-binary@v1
|
|
with:
|
|
repo: WebAssembly/binaryen
|
|
tag: version_123
|
|
name: wasm-opt
|
|
|
|
- run: |
|
|
scripts/build_demo_web.sh --release
|
|
|
|
- name: Remove gitignore file
|
|
# We need to remove the .gitignore, otherwise the deploy via git will not include the js and wasm files
|
|
run: |
|
|
rm -rf web_demo/.gitignore
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: web_demo
|
|
path: web_demo
|
|
|
|
- name: Generate meta.json
|
|
env:
|
|
PR_NUMBER: ${{ github.event.number }}
|
|
URL_SLUG: ${{ github.event.number }}-${{ github.head_ref }}
|
|
run: |
|
|
# Sanitize the URL_SLUG to only contain alphanumeric characters and dashes
|
|
URL_SLUG=$(echo $URL_SLUG | tr -cd '[:alnum:]-')
|
|
echo "{\"pr_number\": \"$PR_NUMBER\", \"url_slug\": \"$URL_SLUG\"}" > meta.json
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: meta.json
|
|
path: meta.json
|