Skip to content

Commit 17e3f7a

Browse files
committed
Update action.yaml
1 parent d5e6744 commit 17e3f7a

1 file changed

Lines changed: 32 additions & 18 deletions

File tree

.github/workflows/action.yaml

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,35 @@ on:
77
required: true
88
default: 'latest'
99
jobs:
10-
build:
11-
runs-on: windows-latest
12-
steps:
13-
- name: 读取仓库
14-
uses: actions/checkout@v4
15-
- name: 安装node
16-
uses: actions/setup-node@v4
17-
with:
18-
node-version: '22'
19-
- name: 安装rust
20-
uses: actions-rs/toolchain@v1
21-
- name: 安装cargo
22-
uses: actions-rs/cargo@v1
23-
- name: 安装 pnpm
24-
run: npm install -g pnpm
25-
26-
- name: 安装依赖
27-
run: pnpm install
10+
build_examples:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- run: rustup update --no-self-update stable && rustup default stable
15+
- run: rustup target add wasm32-unknown-unknown
16+
- run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -f
17+
- run: |
18+
cargo build -p wasm-bindgen-cli
19+
ln -snf `pwd`/target/debug/wasm-bindgen $(dirname `which cargo`)/wasm-bindgen
20+
# crete a workspace of all examples and install their dependencies at once
21+
# sed is used to convert the literal "\n" to a newline character
22+
- run: |
23+
[ -f pnpm-workspace.yaml ] || (echo 'packages:\n - "examples/*"' > pnpm-workspace.yaml && sed -i -e 's/\\n/\n/g' pnpm-workspace.yaml)
24+
- run: |
25+
[ -f package.json ] || (echo '{}' > package.json)
26+
- run: corepack pnpm install -r
27+
- run: |
28+
function build() {
29+
(cd examples/$1 &&
30+
(corepack pnpm run build -- --output-path ../../exbuild/$1 ||
31+
(./build.sh && mkdir -p ../../exbuild/$1 && cp -r ./* ../../exbuild/$1 && rm ../../exbuild/$1/**/.gitignore))
32+
) || exit 1;
33+
}
34+
export -f build
35+
ls examples | grep -v README | grep -v raytrace | grep -v deno | grep -v wasm-audio-worklet | parallel -j4 build
36+
env:
37+
RUSTFLAGS: --cfg=web_sys_unstable_apis
38+
- uses: actions/upload-artifact@v4
39+
with:
40+
name: examples1
41+
path: exbuild

0 commit comments

Comments
 (0)