Skip to content

1.3.1

1.3.1 #1097

Workflow file for this run

name: Build
on:
push:
paths-ignore:
- '**/*.md'
- '**/docs/**'
branches:
- main
- test-*
tags:
- v*
- wasi-threads-v*
pull_request:
paths-ignore:
- '**/*.md'
- '**/docs/**'
workflow_dispatch:
env:
WASI_VERSION: '22'
WASI_VERSION_FULL: '22.0'
WASI_SDK_PATH: './wasi-sdk-22.0'
EM_VERSION: '3.1.52'
EM_CACHE_FOLDER: 'emsdk-cache'
jobs:
build:
timeout-minutes: 15
name: Build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target:
- 'wasm32-unknown-emscripten'
- 'wasm64-unknown-emscripten'
- 'wasm32-unknown-unknown'
- 'wasm32-wasi'
- 'wasm32-wasi-threads'
steps:
- uses: actions/checkout@v4
- name: Install Ninja
run: |
sudo apt-get update
sudo apt-get install ninja-build
- name: Setup Emscripten cache
if: ${{ contains(matrix.target, 'emscripten') }}
id: cache-system-libraries
uses: actions/cache@v3
with:
path: ${{env.EM_CACHE_FOLDER}}
key: ${{env.EM_VERSION}}-${{ runner.os }}-${{ matrix.target }}
- uses: mymindstorm/setup-emsdk@v14
if: ${{ contains(matrix.target, 'emscripten') }}
with:
version: ${{ env.EM_VERSION }}
# no-cache: true
actions-cache-folder: ${{ env.EM_CACHE_FOLDER }}
# - uses: actions-rs/toolchain@v1
# if: ${{ matrix.target == 'wasm32-unknown-unknown' || matrix.target == 'wasm32-wasi' }}
# with:
# toolchain: nightly
# default: true
# target: ${{ matrix.target }}
- name: Install wasi-sdk
if: ${{ matrix.target == 'wasm32-unknown-unknown' || matrix.target == 'wasm32-wasi' || matrix.target == 'wasm32-wasi-threads' }}
shell: bash
run: |
wget -q https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VERSION}/wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz
mkdir -p $WASI_SDK_PATH
tar zxvf wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz -C $WASI_SDK_PATH --strip 1
- uses: actions/setup-node@v3
with:
node-version: '20.9.0'
registry-url: 'https://registry.npmjs.org'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: NPM Install
shell: bash
run: |
npm install -g node-gyp
npm install --ignore-scripts
- name: NPM Build
shell: bash
run: npm run build --workspaces --if-present
- name: Test Emscripten ESM library
shell: bash
run: npm run test -w packages/ts-transform-emscripten-esm-library
- name: Test @emnapi/wasi-threads
if: ${{ matrix.target == 'wasm32-wasi-threads' }}
shell: bash
run: |
node ./packages/wasi-threads/test/build.js
npm run test -w packages/wasi-threads
timeout-minutes: 1
# - name: Lint
# run: npm run lint
- name: Test wasm32-wasi-threads
if: ${{ matrix.target == 'wasm32-wasi-threads' }}
run: |
npm run rebuild:wt -w packages/test
npm run test:wt -w packages/test
- name: Test wasm32-unknown-emscripten
if: ${{ matrix.target == 'wasm32-unknown-emscripten' }}
run: |
npm run test:version
npm run rebuild -w packages/test
npm run test -w packages/test
- name: Test wasm64-unknown-emscripten
if: ${{ matrix.target == 'wasm64-unknown-emscripten' }}
env:
MEMORY64: '1'
UV_THREADPOOL_SIZE: '2'
NODE_TEST_KNOWN_GLOBALS: '0'
run: |
node ./packages/test/script/build-emscripten.js Debug
node ./packages/test/script/test.js
- name: Test wasm32-wasi
if: ${{ matrix.target == 'wasm32-wasi' }}
run: |
npm run rebuild:w -w packages/test
npm run test:w -w packages/test
- name: Test wasm32-unknown-unknown
if: ${{ matrix.target == 'wasm32-unknown-unknown' }}
run: |
npm run rebuild:wasm32 -w packages/test
npm run test:wasm32 -w packages/test
release:
name: Release
if: ${{ startsWith(github.event.ref, 'refs/tags/v') }}
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Ninja
run: |
sudo apt-get update
sudo apt-get install ninja-build
- uses: mymindstorm/setup-emsdk@v14
with:
version: ${{ env.EM_VERSION }}
# no-cache: true
actions-cache-folder: ${{ env.EM_CACHE_FOLDER }}
- name: Install wasi-sdk
shell: bash
run: |
wget -q https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VERSION}/wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz
mkdir -p $WASI_SDK_PATH
tar zxvf wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz -C $WASI_SDK_PATH --strip 1
- uses: actions/setup-node@v3
with:
node-version: '20.9.0'
registry-url: 'https://registry.npmjs.org'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: NPM Install
shell: bash
run: |
npm install -g node-gyp
npm install --ignore-scripts
- name: NPM Build
shell: bash
run: npm run build --workspaces --if-present
- name: Publish
run: |
node ./script/release.js
npm publish --ignore-scripts -w packages/runtime -w packages/node -w packages/emnapi -w packages/core
- name: Create release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
draft: true
prerelease: false
generate_release_notes: true
files: ./script/emnapi.zip
release-wasi-threads:
name: Release
if: ${{ startsWith(github.event.ref, 'refs/tags/wasi-threads-v') }}
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: '20.9.0'
registry-url: 'https://registry.npmjs.org'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: NPM Install
shell: bash
run: |
npm install -g node-gyp
npm install --ignore-scripts
- name: NPM Build
shell: bash
run: npm run build -w packages/wasi-threads
- name: Publish
run: npm publish --ignore-scripts -w packages/wasi-threads