-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Dockerfile to test cargo and JS packages (#3684)
# Description Adds the start of a Dockerfile to build / test both cargo and JS packages ## Problem\* Resolves #3685 ## Summary\* ## 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\* - [x] I have tested the changes locally. - [ ] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings. --------- Co-authored-by: kevaundray <[email protected]>
- Loading branch information
1 parent
9dd465c
commit 513d619
Showing
11 changed files
with
459 additions
and
4 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Test cargo | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'master' | ||
|
||
jobs: | ||
build: | ||
name: Test cargo | ||
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="${REGISTRY}/${{ github.repository }}" | ||
IMAGE=$(echo "$IMG" | tr '[:upper:]' '[:lower:]') | ||
TAGS="${IMAGE}:${{ github.sha }}" | ||
TAGS="${TAGS},${IMAGE}:latest,${IMAGE}:v${{ steps.date.outputs.date }}" | ||
echo ::set-output name=tags::${TAGS} | ||
- 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: Test cargo | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: Dockerfile.ci | ||
tags: ${{ steps.prep.outputs.tags }} | ||
target: test-cargo | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Test JS packages | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'master' | ||
|
||
jobs: | ||
build: | ||
name: Test JS packages | ||
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="${REGISTRY}/${{ github.repository }}" | ||
IMAGE=$(echo "$IMG" | tr '[:upper:]' '[:lower:]') | ||
TAGS="${IMAGE}:${{ github.sha }}" | ||
TAGS="${TAGS},${IMAGE}:latest,${IMAGE}:v${{ steps.date.outputs.date }}" | ||
echo ::set-output name=tags::${TAGS} | ||
- 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: Test JS packages | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: Dockerfile.ci | ||
tags: ${{ steps.prep.outputs.tags }} | ||
target: test-js | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
FROM rust:1-slim-bookworm as test-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/" | ||
|
||
FROM test-base as test-cargo | ||
RUN apt-get install -y curl libc++-dev | ||
RUN ./scripts/test_native.sh | ||
|
||
FROM test-base as test-js | ||
RUN apt-get install pkg-config libssl-dev -y | ||
RUN ./scripts/install_wasm-bindgen.sh | ||
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 yarn workspace @noir-lang/source-resolver 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 |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
|
||
cd ./tooling/noir_codegen/test/assert_lt | ||
nargo compile |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
|
||
cd ./tooling/noir_js/test/noir_compiled_examples/assert_lt | ||
nargo compile |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
cd ./compiler/wasm/fixtures | ||
for dir in $(ls -d */); do | ||
pushd $dir/noir-script | ||
nargo compile | ||
popd | ||
done |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
set -eu | ||
|
||
cd $(dirname "$0")/.. | ||
|
||
./scripts/install_wasm-bindgen.sh | ||
|
||
# If this project has been subrepod into another project, set build data manually. | ||
export SOURCE_DATE_EPOCH=$(date +%s) | ||
export GIT_DIRTY=false | ||
if [ -f ".gitrepo" ]; then | ||
export GIT_COMMIT=$(awk '/commit =/ {print $3}' .gitrepo) | ||
else | ||
export GIT_COMMIT=$(git rev-parse --verify HEAD) | ||
fi | ||
|
||
export cargoExtraArgs="--features noirc_driver/aztec" | ||
|
||
cargo build --features="noirc_driver/aztec" --release | ||
export PATH="${PATH}:/usr/src/noir/target/release/" | ||
|
||
yarn | ||
yarn build | ||
npx playwright install | ||
npx playwright install-deps | ||
|
||
./scripts/test.sh | ||
yarn test |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
set -eu | ||
|
||
cd $(dirname "$0")/.. | ||
|
||
# If this project has been subrepod into another project, set build data manually. | ||
export SOURCE_DATE_EPOCH=$(date +%s) | ||
export GIT_DIRTY=false | ||
if [ -f ".gitrepo" ]; then | ||
export GIT_COMMIT=$(awk '/commit =/ {print $3}' .gitrepo) | ||
else | ||
export GIT_COMMIT=$(git rev-parse --verify HEAD) | ||
fi | ||
|
||
cargo test --workspace --locked --release |
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
Oops, something went wrong.