forked from AztecProtocol/aztec-packages
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Earthfile
154 lines (137 loc) · 4.78 KB
/
Earthfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
VERSION 0.8
deps:
LOCALLY
LET packages = $(git ls-files "**/package*.json" package*.json)
LET tsconfigs = $(git ls-files "**/tsconfig*.json" tsconfig*.json)
# use the build image to build the project so that nargo has access to the same libc
# later on, once everything is built and we don't need nargo, copy to a debian based image
# that's supported by playwright
FROM ../build-images+from-registry
# copy the aztec yarn workspace, needed to resolve portal dependencies
COPY ../yarn-project+build-dev/usr/src /usr/src
WORKDIR /usr/src/boxes
COPY --dir .yarn .yarnrc.yml yarn.lock .
FOR file IN $packages
COPY $file $file
END
RUN yarn install --immutable
# don't install playwright here as it's not compatible with ubuntu 24.04 yet
# https://github.com/microsoft/playwright/issues/30368
FOR file IN $tsconfigs
COPY $file $file
END
build:
FROM +deps
COPY ../noir/+nargo/nargo /usr/src/noir/noir-repo/target/release/nargo
COPY ../noir-projects/+build/aztec-nr /usr/src/noir-projects/aztec-nr
COPY ../noir-projects/+build/noir-protocol-circuits/crates/types /usr/src/noir-projects/noir-protocol-circuits/crates/types
COPY ../avm-transpiler+build/avm-transpiler /usr/src/avm-transpiler/target/release/avm-transpiler
COPY ../barretenberg/cpp/+preset-release/bin/bb /usr/src/barretenberg/cpp/build/bin/bb
COPY ../aztec-nargo+run/aztec-nargo /usr/src/aztec-nargo
WORKDIR /usr/src/boxes
ENV NARGO=/usr/src/noir/noir-repo/target/release/nargo
ENV TRANSPILER=/usr/src/avm-transpiler/target/release/avm-transpiler
ENV BB=/usr/src/barretenberg/cpp/build/bin/bb
ENV AZTEC_NARGO=/usr/src/aztec-nargo
ENV AZTEC_BUILDER=/usr/src/yarn-project/builder/aztec-builder-dest
COPY . .
RUN yarn build
SAVE ARTIFACT /usr/src /usr/src
boxes:
FROM ../build-images/+base-slim-node
# prefetch playwright installs earlier in downloads
RUN npx playwright install --with-deps
COPY --dir +build/usr/src /usr
WORKDIR /usr/src/boxes
RUN yarn install-browsers
ENTRYPOINT ["/bin/sh", "-c"]
npx:
FROM ../build-images/+base-slim-node
COPY --dir +build/usr/src /usr
WORKDIR /usr/src/boxes
RUN yarn
RUN yarn test:ci
BOX_TEST_LOCAL:
FUNCTION
ARG box
ARG browser
ARG compose_file=./docker-compose.yml
ARG debug="aztec:*"
LOCALLY
ENV BOX=$box
ENV BROWSER=$browser
ENV DEBUG=$debug
ENV CI=1
WITH DOCKER \
--load aztecprotocol/aztec:latest=../yarn-project/+aztec \
--load aztecprotocol/boxes:latest=+boxes
RUN docker compose -f $compose_file up --exit-code-from=boxes --force-recreate
END
# run locally and take from cache, used for our mainly x86 jobs
BOX_TEST_FROM_CACHE:
FUNCTION
ARG box
ARG browser
ARG compose_file=./docker-compose.yml
ARG debug="aztec:*"
ARG aztec_docker_tag
LOCALLY
ENV BOX=$box
ENV BROWSER=$browser
ENV DEBUG=$debug
ENV AZTEC_DOCKER_TAG=$aztec_docker_tag
ENV CI=1
# need a different project name for each to run in parallel
LET project_name="$box"_"$browser"
IF docker compose > /dev/null 2>&1
LET CMD="docker compose"
ELSE
LET CMD="docker-compose"
END
# In CI we do not use WITH DOCKER as we have had issues with earthly copying big images
RUN $CMD -p $project_name -f $compose_file up --exit-code-from=boxes --force-recreate
BOX_TEST_FROM_BUILD:
FUNCTION
ARG box
ARG browser
ARG compose_file=./docker-compose.yml
ARG debug="aztec:*"
FROM earthly/dind:alpine-3.19-docker-25.0.2-r0
ENV BOX=$box
ENV BROWSER=$browser
ENV DEBUG=$debug
ENV CI=1
COPY $compose_file $compose_file
# For ARM, we do use WITH DOCKER as we don't have many e2e tests, but note BOX_TEST_FROM_CACHE
WITH DOCKER \
--load aztecprotocol/aztec:latest=../yarn-project/+aztec \
--load aztecprotocol/boxes:latest=+boxes
# Run our docker compose, ending whenever sandbox ends, filtering out noisy eth_getLogs
RUN docker compose -f $compose_file up --exit-code-from=boxes --force-recreate
END
BOX_TEST:
FUNCTION
ARG box
ARG browser
ARG compose_file=./docker-compose.yml
ARG mode=local
ARG debug="aztec:*"
LOCALLY
IF [ $mode = local ]
DO +BOX_TEST_LOCAL --box=$box --browser=$browser --compose_file=$compose_file --debug=$debug
ELSE IF [ $mode = cache ]
DO +BOX_TEST_FROM_CACHE --box=$box --browser=$browser --aztec_docker_tag=$(git rev-parse HEAD) --compose_file=$compose_file --debug=$debug
ELSE
DO +BOX_TEST_FROM_BUILD --box=$box --browser=$browser --compose_file=$compose_file --debug=$debug
END
test:
ARG box=vanilla
ARG browser=chromium
ARG mode=local
DO +BOX_TEST --box=$box --browser=$browser --mode=$mode
# for use with mode=cache
export-boxes:
BUILD +boxes
ARG EARTHLY_GIT_HASH
FROM +boxes
SAVE IMAGE aztecprotocol/boxes:$EARTHLY_GIT_HASH