From 179c90dc3263c85de105c57925d9c5894427e8e1 Mon Sep 17 00:00:00 2001 From: esau <152162806+sklppy88@users.noreply.github.com> Date: Wed, 10 Jan 2024 17:36:30 -0600 Subject: [PATCH] feat: docker testing flow (#3895) ## Summary\* Adds a building / testing flow for CI in docker ## Additional Context ## Documentation\* Check one: - [x] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[Exceptional Case]** Documentation to be submitted in a separate PR. # PR Checklist\* - [ ] I have tested the changes locally. - [ ] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings. --- .dockerignore | 9 + .github/scripts/acvm_js-build.sh | 5 + .github/scripts/acvm_js-test-browser.sh | 5 + .github/scripts/acvm_js-test.sh | 4 + .github/scripts/backend-barretenberg-build.sh | 4 + .github/scripts/backend-barretenberg-test.sh | 4 + .github/scripts/install_wasm-bindgen.sh | 5 + .github/scripts/integration-test.sh | 6 + .github/scripts/nargo-build.sh | 8 + .github/scripts/nargo-test.sh | 10 + .github/scripts/noir-codegen-build.sh | 4 + .github/scripts/noir-codegen-test.sh | 4 + .github/scripts/noir-js-build.sh | 4 + .github/scripts/noir-js-test.sh | 6 + .github/scripts/noir-js-types-build.sh | 4 + .github/scripts/noir-wasm-build.sh | 5 + .github/scripts/noir-wasm-test-browser.sh | 6 + .github/scripts/noir-wasm-test.sh | 7 + .github/scripts/noirc-abi-build.sh | 5 + .github/scripts/noirc-abi-test-browser.sh | 5 + .github/scripts/noirc-abi-test.sh | 4 + .github/workflows/docker-test-flow.yml | 733 ++++++++++++++++++ Dockerfile.ci | 49 +- .../nargo_compile_noir_codegen_assert_lt.sh | 4 - 24 files changed, 867 insertions(+), 33 deletions(-) create mode 100755 .github/scripts/acvm_js-build.sh create mode 100755 .github/scripts/acvm_js-test-browser.sh create mode 100755 .github/scripts/acvm_js-test.sh create mode 100755 .github/scripts/backend-barretenberg-build.sh create mode 100755 .github/scripts/backend-barretenberg-test.sh create mode 100755 .github/scripts/install_wasm-bindgen.sh create mode 100755 .github/scripts/integration-test.sh create mode 100755 .github/scripts/nargo-build.sh create mode 100755 .github/scripts/nargo-test.sh create mode 100755 .github/scripts/noir-codegen-build.sh create mode 100755 .github/scripts/noir-codegen-test.sh create mode 100755 .github/scripts/noir-js-build.sh create mode 100755 .github/scripts/noir-js-test.sh create mode 100755 .github/scripts/noir-js-types-build.sh create mode 100755 .github/scripts/noir-wasm-build.sh create mode 100755 .github/scripts/noir-wasm-test-browser.sh create mode 100755 .github/scripts/noir-wasm-test.sh create mode 100755 .github/scripts/noirc-abi-build.sh create mode 100755 .github/scripts/noirc-abi-test-browser.sh create mode 100755 .github/scripts/noirc-abi-test.sh create mode 100644 .github/workflows/docker-test-flow.yml delete mode 100755 scripts/nargo_compile_noir_codegen_assert_lt.sh diff --git a/.dockerignore b/.dockerignore index 8bea0aeeb1a..559b271bf38 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,6 +1,15 @@ Dockerfile* .dockerignore +# Yarn +.pnp.* +.yarn/* +!.yarn/patches +!.yarn/plugins +!.yarn/releases +!.yarn/sdks +!.yarn/versions + packages **/package.tgz **/target diff --git a/.github/scripts/acvm_js-build.sh b/.github/scripts/acvm_js-build.sh new file mode 100755 index 00000000000..0565a9bb89f --- /dev/null +++ b/.github/scripts/acvm_js-build.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -eu + +.github/scripts/install_wasm-bindgen.sh +yarn workspace @noir-lang/acvm_js build diff --git a/.github/scripts/acvm_js-test-browser.sh b/.github/scripts/acvm_js-test-browser.sh new file mode 100755 index 00000000000..598c98dadf2 --- /dev/null +++ b/.github/scripts/acvm_js-test-browser.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -eu + +npx playwright install && npx playwright install-deps +yarn workspace @noir-lang/acvm_js test:browser diff --git a/.github/scripts/acvm_js-test.sh b/.github/scripts/acvm_js-test.sh new file mode 100755 index 00000000000..d5519d26cc4 --- /dev/null +++ b/.github/scripts/acvm_js-test.sh @@ -0,0 +1,4 @@ +#!/bin/bash +set -eu + +yarn workspace @noir-lang/acvm_js test diff --git a/.github/scripts/backend-barretenberg-build.sh b/.github/scripts/backend-barretenberg-build.sh new file mode 100755 index 00000000000..d90995397d8 --- /dev/null +++ b/.github/scripts/backend-barretenberg-build.sh @@ -0,0 +1,4 @@ +#!/bin/bash +set -eu + +yarn workspace @noir-lang/backend_barretenberg build diff --git a/.github/scripts/backend-barretenberg-test.sh b/.github/scripts/backend-barretenberg-test.sh new file mode 100755 index 00000000000..1bd6f8e410d --- /dev/null +++ b/.github/scripts/backend-barretenberg-test.sh @@ -0,0 +1,4 @@ +#!/bin/bash +set -eu + +yarn workspace @noir-lang/backend_barretenberg test diff --git a/.github/scripts/install_wasm-bindgen.sh b/.github/scripts/install_wasm-bindgen.sh new file mode 100755 index 00000000000..b8c41393ab0 --- /dev/null +++ b/.github/scripts/install_wasm-bindgen.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -eu + +curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash +cargo-binstall wasm-bindgen-cli --version 0.2.86 -y diff --git a/.github/scripts/integration-test.sh b/.github/scripts/integration-test.sh new file mode 100755 index 00000000000..4e1b52cedf9 --- /dev/null +++ b/.github/scripts/integration-test.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -eu + +apt-get install libc++-dev -y +npx playwright install && npx playwright install-deps +yarn workspace integration-tests test \ No newline at end of file diff --git a/.github/scripts/nargo-build.sh b/.github/scripts/nargo-build.sh new file mode 100755 index 00000000000..2115732ab7e --- /dev/null +++ b/.github/scripts/nargo-build.sh @@ -0,0 +1,8 @@ +#!/bin/bash +set -eu + +export SOURCE_DATE_EPOCH=$(date +%s) +export GIT_DIRTY=false +export GIT_COMMIT=$(git rev-parse --verify HEAD) + +cargo build --release diff --git a/.github/scripts/nargo-test.sh b/.github/scripts/nargo-test.sh new file mode 100755 index 00000000000..9234df7bf5c --- /dev/null +++ b/.github/scripts/nargo-test.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -eu + +apt-get install -y curl libc++-dev + +export SOURCE_DATE_EPOCH=$(date +%s) +export GIT_DIRTY=false +export GIT_COMMIT=$(git rev-parse --verify HEAD) + +cargo test --workspace --locked --release \ No newline at end of file diff --git a/.github/scripts/noir-codegen-build.sh b/.github/scripts/noir-codegen-build.sh new file mode 100755 index 00000000000..d42be4d676e --- /dev/null +++ b/.github/scripts/noir-codegen-build.sh @@ -0,0 +1,4 @@ +#!/bin/bash +set -eu + +yarn workspace @noir-lang/noir_codegen build diff --git a/.github/scripts/noir-codegen-test.sh b/.github/scripts/noir-codegen-test.sh new file mode 100755 index 00000000000..6f603f65507 --- /dev/null +++ b/.github/scripts/noir-codegen-test.sh @@ -0,0 +1,4 @@ +#!/bin/bash +set -eu + +yarn workspace @noir-lang/noir_codegen test \ No newline at end of file diff --git a/.github/scripts/noir-js-build.sh b/.github/scripts/noir-js-build.sh new file mode 100755 index 00000000000..04367e41342 --- /dev/null +++ b/.github/scripts/noir-js-build.sh @@ -0,0 +1,4 @@ +#!/bin/bash +set -eu + +yarn workspace @noir-lang/noir_js build diff --git a/.github/scripts/noir-js-test.sh b/.github/scripts/noir-js-test.sh new file mode 100755 index 00000000000..b5fe34038fe --- /dev/null +++ b/.github/scripts/noir-js-test.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -eu + +./scripts/nargo_compile_noir_js_assert_lt.sh +rm -rf /usr/src/noir/tooling/noir_js/test/noir_compiled_examples/assert_lt/target/debug_assert_lt.json +yarn workspace @noir-lang/noir_js test \ No newline at end of file diff --git a/.github/scripts/noir-js-types-build.sh b/.github/scripts/noir-js-types-build.sh new file mode 100755 index 00000000000..77b08651d68 --- /dev/null +++ b/.github/scripts/noir-js-types-build.sh @@ -0,0 +1,4 @@ +#!/bin/bash +set -eu + +yarn workspace @noir-lang/types build \ No newline at end of file diff --git a/.github/scripts/noir-wasm-build.sh b/.github/scripts/noir-wasm-build.sh new file mode 100755 index 00000000000..4523751612d --- /dev/null +++ b/.github/scripts/noir-wasm-build.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -eu + +.github/scripts/install_wasm-bindgen.sh +yarn workspace @noir-lang/noir_wasm build \ No newline at end of file diff --git a/.github/scripts/noir-wasm-test-browser.sh b/.github/scripts/noir-wasm-test-browser.sh new file mode 100755 index 00000000000..4b584abce23 --- /dev/null +++ b/.github/scripts/noir-wasm-test-browser.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -eu + +./scripts/nargo_compile_wasm_fixtures.sh +npx playwright install && npx playwright install-deps +yarn workspace @noir-lang/noir_wasm test:browser \ No newline at end of file diff --git a/.github/scripts/noir-wasm-test.sh b/.github/scripts/noir-wasm-test.sh new file mode 100755 index 00000000000..03e1bac2330 --- /dev/null +++ b/.github/scripts/noir-wasm-test.sh @@ -0,0 +1,7 @@ +#!/bin/bash +set -eu + +./scripts/nargo_compile_wasm_fixtures.sh +yarn workspace @noir-lang/noir_wasm test:node +npx playwright install && npx playwright install-deps +yarn workspace @noir-lang/noir_wasm test:browser diff --git a/.github/scripts/noirc-abi-build.sh b/.github/scripts/noirc-abi-build.sh new file mode 100755 index 00000000000..d5da6deaa0f --- /dev/null +++ b/.github/scripts/noirc-abi-build.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -eu + +.github/scripts/install_wasm-bindgen.sh +yarn workspace @noir-lang/noirc_abi build diff --git a/.github/scripts/noirc-abi-test-browser.sh b/.github/scripts/noirc-abi-test-browser.sh new file mode 100755 index 00000000000..7a966cb5e94 --- /dev/null +++ b/.github/scripts/noirc-abi-test-browser.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -eu + +npx playwright install && npx playwright install-deps +yarn workspace @noir-lang/noirc_abi test:browser diff --git a/.github/scripts/noirc-abi-test.sh b/.github/scripts/noirc-abi-test.sh new file mode 100755 index 00000000000..39ca0a44b07 --- /dev/null +++ b/.github/scripts/noirc-abi-test.sh @@ -0,0 +1,4 @@ +#!/bin/bash +set -eu + +yarn workspace @noir-lang/noirc_abi test diff --git a/.github/workflows/docker-test-flow.yml b/.github/workflows/docker-test-flow.yml new file mode 100644 index 00000000000..0277812f5ae --- /dev/null +++ b/.github/workflows/docker-test-flow.yml @@ -0,0 +1,733 @@ +name: Test Nargo and JS packages + +on: + push: + branches: + - 'master' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref || github.run_id }} + cancel-in-progress: true + +jobs: + build-base-nargo: + name: Build base nargo docker image + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Get current date + id: date + run: echo "date=$(date +'%Y.%m.%d.%H.%M')" >> $GITHUB_STATE + - name: prepare docker images tags + id: prep + run: | + REGISTRY="ghcr.io" + IMG_RAW="${REGISTRY}/${{ github.repository }}" + IMAGE=$(echo "$IMG_RAW" | tr '[:upper:]' '[:lower:]') + TAGS="${IMAGE}:${{ github.sha }}-nargo" + FULL_TAGS="${TAGS},${IMAGE}:latest-nargo,${IMAGE}:v${{ steps.date.outputs.date }}-nargo" + echo "tags=$FULL_TAGS" >> $GITHUB_OUTPUT + echo "image=$IMAGE" >> $GITHUB_OUTPUT + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v3 + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build nargo base dockerfile + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ci + tags: ${{ steps.prep.outputs.tags }} + target: base-nargo + cache-from: type=gha + cache-to: type=gha,mode=max + push: true + + build-base-js: + name: Build base js docker image + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Get current date + id: date + run: echo "date=$(date +'%Y.%m.%d.%H.%M')" >> $GITHUB_STATE + - name: Prepare docker image tags + id: prep + run: | + REGISTRY="ghcr.io" + IMG_RAW="${REGISTRY}/${{ github.repository }}" + IMAGE=$(echo "$IMG_RAW" | tr '[:upper:]' '[:lower:]') + TAGS="${IMAGE}:${{ github.sha }}-js" + FULL_TAGS="${TAGS},${IMAGE}:latest-js,${IMAGE}:v${{ steps.date.outputs.date }}-js" + echo "tags=$FULL_TAGS" >> $GITHUB_OUTPUT + echo "image=$IMAGE" >> $GITHUB_OUTPUT + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v3 + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build js base dockerfile + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.ci + tags: ${{ steps.prep.outputs.tags }} + target: base-js + cache-from: type=gha + cache-to: type=gha,mode=max + push: true + + artifact-nargo: + name: Artifact nargo + runs-on: ubuntu-latest + needs: [build-base-nargo] + container: + image: ghcr.io/noir-lang/noir:${{ github.sha }}-nargo + credentials: + username: ${{ github.actor }} + password: ${{ secrets.github_token }} + steps: + - name: Artifact nargo + uses: actions/upload-artifact@v4 + with: + name: nargo + path: /usr/src/noir/target/release/nargo + if-no-files-found: error + compression-level: 0 + + test-nargo: + name: Test nargo + runs-on: ubuntu-latest + needs: [build-base-nargo] + container: + image: ghcr.io/noir-lang/noir:${{ github.sha }}-nargo + credentials: + username: ${{ github.actor }} + password: ${{ secrets.github_token }} + steps: + - name: Test + working-directory: /usr/src/noir + run: | + .github/scripts/nargo-test.sh + + build-noir-wasm: + name: Build noir wasm + runs-on: ubuntu-latest + needs: [build-base-js] + container: + image: ghcr.io/noir-lang/noir:${{ github.sha }}-js + credentials: + username: ${{ github.actor }} + password: ${{ secrets.github_token }} + steps: + - name: Build + working-directory: /usr/src/noir + run: | + ./.github/scripts/noir-wasm-build.sh + - name: Artifact + uses: actions/upload-artifact@v4 + with: + name: noir_wasm + path: /usr/src/noir/compiler/wasm/outputs/out/noir_wasm + retention-days: 10 + + test-noir-wasm: + name: Test noir wasm + runs-on: ubuntu-latest + needs: [build-base-js, artifact-nargo, build-noir-wasm] + container: + image: ghcr.io/noir-lang/noir:${{ github.sha }}-js + credentials: + username: ${{ github.actor }} + password: ${{ secrets.github_token }} + steps: + - name: Download nargo + uses: actions/download-artifact@v4 + with: + name: nargo + path: /usr/src/noir/target/release + - name: Prep downloaded artifact + run: | + chmod +x /usr/src/noir/target/release/nargo + - name: Download noir_wasm artifact + uses: actions/download-artifact@v4 + with: + name: noir_wasm + path: /usr/src/noir/compiler/wasm + - name: Test + working-directory: /usr/src/noir + run: | + ./.github/scripts/noir-wasm-test.sh + + test-noir-wasm-browser: + name: Test noir wasm browser + runs-on: ubuntu-latest + needs: [build-base-js, artifact-nargo, build-noir-wasm] + container: + image: ghcr.io/noir-lang/noir:${{ github.sha }}-js + credentials: + username: ${{ github.actor }} + password: ${{ secrets.github_token }} + steps: + - name: Download nargo + uses: actions/download-artifact@v4 + with: + name: nargo + path: /usr/src/noir/target/release + - name: Prep downloaded artifact + run: | + chmod +x /usr/src/noir/target/release/nargo + - name: Download noir_wasm artifact + uses: actions/download-artifact@v4 + with: + name: noir_wasm + path: /usr/src/noir/compiler/wasm + - name: Test + working-directory: /usr/src/noir + run: | + ./.github/scripts/noir-wasm-test-browser.sh + + build-acvm_js: + name: Build acvm js + runs-on: ubuntu-latest + needs: [build-base-js] + container: + image: ghcr.io/noir-lang/noir:${{ github.sha }}-js + credentials: + username: ${{ github.actor }} + password: ${{ secrets.github_token }} + steps: + - name: Build + working-directory: /usr/src/noir + run: | + ./.github/scripts/acvm_js-build.sh + - name: Artifact + uses: actions/upload-artifact@v4 + with: + name: acvm_js + path: + /usr/src/noir/acvm-repo/acvm_js/outputs/out/acvm_js + if-no-files-found: error + compression-level: 0 + + test-acvm_js: + name: Test acvm js + runs-on: ubuntu-latest + needs: [build-base-js, build-acvm_js] + container: + image: ghcr.io/noir-lang/noir:${{ github.sha }}-js + credentials: + username: ${{ github.actor }} + password: ${{ secrets.github_token }} + steps: + - name: Download acvm js + uses: actions/download-artifact@v4 + with: + name: acvm_js + path: | + /usr/src/noir/acvm-repo/acvm_js + - name: Test + working-directory: /usr/src/noir + run: | + ./.github/scripts/acvm_js-test.sh + + test-acvm_js-browser: + name: Test acvm js browser + runs-on: ubuntu-latest + needs: [build-base-js, build-acvm_js] + container: + image: ghcr.io/noir-lang/noir:${{ github.sha }}-js + credentials: + username: ${{ github.actor }} + password: ${{ secrets.github_token }} + steps: + - name: Download acvm js + uses: actions/download-artifact@v4 + with: + name: acvm_js + path: | + /usr/src/noir/acvm-repo/acvm_js + - name: Test + working-directory: /usr/src/noir + run: | + ./.github/scripts/acvm_js-test-browser.sh + + build-noirc-abi: + name: Build noirc abi + runs-on: ubuntu-latest + needs: [build-base-js] + container: + image: ghcr.io/noir-lang/noir:${{ github.sha }}-js + credentials: + username: ${{ github.actor }} + password: ${{ secrets.github_token }} + steps: + - name: Build + working-directory: /usr/src/noir + run: | + ./.github/scripts/noirc-abi-build.sh + - name: Artifact + uses: actions/upload-artifact@v4 + with: + name: noirc_abi_wasm + path: + /usr/src/noir/tooling/noirc_abi_wasm/outputs/out/noirc_abi_wasm + if-no-files-found: error + compression-level: 0 + + test-noirc-abi: + name: Test noirc abi + runs-on: ubuntu-latest + needs: [build-base-js, build-noirc-abi] + container: + image: ghcr.io/noir-lang/noir:${{ github.sha }}-js + credentials: + username: ${{ github.actor }} + password: ${{ secrets.github_token }} + steps: + - name: Download noirc abi + uses: actions/download-artifact@v4 + with: + name: noirc_abi_wasm + path: | + /usr/src/noir/tooling/noirc_abi_wasm + - name: Test + working-directory: /usr/src/noir + run: | + ./.github/scripts/noirc-abi-test.sh + + test-noirc-abi-browser: + name: Test noirc abi browser + runs-on: ubuntu-latest + needs: [build-base-js, build-noirc-abi] + container: + image: ghcr.io/noir-lang/noir:${{ github.sha }}-js + credentials: + username: ${{ github.actor }} + password: ${{ secrets.github_token }} + steps: + - name: Download noirc abi + uses: actions/download-artifact@v4 + with: + name: noirc_abi_wasm + path: | + /usr/src/noir/tooling/noirc_abi_wasm + - name: Test + working-directory: /usr/src/noir + run: | + ./.github/scripts/noirc-abi-test-browser.sh + + build-noir-js-types: + name: Build noir js types + runs-on: ubuntu-latest + needs: [build-base-js, build-noirc-abi] + container: + image: ghcr.io/noir-lang/noir:${{ github.sha }}-js + credentials: + username: ${{ github.actor }} + password: ${{ secrets.github_token }} + steps: + - name: Download noirc abi + uses: actions/download-artifact@v4 + with: + name: noirc_abi_wasm + path: | + /usr/src/noir/tooling/noirc_abi_wasm + - name: Build + working-directory: /usr/src/noir + run: | + ./.github/scripts/noir-js-types-build.sh + - name: Artifact + uses: actions/upload-artifact@v4 + with: + name: noir-js-types + path: | + /usr/src/noir/tooling/noir_js_types/lib + if-no-files-found: error + compression-level: 0 + + build-barretenberg-backend: + name: Build Barretenberg backend + runs-on: ubuntu-latest + needs: [build-base-js, build-noirc-abi, build-noir-js-types] + container: + image: ghcr.io/noir-lang/noir:${{ github.sha }}-js + credentials: + username: ${{ github.actor }} + password: ${{ secrets.github_token }} + steps: + - name: Download noirc abi + uses: actions/download-artifact@v4 + with: + name: noirc_abi_wasm + path: | + /usr/src/noir/tooling/noirc_abi_wasm + - name: Download noir js types + uses: actions/download-artifact@v4 + with: + name: noir-js-types + path: /usr/src/noir/tooling/noir_js_types/lib/ + - name: Build + working-directory: /usr/src/noir + run: | + ./.github/scripts/backend-barretenberg-build.sh + - name: Artifact + uses: actions/upload-artifact@v4 + with: + name: barretenberg-backend + path: + /usr/src/noir/tooling/noir_js_backend_barretenberg/lib + if-no-files-found: error + compression-level: 0 + + test-barretenberg-backend: + name: Test Barretenberg backend + runs-on: ubuntu-latest + needs: [build-base-js, build-noirc-abi, build-noir-js-types, build-barretenberg-backend] + container: + image: ghcr.io/noir-lang/noir:${{ github.sha }}-js + credentials: + username: ${{ github.actor }} + password: ${{ secrets.github_token }} + steps: + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: noirc_abi_wasm + path: | + /usr/src/noir/tooling/noirc_abi_wasm + - name: Download noir js types + uses: actions/download-artifact@v4 + with: + name: noir-js-types + path: /usr/src/noir/tooling/noir_js_types/lib/ + - name: Download Backend barretenberg + uses: actions/download-artifact@v4 + with: + name: barretenberg-backend + path: + /usr/src/noir/tooling/noir_js_backend_barretenberg/lib + - name: Test + working-directory: /usr/src/noir + run: | + ./.github/scripts/backend-barretenberg-test.sh + + build-noir_js: + name: Build noirjs + runs-on: ubuntu-latest + needs: [build-base-js, artifact-nargo, build-noirc-abi, build-acvm_js, build-barretenberg-backend, build-noir-js-types] + container: + image: ghcr.io/noir-lang/noir:${{ github.sha }}-js + credentials: + username: ${{ github.actor }} + password: ${{ secrets.github_token }} + steps: + - name: Download nargo + uses: actions/download-artifact@v4 + with: + name: nargo + path: /usr/src/noir/target/release + - name: prep downloaded artifact + run: | + chmod +x /usr/src/noir/target/release/nargo + - name: Download noirc abi + uses: actions/download-artifact@v4 + with: + name: noirc_abi_wasm + path: | + /usr/src/noir/tooling/noirc_abi_wasm + - name: Download acvm js + uses: actions/download-artifact@v4 + with: + name: acvm_js + path: | + /usr/src/noir/acvm-repo/acvm_js + - name: Download Barretenberg backend + uses: actions/download-artifact@v4 + with: + name: barretenberg-backend + path: + /usr/src/noir/tooling/noir_js_backend_barretenberg/lib + - name: Download noir js types + uses: actions/download-artifact@v4 + with: + name: noir-js-types + path: | + /usr/src/noir/tooling/noir_js_types/lib + - name: Build + working-directory: /usr/src/noir + run: | + ./.github/scripts/noir-js-build.sh + - name: Artifact + uses: actions/upload-artifact@v4 + with: + name: noir_js + path: + /usr/src/noir/tooling/noir_js/lib + + test-noir_js: + name: Test noirjs + runs-on: ubuntu-latest + needs: [ + build-base-js, + build-noirc-abi, + artifact-nargo, + build-acvm_js, + build-barretenberg-backend, + build-noir_js, + build-noir-js-types + ] + container: + image: ghcr.io/noir-lang/noir:${{ github.sha }}-js + credentials: + username: ${{ github.actor }} + password: ${{ secrets.github_token }} + steps: + - name: Download nargo + uses: actions/download-artifact@v4 + with: + name: nargo + path: /usr/src/noir/target/release + - name: Prep downloaded artifact + run: | + chmod +x /usr/src/noir/target/release/nargo + - name: Download noirc abi + uses: actions/download-artifact@v4 + with: + name: noirc_abi_wasm + path: | + /usr/src/noir/tooling/noirc_abi_wasm + - name: Download acvm js + uses: actions/download-artifact@v4 + with: + name: acvm_js + path: | + /usr/src/noir/acvm-repo/acvm_js + - name: Download Barretenberg backend + uses: actions/download-artifact@v4 + with: + name: barretenberg-backend + path: + /usr/src/noir/tooling/noir_js_backend_barretenberg/lib + - name: Download noir js types + uses: actions/download-artifact@v4 + with: + name: noir-js-types + path: | + /usr/src/noir/tooling/noir_js_types/lib + - name: Download noir js + uses: actions/download-artifact@v4 + with: + name: noir_js + path: + /usr/src/noir/tooling/noir_js/lib + - name: Test + working-directory: /usr/src/noir + run: | + ./.github/scripts/noir-js-test.sh + + build-noir_codegen: + name: Build noir codegen + runs-on: ubuntu-latest + needs: [build-base-js, build-noirc-abi, build-acvm_js, build-noir-js-types, build-noir_js] + container: + image: ghcr.io/noir-lang/noir:${{ github.sha }}-js + credentials: + username: ${{ github.actor }} + password: ${{ secrets.github_token }} + steps: + - name: Download nargo + uses: actions/download-artifact@v4 + with: + name: nargo + path: /usr/src/noir/target/release + - name: Prep downloaded artifact + run: | + chmod +x /usr/src/noir/target/release/nargo + - name: Download noirc abi package + uses: actions/download-artifact@v4 + with: + name: noirc_abi_wasm + path: /usr/src/noir/tooling/noirc_abi_wasm + - name: Download acvm js + uses: actions/download-artifact@v4 + with: + name: acvm_js + path: /usr/src/noir/acvm-repo/acvm_js + - name: Download noir js types + uses: actions/download-artifact@v4 + with: + name: noir-js-types + path: | + /usr/src/noir/tooling/noir_js_types/lib + - name: Download noir js + uses: actions/download-artifact@v4 + with: + name: noir_js + path: + /usr/src/noir/tooling/noir_js/lib + - name: Build + working-directory: /usr/src/noir + run: | + ./.github/scripts/noir-codegen-build.sh + - name: Artifact + uses: actions/upload-artifact@v4 + with: + name: noir_codegen + path: + /usr/src/noir/tooling/noir_codegen/lib + + test-noir_codegen: + name: Test noir codegen + runs-on: ubuntu-latest + needs: [build-base-js, artifact-nargo, build-noirc-abi, build-acvm_js, build-noir-js-types, build-noir_js, build-noir_codegen] + container: + image: ghcr.io/noir-lang/noir:${{ github.sha }}-js + credentials: + username: ${{ github.actor }} + password: ${{ secrets.github_token }} + steps: + - name: Download nargo + uses: actions/download-artifact@v4 + with: + name: nargo + path: /usr/src/noir/target/release + - name: Prep downloaded artifact + run: | + chmod +x /usr/src/noir/target/release/nargo + - name: Download noirc abi + uses: actions/download-artifact@v4 + with: + name: noirc_abi_wasm + path: /usr/src/noir/tooling/noirc_abi_wasm + - name: Download acvm js + uses: actions/download-artifact@v4 + with: + name: acvm_js + path: /usr/src/noir/acvm-repo/acvm_js + - name: Download noir js types + uses: actions/download-artifact@v4 + with: + name: noir-js-types + path: | + /usr/src/noir/tooling/noir_js_types/lib + - name: Download noir js + uses: actions/download-artifact@v4 + with: + name: noir_js + path: + /usr/src/noir/tooling/noir_js/lib + - name: Download noir codegen + uses: actions/download-artifact@v4 + with: + name: noir_codegen + path: + /usr/src/noir/tooling/noir_codegen/lib + - name: Test + working-directory: /usr/src/noir + run: | + ./.github/scripts/noir-codegen-test.sh + + test-integration: + name: Integration test + runs-on: ubuntu-latest + needs: [ + build-base-js, + artifact-nargo, + build-noir-wasm, + build-noirc-abi, + build-acvm_js, + build-noir-js-types, + build-noir_js, + build-barretenberg-backend + ] + container: + image: ghcr.io/noir-lang/noir:${{ github.sha }}-js + credentials: + username: ${{ github.actor }} + password: ${{ secrets.github_token }} + steps: + - name: Download nargo + uses: actions/download-artifact@v4 + with: + name: nargo + path: /usr/src/noir/target/release + - name: Prep downloaded artifact + run: | + chmod +x /usr/src/noir/target/release/nargo + - name: Download noir wasm + uses: actions/download-artifact@v4 + with: + name: noir_wasm + path: /usr/src/noir/compiler/wasm + - name: Download noirc abi + uses: actions/download-artifact@v4 + with: + name: noirc_abi_wasm + path: /usr/src/noir/tooling/noirc_abi_wasm + - name: Download acvm js + uses: actions/download-artifact@v4 + with: + name: acvm_js + path: /usr/src/noir/acvm-repo/acvm_js + - name: Download noir js types + uses: actions/download-artifact@v4 + with: + name: noir-js-types + path: | + /usr/src/noir/tooling/noir_js_types/lib + - name: Download noir js + uses: actions/download-artifact@v4 + with: + name: noir_js + path: + /usr/src/noir/tooling/noir_js/lib + - name: Download Barretenberg backend + uses: actions/download-artifact@v4 + with: + name: barretenberg-backend + path: + /usr/src/noir/tooling/noir_js_backend_barretenberg/lib + - name: Test + working-directory: /usr/src/noir + run: | + ./.github/scripts/integration-test.sh + + tests-end: + name: End + runs-on: ubuntu-latest + if: ${{ always() }} + needs: + - test-nargo + - test-noirc-abi + - test-noirc-abi-browser + - test-noir-wasm + - test-noir-wasm-browser + - test-integration + - test-noir_codegen + - test-acvm_js + - test-acvm_js-browser + - test-barretenberg-backend + - test-noir_js + + steps: + - name: Report overall success + run: | + if [[ $FAIL == true ]]; then + exit 1 + else + exit 0 + fi + env: + FAIL: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'skipped') }} diff --git a/Dockerfile.ci b/Dockerfile.ci index 9ca995fd94f..57dcbe9cfee 100644 --- a/Dockerfile.ci +++ b/Dockerfile.ci @@ -1,40 +1,31 @@ -FROM rust:1-slim-bookworm as test-base +FROM rust:1.71.1-slim-bookworm as base RUN apt-get update && apt-get upgrade -y && apt-get install build-essential git -y WORKDIR /usr/src/noir -COPY . . -RUN ./scripts/bootstrap_native.sh -ENV PATH="${PATH}:/usr/src/noir/target/release/" +ENV PATH="${PATH}:/usr/src/noir/target/release" -FROM test-base as test-cargo -RUN apt-get install -y curl libc++-dev -RUN ./scripts/test_native.sh +FROM base as base-nargo +COPY . . +RUN .github/scripts/nargo-build.sh -FROM test-base as test-js -RUN apt-get install pkg-config libssl-dev -y -RUN ./scripts/install_wasm-bindgen.sh +FROM base as base-js RUN apt-get install -y ca-certificates curl gnupg RUN mkdir -p /etc/apt/keyrings RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list RUN apt-get update && apt-get install nodejs -y RUN corepack enable -RUN yarn --immutable RUN apt-get install -y jq -RUN yarn build -RUN yarn workspace @noir-lang/acvm_js test -RUN npx playwright install && npx playwright install-deps -RUN yarn workspace @noir-lang/acvm_js test:browser -RUN yarn workspace @noir-lang/noirc_abi test -RUN yarn workspace @noir-lang/noirc_abi test:browser -RUN yarn workspace @noir-lang/backend_barretenberg test -RUN ./scripts/nargo_compile_noir_js_assert_lt.sh -RUN rm -rf /usr/src/noir/tooling/noir_js/test/noir_compiled_examples/assert_lt/target/debug_assert_lt.json -RUN yarn workspace @noir-lang/noir_js test -RUN ./scripts/nargo_compile_wasm_fixtures.sh -RUN yarn workspace @noir-lang/noir_wasm test:node -RUN yarn workspace @noir-lang/noir_wasm test:browser -RUN ./scripts/nargo_compile_noir_codegen_assert_lt.sh -RUN rm -rf /usr/src/noir/tooling/noir_codegen/test/assert_lt/target/debug_assert_lt.json -RUN yarn workspace @noir-lang/noir_codegen test -RUN apt-get install -y libc++-dev -RUN yarn test:integration +COPY yarn.lock package.json .yarnrc.yml ./ +COPY .yarn/ ./.yarn/ +COPY ./acvm-repo/acvm_js/package.json ./acvm-repo/acvm_js/ +COPY ./tooling/noirc_abi_wasm/package.json ./tooling/noirc_abi_wasm/ +COPY ./compiler/wasm/package.json ./compiler/wasm/ +COPY ./tooling/noir_js_types/package.json ./tooling/noir_js_types/ +COPY ./tooling/noir_js_backend_barretenberg/package.json ./tooling/noir_js_backend_barretenberg/ +COPY ./tooling/noir_js/package.json ./tooling/noir_js/ +COPY ./tooling/noir_codegen/package.json ./tooling/noir_codegen/ +COPY ./compiler/integration-tests/package.json ./compiler/integration-tests/ +COPY ./release-tests/package.json ./release-tests/ +COPY ./docs/package.json ./docs/ +RUN yarn --immutable +COPY . . diff --git a/scripts/nargo_compile_noir_codegen_assert_lt.sh b/scripts/nargo_compile_noir_codegen_assert_lt.sh deleted file mode 100755 index 858a16cf517..00000000000 --- a/scripts/nargo_compile_noir_codegen_assert_lt.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -cd ./tooling/noir_codegen/test/assert_lt -nargo compile \ No newline at end of file