feat: Add pub
modifier
#8628
Workflow file for this run
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: Wasm | |
on: | |
pull_request: | |
merge_group: | |
push: | |
branches: | |
- master | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
build-nargo: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
target: [x86_64-unknown-linux-gnu] | |
steps: | |
- name: Checkout Noir repo | |
uses: actions/checkout@v4 | |
- name: Setup toolchain | |
uses: dtolnay/[email protected] | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
key: ${{ matrix.target }} | |
cache-on-failure: true | |
save-if: ${{ github.event_name != 'merge_group' }} | |
- name: Build Nargo | |
run: cargo build --package nargo_cli --release | |
- name: Package artifacts | |
run: | | |
mkdir dist | |
cp ./target/release/nargo ./dist/nargo | |
7z a -ttar -so -an ./dist/* | 7z a -si ./nargo-x86_64-unknown-linux-gnu.tar.gz | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: nargo | |
path: ./dist/* | |
retention-days: 3 | |
build-wasm: | |
runs-on: ubuntu-latest | |
env: | |
CACHED_PATH: /tmp/nix-cache | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Setup Nix | |
uses: cachix/install-nix-action@v22 | |
with: | |
nix_path: nixpkgs=channel:nixos-22.11 | |
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-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 wasm package | |
run: | | |
nix build -L .#noir_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" .#noir-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/noir_wasm)" >> $GITHUB_ENV | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: noir_wasm | |
path: ${{ env.UPLOAD_PATH }} | |
retention-days: 3 | |
test: | |
needs: [build-wasm, build-nargo] | |
name: Test noir_wasm | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout noir-lang/noir | |
uses: actions/checkout@v4 | |
- name: Download wasm package artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: noir_wasm | |
path: ./compiler/wasm/downloaded | |
- name: Download nargo binary | |
uses: actions/download-artifact@v3 | |
with: | |
name: nargo | |
path: ./nargo | |
- name: Compile test program with Nargo CLI | |
working-directory: ./compiler/wasm/noir-script | |
run: | | |
nargo_binary=${{ github.workspace }}/nargo/nargo | |
chmod +x $nargo_binary | |
$nargo_binary compile | |
- name: Install Yarn dependencies | |
uses: ./.github/actions/setup | |
- name: Install Playwright | |
uses: ./.github/actions/install-playwright | |
- name: Install dependencies | |
run: | | |
cp -r ./compiler/wasm/downloaded/nodejs ./compiler/wasm | |
cp -r ./compiler/wasm/downloaded/web ./compiler/wasm | |
yarn workspace @noir-lang/source-resolver build | |
- name: Run node tests | |
run: yarn workspace @noir-lang/noir_wasm test:node | |
- name: Run browser tests | |
run: yarn workspace @noir-lang/noir_wasm test:browser |