Skip to content

Switch from Karma to Web Test Runner, and ES6 module exports #53

Switch from Karma to Web Test Runner, and ES6 module exports

Switch from Karma to Web Test Runner, and ES6 module exports #53

Workflow file for this run

name: Publish
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
default:
name: "Default"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
- name: Default
run: |
npm install
npx playwright install-deps
npx playwright install
sh setup.sh
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install latest
./emsdk activate latest
cd ..
source ./emsdk/emsdk_env.sh
cd emscriptenbuild
./build.sh Release
./build.sh Release-async
cd ..
set -e
npm run test
export VERSION=`npm view wasm-git dist-tags.latest`
export NEWVERSION=`node -p "require('./package.json').version"`
echo $VERSION $NEWVERSION
./preparepublishnpm.sh
PACKAGEFILE=`npm pack | tail -n 1`
tar -xvzf $PACKAGEFILE
echo "run browser tests with npm package"
rm test-browser/lg2.*
cp package/lg2.* test-browser/
npm run test-browser
rm test-browser-async/lg2_async.*
cp package/lg2_async.* test-browser-async/
npm run test-browser-async
BRANCH="$(git rev-parse --abbrev-ref HEAD)"
if [[ "$VERSION" = "$NEWVERSION" || "$BRANCH" != "master" ]]; then
echo "version change is $VERSION->$NEWVERSION, branch is $BRANCH, not publishing, only dry-run"
npm publish --dry-run
else
npm publish
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}