Skip to content

Commit c608fc5

Browse files
committed
Add wasm32-unknown-emscripten to CI
1 parent a3518c2 commit c608fc5

File tree

2 files changed

+38
-14
lines changed

2 files changed

+38
-14
lines changed

.github/actions/setup-deps/action.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ inputs:
33
target:
44
description: 'rust target being set up'
55
required: true
6+
emscripten_sdk:
7+
description: 'emsdk version to install'
8+
default: latest
69
wasi_sdk:
710
description: 'wasi-sdk version to install'
811
default: 27
@@ -43,11 +46,26 @@ runs:
4346
sudo apt-get update -y
4447
sudo apt-get install -y --no-install-recommends gcc-mingw-w64-x86-64
4548
shell: bash
49+
4650
- name: Install emscripten (wasm32-unknown-emscripten)
4751
if: ${{ inputs.target == 'wasm32-unknown-emscripten' }}
4852
run: |
49-
sudo apt-get update -y
50-
sudo apt-get install -y --no-install-recommends emscripten
53+
EM_CONFIG=$HOME/emsdk/.emscripten
54+
echo "EM_CONFIG=$EM_CONFIG" >> $GITHUB_ENV
55+
curl -L -o ~/emsdk-main.tar.gz https://github.com/emscripten-core/emsdk/archive/main.tar.gz
56+
tar -C ~ -xf ~/emsdk-main.tar.gz
57+
mv ~/emsdk-main ~/emsdk
58+
cd ~/emsdk
59+
./emsdk install ${{ inputs.emscripten_sdk }}
60+
./emsdk activate ${{ inputs.emscripten_sdk }}
61+
source ./emsdk_env.sh
62+
echo "EMSDK=$EMSDK" >> $GITHUB_ENV
63+
echo "EMSDK_NODE=$EMSDK_NODE" >> $GITHUB_ENV
64+
echo "CC_wasm32_unknown_emscripten=$EMSDK/upstream/emscripten/emcc" >> $GITHUB_ENV
65+
echo "CXX_wasm32_unknown_emscripten=$EMSDK/upstream/emscripten/em++" >> $GITHUB_ENV
66+
echo "AR_wasm32_unknown_emscripten=$EMSDK/upstream/emscripten/emar" >> $GITHUB_ENV
67+
echo "CARGO_TARGET_WASM32_UNKNOWN_EMSCRIPTEN_LINKER=$EMSDK/upstream/emscripten/emcc" >> $GITHUB_ENV
68+
echo "CARGO_TARGET_WASM32_UNKNOWN_EMSCRIPTEN_RUNNER=$EMSDK_NODE" >> $GITHUB_ENV
5169
shell: bash
5270

5371
- name: Install wasi-sdk/Wasmtime (wasm32-wasip2)

.github/workflows/main.yml

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ jobs:
77
runs-on: ${{ matrix.os }}
88
strategy:
99
matrix:
10+
lua: [lua54, lua53, lua52, lua51]
1011
target:
1112
- x86_64-unknown-linux-gnu
1213
- i686-unknown-linux-gnu
@@ -18,7 +19,6 @@ jobs:
1819
- x86_64-pc-windows-msvc
1920
- wasm32-unknown-emscripten
2021
- wasm32-wasip2
21-
lua: [lua54, lua53, lua52, lua51]
2222
include:
2323
- target: x86_64-unknown-linux-gnu
2424
os: ubuntu-latest
@@ -47,7 +47,7 @@ jobs:
4747
target: ${{ matrix.target }}
4848
- name: Build ${{ matrix.lua }}
4949
run: |
50-
cargo build --manifest-path testcrate/Cargo.toml --release --features ${{ matrix.lua }}
50+
cargo build --manifest-path testcrate/Cargo.toml --release --features ${{ matrix.lua }} --target ${{ matrix.target }}
5151
shell: bash
5252

5353
test:
@@ -56,29 +56,35 @@ jobs:
5656
needs: build
5757
strategy:
5858
matrix:
59+
lua: [lua54, lua53, lua52, lua51]
5960
target:
6061
- x86_64-unknown-linux-gnu
6162
- x86_64-apple-darwin
63+
- aarch64-apple-darwin
6264
- x86_64-pc-windows-msvc
65+
- wasm32-unknown-emscripten
6366
- wasm32-wasip2
64-
lua: [lua54, lua53, lua52, lua51]
6567
include:
66-
- os: ubuntu-latest
67-
target: x86_64-unknown-linux-gnu
68-
- os: macos-latest
69-
target: x86_64-apple-darwin
70-
- os: windows-latest
71-
target: x86_64-pc-windows-msvc
72-
- os: ubuntu-latest
73-
target: wasm32-wasip2
68+
- target: x86_64-unknown-linux-gnu
69+
os: ubuntu-latest
70+
- target: x86_64-apple-darwin
71+
os: macos-latest
72+
- target: aarch64-apple-darwin
73+
os: macos-latest
74+
- target: x86_64-pc-windows-msvc
75+
os: windows-latest
76+
- target: wasm32-unknown-emscripten
77+
os: ubuntu-latest
78+
- target: wasm32-wasip2
79+
os: ubuntu-latest
7480
steps:
7581
- uses: actions/checkout@main
7682
- uses: ./.github/actions/setup-deps
7783
with:
7884
target: ${{ matrix.target }}
7985
- name: Run ${{ matrix.lua }} tests
8086
run: |
81-
cargo test --manifest-path testcrate/Cargo.toml --release --features ${{ matrix.lua }}
87+
cargo test --manifest-path testcrate/Cargo.toml --release --features ${{ matrix.lua }} --target ${{ matrix.target }}
8288
shell: bash
8389

8490
test_standalone:

0 commit comments

Comments
 (0)