Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Dockerfile to test cargo and JS packages #3684

Merged
merged 52 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
0f5a7c4
initial
sklppy88 Nov 29, 2023
d4b4e61
test
sklppy88 Nov 29, 2023
6648bd8
test
sklppy88 Nov 29, 2023
e83a8d7
add cache
sklppy88 Nov 29, 2023
4cd7907
test cache
sklppy88 Nov 29, 2023
8656030
test
sklppy88 Nov 29, 2023
0d81dab
add git
sklppy88 Nov 29, 2023
4aed6dd
test
sklppy88 Nov 29, 2023
ae8a009
test
sklppy88 Nov 29, 2023
4d2b7e7
add js test workflow
sklppy88 Nov 29, 2023
f6193ab
test
sklppy88 Nov 30, 2023
6cde486
fix
sklppy88 Nov 30, 2023
a7576a6
script
sklppy88 Nov 30, 2023
349104a
+x
sklppy88 Nov 30, 2023
85b426e
test
sklppy88 Nov 30, 2023
1687a96
test
sklppy88 Nov 30, 2023
d68fd2f
add
sklppy88 Nov 30, 2023
f4dde4c
test
sklppy88 Nov 30, 2023
3204050
test
sklppy88 Nov 30, 2023
f0b8c94
asdf
sklppy88 Nov 30, 2023
2f7e13b
Merge branch 'master' into feat-test-release
sklppy88 Dec 1, 2023
c0d5694
test
sklppy88 Dec 1, 2023
ea10638
test
sklppy88 Dec 1, 2023
7e44f1f
test
sklppy88 Dec 1, 2023
633b5af
test
sklppy88 Dec 1, 2023
e71d4ac
abc
sklppy88 Dec 1, 2023
1defab5
test
sklppy88 Dec 1, 2023
633973f
tst
sklppy88 Dec 1, 2023
76b37e1
test
sklppy88 Dec 1, 2023
fdcecab
Revert "test"
sklppy88 Dec 1, 2023
494f722
Fixing and should work
sklppy88 Dec 2, 2023
a0a643f
Merge branch 'master' into feat-test-release
sklppy88 Dec 2, 2023
0798f1e
fixed
sklppy88 Dec 2, 2023
b0fc82d
test
sklppy88 Dec 2, 2023
ad3102c
dockerfile
sklppy88 Dec 2, 2023
29c265c
change
sklppy88 Dec 2, 2023
97907af
anges
sklppy88 Dec 2, 2023
f1d8fba
uncomment
sklppy88 Dec 4, 2023
0c81e53
add
sklppy88 Dec 4, 2023
f45f90a
Delete tooling/noir_codegen/codegen/index.ts
sklppy88 Dec 4, 2023
984f3ba
Update cjs.test.cjs
sklppy88 Dec 4, 2023
f704cf7
Merge branch 'master' into feat-test-release
kevaundray Dec 5, 2023
b76eb46
fixing
sklppy88 Dec 7, 2023
fa9c8a2
Delete docs/versions.json
sklppy88 Dec 7, 2023
84724b2
move
sklppy88 Dec 7, 2023
4c420fc
Merge remote-tracking branch 'origin/feat-test-release' into feat-tes…
sklppy88 Dec 7, 2023
2e7bf3d
Delete Dockerfile
sklppy88 Dec 7, 2023
d820e4f
fix
sklppy88 Dec 7, 2023
9bde1ed
fix
sklppy88 Dec 7, 2023
cdb17ca
Merge branch 'master' into feat-test-release
sklppy88 Dec 7, 2023
7e5210e
final test
sklppy88 Dec 7, 2023
a86cdcb
remove last
sklppy88 Dec 7, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/test-cargo.yml
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
44 changes: 44 additions & 0 deletions .github/workflows/test-js.yml
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
41 changes: 41 additions & 0 deletions Dockerfile.ci
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
4 changes: 3 additions & 1 deletion Dockerfile.packages
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ RUN apk update \
npm \
yarn \
bash \
jq
jq \
git

WORKDIR /usr/src/noir
COPY . .
RUN ./scripts/bootstrap_packages.sh
Expand Down
4 changes: 4 additions & 0 deletions scripts/nargo_compile_noir_codegen_assert_lt.sh
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
4 changes: 4 additions & 0 deletions scripts/nargo_compile_noir_js_assert_lt.sh
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
8 changes: 8 additions & 0 deletions scripts/nargo_compile_wasm_fixtures.sh
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
28 changes: 28 additions & 0 deletions scripts/test_js_packages.sh
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
15 changes: 15 additions & 0 deletions scripts/test_native.sh
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
3 changes: 2 additions & 1 deletion tooling/noir_codegen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"dev": "tsc-multi --watch",
"build": "tsc",
"test": "yarn test:codegen && yarn test:node && yarn test:clean",
"test:codegen": "ts-node --esm src/main.ts ./test/assert_lt/target/** --out-dir ./test/codegen",
"test:codegen": "tsx src/main.ts ./test/assert_lt/target/** --out-dir ./test/codegen",
kevaundray marked this conversation as resolved.
Show resolved Hide resolved
"test:node": "mocha --timeout 25000 --exit --config ./.mocharc.json",
"test:clean": "rm -rf ./test/codegen",
"prettier": "prettier 'src/**/*.ts'",
Expand All @@ -50,6 +50,7 @@
"mocha": "^10.2.0",
"prettier": "3.0.3",
"ts-node": "^10.9.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2"
}
}
Loading
Loading