Skip to content

Fix bug from early ported ocaml code regarding zeroes and program representation. Add a cl23.1 sigil that enables this and add many tests. #444

Fix bug from early ported ocaml code regarding zeroes and program representation. Add a cl23.1 sigil that enables this and add many tests.

Fix bug from early ported ocaml code regarding zeroes and program representation. Add a cl23.1 sigil that enables this and add many tests. #444

Workflow file for this run

name: npm publish
on:
push:
branches:
- base
release:
types: [published]
pull_request:
branches:
- '**'
concurrency:
# SHA is added to the end if on `main` to let all main workflows run
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main') && github.sha || '' }}
cancel-in-progress: true
jobs:
build_npm:
name: Npm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set Env
uses: Chia-Network/actions/setjobenv@main
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up rusts
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy
- name: install wasm-pack
run: cargo install --version 0.11.1 wasm-pack
- name: wasm-pack build and pack
run: wasm-pack build --release --target=nodejs wasm && wasm-pack pack wasm
- name: Setup Node 16.x
uses: actions/setup-node@v3
with:
node-version: '16.x'
# Cargo.toml won't allow an "@" in the name, so we just update the package name this way for NPM
- name: Update package name for npm
working-directory: ${{ github.workspace }}/wasm/pkg
run: |
cp package.json package.json.orig
jq '.name="@chia/chialisp"' package.json > temp.json && mv temp.json package.json
- name: Test wasm
run: node wasm/tests/index.js
- name: Test clvm-js like wasm interface
run: |
cd wasm/tests/clvm-tools-interface && npm install && yarn test
- name: Upload npm pkg artifacts
uses: actions/upload-artifact@v3
with:
name: npm-pkg
path: ./wasm/pkg/clvm_tools_wasm-*.tgz
- name: Test for secrets access
id: check_secrets
shell: bash
run: |
unset HAS_SECRET
if [ -n "$SECRET" ]; then HAS_SECRET='true' ; fi
echo "HAS_SECRET=${HAS_SECRET}" >>$GITHUB_OUTPUT
env:
SECRET: "${{ secrets.NPM_TOKEN }}"
- name: Publish wasm
if: env.FULL_RELEASE == 'true' && steps.check_secrets.outputs.HAS_SECRET
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
working-directory: ${{ github.workspace }}/wasm/pkg
run: |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
rm -f clvm_tools_wasm-*.tgz
npm publish --access public