feat: add wrapping functions in stdlib and use them in relevant test … #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ABI Wasm test | |
on: | |
pull_request: | |
merge_group: | |
push: | |
branches: | |
- master | |
# This will cancel previous runs when a branch or PR is updated | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
CACHED_PATH: /tmp/nix-cache | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
- uses: cachix/install-nix-action@v20 | |
with: | |
nix_path: nixpkgs=channel:nixos-23.05 | |
github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Restore nix store cache | |
uses: actions/cache/restore@v3 | |
id: cache | |
with: | |
path: ${{ env.CACHED_PATH }} | |
key: ${{ runner.os }}-flake-abi-wasm-${{ hashFiles('*.lock') }} | |
# Based on https://github.com/marigold-dev/deku/blob/b5016f0cf4bf6ac48db9111b70dd7fb49b969dfd/.github/workflows/build.yml#L26 | |
- name: Copy cache into nix store | |
if: steps.cache.outputs.cache-hit == 'true' | |
# We don't check the signature because we're the one that created the cache | |
run: | | |
for narinfo in ${{ env.CACHED_PATH }}/*.narinfo; do | |
path=$(head -n 1 "$narinfo" | awk '{print $2}') | |
nix copy --no-check-sigs --from "file://${{ env.CACHED_PATH }}" "$path" | |
done | |
- name: Build noirc_abi_wasm | |
run: | | |
nix build -L .#noirc_abi_wasm | |
cp -r ./result/noirc_abi_wasm/nodejs ./tooling/noirc_abi_wasm | |
cp -r ./result/noirc_abi_wasm/web ./tooling/noirc_abi_wasm | |
- name: Export cache from nix store | |
if: ${{ steps.cache.outputs.cache-hit != 'true' && github.event_name != 'merge_group' }} | |
run: | | |
nix copy --to "file://${{ env.CACHED_PATH }}?compression=zstd¶llel-compression=true" .#noirc-abi-wasm-cargo-artifacts | |
- uses: actions/cache/save@v3 | |
# Don't create cache entries for the merge queue. | |
if: ${{ steps.cache.outputs.cache-hit != 'true' && github.event_name != 'merge_group' }} | |
with: | |
path: ${{ env.CACHED_PATH }} | |
key: ${{ steps.cache.outputs.cache-primary-key }} | |
- name: Dereference symlink | |
run: echo "UPLOAD_PATH=$(readlink -f ./result/noirc_abi_wasm)" >> $GITHUB_ENV | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: noirc_abi_wasm | |
path: ${{ env.UPLOAD_PATH }} | |
retention-days: 10 | |
test: | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
- name: Download wasm package artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: noirc_abi_wasm | |
path: ./tooling/noirc_abi_wasm | |
- name: Install Yarn dependencies | |
uses: ./.github/actions/setup | |
- name: Run node tests | |
run: yarn workspace @noir-lang/noirc_abi test | |
- name: Install Playwright | |
uses: ./.github/actions/install-playwright | |
- name: Run browser tests | |
run: yarn workspace @noir-lang/noirc_abi test:browser | |