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

chore: BI build tweaks #2487

Merged
merged 97 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
04d5136
Initial cci_gen work.
charlielye Sep 16, 2023
27ef8da
Intial
charlielye Sep 16, 2023
06ae9b1
more
charlielye Sep 16, 2023
3d55c7c
Merge remote-tracking branch 'origin/master' into cl/ypb_cleanup
charlielye Sep 16, 2023
a26f1f4
wip
charlielye Sep 16, 2023
61b2b80
wip
charlielye Sep 17, 2023
14a334f
wip
charlielye Sep 17, 2023
63a7d3c
wip
charlielye Sep 17, 2023
cdc2b65
fix
charlielye Sep 17, 2023
c7c5baf
Add yq bin.
charlielye Sep 17, 2023
d3f44c8
Move to native version of yq. Can also now remove jq from build-system.
charlielye Sep 17, 2023
4d818d1
fix
charlielye Sep 17, 2023
d4f5a81
debug
charlielye Sep 17, 2023
36c8251
fix: PATH and bb.js ref
ludamad Sep 18, 2023
3d52670
fix: PATH and bb.js ref
ludamad Sep 18, 2023
7a6e238
fix: PATH and bb.js ref
ludamad Sep 18, 2023
e72e347
Merge remote-tracking branch 'origin/master' into cl/ypb_cleanup
ludamad Sep 19, 2023
a447ffe
fix: pass debug env to spot [debug ci]
ludamad Sep 19, 2023
054efef
tinkering [debug ci]
ludamad Sep 19, 2023
7b93f83
Merge remote-tracking branch 'origin/master' into cl/ypb_cleanup
ludamad Sep 19, 2023
648c910
fix: yarn-project-base-deps not in manifest [debug ci]
ludamad Sep 19, 2023
617f0ac
fix: dont set CACHE_FROM if try_fetch_image fails
ludamad Sep 19, 2023
da5b6d9
Format private-token
ludamad Sep 19, 2023
ff0d592
Lint private-token
ludamad Sep 19, 2023
f1f649e
chore: speed up yarn-project step
ludamad Sep 19, 2023
daf365c
Revert change
ludamad Sep 19, 2023
23c1a93
yarn-project Dockerfile update
ludamad Sep 19, 2023
79ea225
yarn-project Dockerfile update
ludamad Sep 19, 2023
7d491c2
Fix script call.
charlielye Sep 19, 2023
0813f83
wip
charlielye Sep 20, 2023
c01660a
Use r6a instances to build. Higher cpu count for bb. Allow [ci rebuil…
charlielye Sep 20, 2023
ebe6bb3
Run cci_gen. [ci rebuild]
charlielye Sep 20, 2023
36de7fb
Simplify ci cmd stuff. Rollback cpu count to see if it actually helpe…
charlielye Sep 20, 2023
28da340
Forgot to cci_gen... [ci rebuild]
charlielye Sep 20, 2023
5701341
Add timestamps. yolo [ci rebuild]
charlielye Sep 20, 2023
46e468c
Add timestamps. yolo [ci rebuild]
charlielye Sep 20, 2023
6d9378b
Remove redundant timestamps
ludamad Sep 20, 2023
54f89f2
fix: rebuild flag unbound
ludamad Sep 20, 2023
961dd5c
fix: use fetching commit message
ludamad Sep 20, 2023
173b5ee
wip [ci rebuild]
charlielye Sep 20, 2023
576c8f2
Merge remote-tracking branch 'origin/master' into cl/ypb_cleanup
charlielye Sep 20, 2023
5018c7e
Remove cci_gen stuff for now.
charlielye Sep 21, 2023
2128754
Fix
charlielye Sep 21, 2023
b87c3c1
wip
charlielye Sep 21, 2023
fe3390f
README
charlielye Sep 21, 2023
0d227a8
Formatting
charlielye Sep 21, 2023
951bf36
Disable blank tests as not passing.
charlielye Sep 21, 2023
a766965
fix
charlielye Sep 21, 2023
d22b550
fix
charlielye Sep 21, 2023
914e2b9
fix
charlielye Sep 21, 2023
4784413
fix
charlielye Sep 21, 2023
c4abeac
fix
charlielye Sep 21, 2023
644c8f2
fix
charlielye Sep 21, 2023
1e0e6ba
ypb down to 730MB
charlielye Sep 23, 2023
3596ee8
Smaller builds using pnp (at last second), and some incantations.
charlielye Sep 24, 2023
30e5e86
Comments.
charlielye Sep 24, 2023
c95c1f2
Bump ubuntu machine executor image to 2204
charlielye Sep 24, 2023
5738974
Fix wait on missing image.
charlielye Sep 24, 2023
d8ecba6
Revert Dockerfile.dockerignore to work with Docker v20. Can move to m…
charlielye Sep 24, 2023
c8da4d2
Fix sandbox dockerfile
charlielye Sep 24, 2023
b3afd23
Fix canary Dockerfile.
charlielye Sep 24, 2023
3e5a985
Add tests to own job.
charlielye Sep 24, 2023
6d05422
Make tests actually run...
charlielye Sep 24, 2023
2238e78
Add ecr_login
charlielye Sep 24, 2023
a10336c
Fix browser.
charlielye Sep 24, 2023
0c7a83d
Make yarn-project use some rebuild patterns. May need tweaking. Fix a…
charlielye Sep 24, 2023
2434d9a
Try and get browser test working again.
charlielye Sep 24, 2023
b1a8f4b
Fix canary.
charlielye Sep 24, 2023
a03f341
Merge remote-tracking branch 'origin/master' into cl/ypb_cleanup
charlielye Sep 25, 2023
3b5a942
fix: ypb deploy (#2464)
ludamad Sep 25, 2023
1a77721
chore: yarn project test breakup (#2484)
ludamad Sep 25, 2023
47a83d2
Merge branch 'master' into cl/ypb_cleanup
ludamad Sep 25, 2023
d0446aa
fix: cimg
ludamad Sep 25, 2023
46b3ab4
fix: cimg
ludamad Sep 25, 2023
2037278
[ci debug]
ludamad Sep 25, 2023
4e0cb82
Merge remote-tracking branch 'origin/cl/ypb_cleanup' into cl/ybp_smaller
charlielye Sep 25, 2023
c01cae3
fix: Use calculate_image_uri
ludamad Sep 25, 2023
6322f5c
[ci debug]
ludamad Sep 25, 2023
71ca071
ecr login [ci debug]
ludamad Sep 25, 2023
4376ca9
Merge remote-tracking branch 'origin/cl/ypb_cleanup' into cl/ybp_smaller
charlielye Sep 25, 2023
a79cd39
fix: dont require tag
ludamad Sep 25, 2023
5507089
fix: dont require tag
ludamad Sep 25, 2023
b8b23cd
Fix merge. yarn-project on spot.
charlielye Sep 25, 2023
5fe0019
Merge remote-tracking branch 'origin/cl/ypb_cleanup' into cl/ybp_smaller
charlielye Sep 25, 2023
50cf1a2
Fix canary deploy build.
charlielye Sep 25, 2023
5901208
Merge remote-tracking branch 'origin/master' into cl/ybp_smaller
charlielye Sep 25, 2023
8219860
Fix merge oops.
charlielye Sep 25, 2023
12a07a2
Merge branch 'master' into cl/ybp_smaller
charlielye Sep 25, 2023
03129c1
Parallel wasm/wasm-threads build.
charlielye Sep 25, 2023
a1b3ccc
Shift pnpify into final artefact, separate formatting again. [ci rebu…
charlielye Sep 25, 2023
eee400c
Merge [ci rebuild]
charlielye Sep 25, 2023
0510b1e
[ci rebuild yarn-project]
charlielye Sep 25, 2023
a11e2d0
Remove pnp. Gains not worth it.
charlielye Sep 26, 2023
21506f6
Merge remote-tracking branch 'origin/master' into cl/ybp_smaller
charlielye Sep 26, 2023
6d827ce
Slim stage yarn-project.
charlielye Sep 26, 2023
1ff4e45
Formatting.
charlielye Sep 26, 2023
71f94be
formatting
charlielye Sep 26, 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
32 changes: 16 additions & 16 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ jobs:
yarn-project-base:
machine:
image: ubuntu-2204:2023.07.2
resource_class: xlarge
resource_class: large
steps:
- *checkout
- *setup_env
Expand All @@ -395,27 +395,27 @@ jobs:
name: Build
command: build yarn-project | add_timestamps

yarn-project-format:
docker:
- image: aztecprotocol/alpine-build-image
resource_class: small
yarn-project-formatting:
machine:
image: ubuntu-2204:2023.07.2
resource_class: large
steps:
- *checkout
- *setup_env
- run:
name: Build
command: cond_spot_run_script yarn-project 32 cond_run_container yarn-project formatting | add_timestamps
name: Check Formatting
command: cond_run_container yarn-project formatting | add_timestamps

yarn-project-test:
yarn-project-tests:
docker:
- image: aztecprotocol/alpine-build-image
resource_class: small
steps:
- *checkout
- *setup_env
- run:
name: Build
command: cond_spot_run_script yarn-project 64 cond_run_container yarn-project test | add_timestamps
name: Test
command: cond_spot_run_container yarn-project 64 test | add_timestamps

aztec-sandbox-base:
machine:
Expand Down Expand Up @@ -1130,18 +1130,18 @@ workflows:
- circuits-wasm-linux-clang
- l1-contracts
<<: *defaults
- yarn-project-format:
- yarn-project:
requires:
- yarn-project
- yarn-project-base
- noir-contracts-build
<<: *defaults
- yarn-project-test:
- yarn-project-formatting:
requires:
- yarn-project
<<: *defaults
- yarn-project:
- yarn-project-tests:
requires:
- yarn-project-base
- noir-contracts-build
- yarn-project
<<: *defaults

- end-to-end: *yarn_project
Expand Down
7 changes: 5 additions & 2 deletions barretenberg/cpp/dockerfiles/Dockerfile.wasm-linux-clang
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ WORKDIR /usr/src/barretenberg/cpp
COPY ./scripts/install-wasi-sdk.sh ./scripts/install-wasi-sdk.sh
RUN ./scripts/install-wasi-sdk.sh
COPY . .
RUN cmake --preset wasm && cmake --build --preset wasm
RUN cmake --preset wasm-threads && cmake --build --preset wasm-threads
# Building both wasm's in parallel reduces build from 120s to 80s.
RUN (cmake --preset wasm && cmake --build --preset wasm) & \
(cmake --preset wasm-threads && cmake --build --preset wasm-threads) & \
wait


FROM scratch
WORKDIR /usr/src/barretenberg/cpp
Expand Down
3 changes: 1 addition & 2 deletions bootstrap_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
set -e

PROJECT_NAME=${1:-}
COMMIT_HASH=$(git rev-parse HEAD)

if [ -z "$PROJECT_NAME" ]; then
echo "usage: $0 <project_name>"
Expand All @@ -31,7 +30,7 @@ fi

cd "$(dirname "$0")"

source ./build-system/scripts/setup_env $COMMIT_HASH '' mainframe_$USER > /dev/null
source ./build-system/scripts/setup_env '' '' mainframe_$USER > /dev/null
build_local $PROJECT_NAME

if [ -z "$PROJECT_NAME" ]; then
Expand Down
10 changes: 10 additions & 0 deletions build-system/scripts/cond_spot_run_container
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
[ -n "${BUILD_SYSTEM_DEBUG:-}" ] && set -x # conditionally trace
set -eu

REPOSITORY=$1
CPUS=$2
shift 2

export TAG_POSTFIX=$JOB_NAME
cond_spot_run_script $REPOSITORY $CPUS cond_run_container $REPOSITORY $@
5 changes: 3 additions & 2 deletions build_manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ noir-contracts-build:
rebuildPatterns:
- ^yarn-project/noir-contracts/
- ^yarn-project/aztec-nr/
# Prevent automatic querying of get_dependencies.sh script. Needed because this looks like a yarn project.
dependencies: []

yarn-project-base:
buildDir: yarn-project
Expand All @@ -113,6 +111,9 @@ yarn-project-base:

yarn-project:
buildDir: yarn-project
rebuildPatterns:
- ^yarn-project/.*\\.(ts|js|cjs|mjs|json|html)$
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs tsx

- ^yarn-project/Dockerfile
dependencies:
- yarn-project-base
- noir-contracts-build
Expand Down
4 changes: 3 additions & 1 deletion yarn-project/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
**/*.tsbuildinfo
**/Dockerfile*
**/node_modules
Dockerfile

noir-contracts/src/types
noir-contracts/src/artifacts
noir-contracts/src/artifacts
noir-contracts/target
873 changes: 0 additions & 873 deletions yarn-project/.yarn/releases/yarn-3.4.1.cjs

This file was deleted.

874 changes: 874 additions & 0 deletions yarn-project/.yarn/releases/yarn-3.6.3.cjs

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions yarn-project/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: '@yarnpkg/plugin-workspace-tools'

# note that pnp is used in CI
nodeLinker: node-modules
yarnPath: .yarn/releases/yarn-3.4.1.cjs
yarnPath: .yarn/releases/yarn-3.6.3.cjs
13 changes: 10 additions & 3 deletions yarn-project/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
# This base dockerfile adds all the remaining source files, performs artifact generation, and builds the project.
# See yarn-project-base/Dockerfile for deeper insight into why things are how they are.
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/noir-contracts-build as noir
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/yarn-project-base
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/yarn-project-base as builder

# Copy in the entire workspace.
COPY . .

# Generate Noir contract TypeScript artifacts.
COPY --from=noir /usr/src/yarn-project/noir-contracts/target /usr/src/yarn-project/noir-contracts/target
# Run yarn build to have the json ABIs available for the types generator, generate types, build again.
RUN apk add perl
RUN cd /usr/src/yarn-project/noir-contracts && yarn build && ./scripts/types_all.sh && yarn build
# Cleanup to reduce final image size.
RUN rm -rf noir-contracts/target

# Build the entire project and check formatting.
# Build the entire project.
RUN yarn tsc -b
ENTRYPOINT [ "yarn" ]

FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/yarn-project-base
COPY --from=builder /usr/src/yarn-project /usr/src/yarn-project
ENTRYPOINT ["yarn"]
7 changes: 0 additions & 7 deletions yarn-project/Dockerfile.format

This file was deleted.

7 changes: 0 additions & 7 deletions yarn-project/Dockerfile.test

This file was deleted.

2 changes: 2 additions & 0 deletions yarn-project/acir-simulator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
"@jest/globals": "^29.5.0",
"@rushstack/eslint-patch": "^1.1.4",
"@types/jest": "^29.5.0",
"@types/levelup": "^5.1.3",
"@types/memdown": "^3.0.2",
"@types/node": "^18.7.23",
"jest": "^29.5.0",
"jest-mock-extended": "^3.0.4",
Expand Down
2 changes: 2 additions & 0 deletions yarn-project/aztec-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
"@aztec/world-state": "workspace:^",
"koa": "^2.14.2",
"koa-router": "^12.0.0",
"levelup": "^5.1.1",
"memdown": "^6.1.1",
"tslib": "^2.4.0"
},
"devDependencies": {
Expand Down
14 changes: 3 additions & 11 deletions yarn-project/aztec-sandbox/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/yarn-project AS builder

ARG COMMIT_TAG=""

# Remove SRS files (currently not producing proofs)
RUN rm -rf /usr/src/barretenberg/cpp/srs_db/ignition/monomial
COPY . .

# Update pxe version if COMMIT_TAG has been used
WORKDIR /usr/src/yarn-project/pxe
RUN if [[ -n "${COMMIT_TAG}" ]]; then \
Expand All @@ -17,17 +13,13 @@ RUN if [[ -n "${COMMIT_TAG}" ]]; then \
jq --arg v ${COMMIT_TAG} '.version = $v' package.json > _temp && mv _temp package.json; \
fi

RUN yarn build && yarn formatting && yarn test

# Prune dev dependencies. See comment in base image.
RUN yarn cache clean
RUN yarn workspaces focus --production > /dev/null
# Productionify. See comment in yarn-project-base/Dockerfile.
RUN yarn cache clean && yarn workspaces focus --production

# Create final, minimal size image.
FROM node:18-alpine

COPY --from=builder /usr/src/ /usr/src/
WORKDIR /usr/src/yarn-project/aztec-sandbox

ENTRYPOINT ["yarn"]
CMD [ "start" ]
EXPOSE 8080
2 changes: 0 additions & 2 deletions yarn-project/aztec.js/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,9 @@ export default {
path: false,
url: false,
worker_threads: false,
events: require.resolve('events/'),
buffer: require.resolve('buffer/'),
util: require.resolve('util/'),
stream: require.resolve('stream-browserify'),
string_decoder: require.resolve('string_decoder/'),
tty: require.resolve('tty-browserify'),
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ export async function callContractFunction(
return contract.methods[functionName](...typedArgs)
.send()
.wait();

}
1 change: 0 additions & 1 deletion yarn-project/boxes/blank/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ export async function handleInteractClick(contractAddress: string) {
);
}


export const getFunctionAbi = (contractAbi: any, functionName: string) => {
const functionAbi = contractAbi.functions.find((f: FunctionAbi) => f.name === functionName);
if (!functionAbi) throw new Error(`Function ${functionName} not found in abi`);
Expand Down
5 changes: 0 additions & 5 deletions yarn-project/canary/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/yarn-project AS builder
ARG COMMIT_TAG="."

COPY . .

# Setup & Build end-to-end package
WORKDIR /usr/src/yarn-project/end-to-end

# Extract canary @aztec dependencies
RUN ../canary/scripts/extract_packages.sh ../canary/package.json > ./target_pkgs.txt
# Update end-to-end dependencies with target version
RUN ./scripts/setup_canary.sh "$COMMIT_TAG" ./target_pkgs.txt
RUN rm ./target_pkgs.txt
RUN yarn && yarn build

# Build canary package
WORKDIR /usr/src/yarn-project/canary
RUN ./scripts/update_packages.sh "$COMMIT_TAG"
RUN yarn && yarn build

FROM node:18-alpine
RUN apk update && apk add --no-cache udev ttf-freefont chromium curl jq bash
Expand Down
10 changes: 2 additions & 8 deletions yarn-project/canary/Dockerfile.build
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/yarn-project AS builder

COPY . .

WORKDIR /usr/src/yarn-project/canary
RUN yarn build

# Prune dev dependencies. See comment in base image.
RUN yarn cache clean
RUN yarn workspaces focus --production > /dev/null
# Productionify. See comment in yarn-project-base/Dockerfile.
RUN yarn cache clean && yarn workspaces focus --production

FROM node:18-alpine
COPY --from=builder /usr/src /usr/src
Expand Down
1 change: 1 addition & 0 deletions yarn-project/canary/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"@types/jest": "^29.5.0",
"@types/koa-static": "^4.0.2",
"@types/node": "^18.7.23",
"abitype": "^0.9.8",
"jest": "^29.5.0",
"koa": "^2.14.2",
"koa-static": "^5.0.0",
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/canary/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export async function deployL1Contract(
abi,
bytecode,
args,
});
} as any);

const receipt = await publicClient.waitForTransactionReceipt({ hash });
const contractAddress = receipt.contractAddress;
Expand Down
1 change: 1 addition & 0 deletions yarn-project/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"@types/jest": "^29.5.0",
"@types/lodash.startcase": "^4.4.7",
"@types/node": "^18.7.23",
"@types/semver": "^7.5.2",
"jest": "^29.5.0",
"jest-mock-extended": "^3.0.5",
"ts-jest": "^29.1.0",
Expand Down
15 changes: 4 additions & 11 deletions yarn-project/end-to-end/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/yarn-project AS builder

# Copy in the whole of yarn-project.
COPY . .

# Build aztec.js web.
WORKDIR /usr/src/yarn-project/aztec.js
RUN yarn build
RUN yarn cache clean
RUN yarn build:web

# Build end-to-end.
WORKDIR /usr/src/yarn-project/end-to-end
RUN yarn build && yarn formatting

# Prune dev dependencies. See comment in base image.
RUN yarn cache clean
RUN yarn workspaces focus --production > /dev/null
# Productionify. See comment in yarn-project-base/Dockerfile.
RUN yarn cache clean && yarn workspaces focus --production

# Create final, minimal size image.
# TODO: Not very minimal as chromium adds about 500MB of bloat :/ Separate or install at test runtime?
FROM node:18-alpine
RUN apk update && apk add --no-cache \
bash \
Expand Down
1 change: 1 addition & 0 deletions yarn-project/end-to-end/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"@jest/globals": "^29.5.0",
"@noble/curves": "^1.0.0",
"@types/jest": "^29.5.0",
"@types/koa": "^2.13.9",
"@types/koa-static": "^4.0.2",
"@types/levelup": "^5.1.2",
"@types/lodash.every": "^4.6.7",
Expand Down
Loading