Skip to content

Commit 68a2226

Browse files
authored
chore(ci): use labels and if branch=master to control jobs (#8508)
Implements a default CI list of e2e tests: ``` "e2e-2-pxes" "e2e-authwit" "e2e-avm-simulator" "e2e-block-building" "e2e-cross-chain-messaging" "e2e-deploy-contract" "e2e-fees" "e2e-fees-gas-estimation" "e2e-fees-private-payments" "e2e-max-block-number" "e2e-nested-contract" "e2e-ordering" "e2e-prover-full" "e2e-static-calls" ``` More tests can be added on with labels. All tests run on master.
1 parent bcec12d commit 68a2226

File tree

3 files changed

+103
-5
lines changed

3 files changed

+103
-5
lines changed

.github/workflows/ci.yml

+12-5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
- reopened
99
- synchronize
1010
- ready_for_review
11+
- labeled
1112
branches-ignore: [devnet]
1213
workflow_dispatch:
1314
inputs: {}
@@ -113,7 +114,7 @@ jobs:
113114
114115
build:
115116
needs: [build-images, changes]
116-
if: needs.changes.outputs.non-docs == 'true' && needs.changes.outputs.non-misc-ci == 'true' && needs.changes.outputs.non-barretenberg-cpp == 'true'
117+
if: (needs.changes.outputs.non-docs == 'true' && needs.changes.outputs.non-misc-ci == 'true' && needs.changes.outputs.non-barretenberg-cpp == 'true') || github.ref_name == 'master'
117118
runs-on: ${{ github.event.pull_request.user.login || github.actor }}-x86
118119
outputs:
119120
e2e_list: ${{ steps.e2e_list.outputs.list }}
@@ -133,15 +134,21 @@ jobs:
133134
# (Note ARM uses just 2 tests as a smoketest)
134135
- name: Create list of non-bench end-to-end jobs
135136
id: e2e_list
136-
run: echo "list=$(earthly ls ./yarn-project/end-to-end | grep -v '+base' | grep -v '+bench' | grep -v "+network" | grep -v 'devnet' | sed 's/+//' | jq -R . | jq -cs .)" >> $GITHUB_OUTPUT
137+
run: |
138+
LABELS=$(jq -r '.pull_request.labels | map(.name) | join(",")' "$GITHUB_EVENT_PATH")
139+
echo Labels: $LABELS
140+
echo "list=$(./scripts/ci/get_e2e_jobs.sh ${{github.ref_name}} "$LABELS")" >> $GITHUB_OUTPUT
137141
- name: Create list of bench end-to-end jobs
138142
id: bench_list
139-
run: echo "list=$(earthly ls ./yarn-project/end-to-end | grep '+bench' | sed 's/+//' | jq -R . | jq -cs .)" >> $GITHUB_OUTPUT
143+
run: |
144+
LABELS=$(jq -r '.pull_request.labels | map(.name) | join(",")' "$GITHUB_EVENT_PATH")
145+
echo Labels: $LABELS
146+
echo "list=$(./scripts/ci/get_bench_jobs.sh ${{github.ref_name}} "$LABELS")" >> $GITHUB_OUTPUT
140147
141148
# all the non-bench end-to-end integration tests for aztec
142149
e2e:
143150
needs: [build, changes]
144-
if: needs.changes.outputs.non-barretenberg-cpp == 'true'
151+
if: needs.changes.outputs.non-barretenberg-cpp == 'true' || github.ref_name == 'master' || contains(github.event.pull_request.labels.*.name, 'e2e')
145152
runs-on: ubuntu-20.04
146153
strategy:
147154
fail-fast: false
@@ -171,7 +178,7 @@ jobs:
171178
# all the benchmarking end-to-end integration tests for aztec (not required to merge)
172179
bench-e2e:
173180
needs: [build, changes]
174-
if: needs.changes.outputs.non-barretenberg-cpp == 'true'
181+
if: needs.changes.outputs.non-barretenberg-cpp == 'true' || github.ref_name == 'master' || contains(github.event.pull_request.labels.*.name, 'bench')
175182
runs-on: ubuntu-20.04
176183
strategy:
177184
fail-fast: false

scripts/ci/get_bench_jobs.sh

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
set -eu
3+
4+
# Enter repo root.
5+
cd "$(dirname "$0")"/../..
6+
7+
BRANCH=$1
8+
LABELS=$2
9+
10+
# Define the allow_list
11+
allow_list=()
12+
13+
# Add labels from input to the allow_list
14+
IFS=',' read -r -a input_labels <<< "$LABELS"
15+
allow_list+=("${input_labels[@]}")
16+
17+
# Generate full list of targets on one line
18+
full_list=$(earthly ls ./yarn-project/end-to-end | grep '+bench' | sed 's/+//' | xargs echo)
19+
20+
# If branch is master or allow_list contains 'bench-all', return full list
21+
if [[ "$BRANCH" == "master" ]] || [[ " ${allow_list[@]} " =~ "bench-all" ]]; then
22+
# print as JSON list
23+
echo "$full_list" | jq -Rc 'split(" ")'
24+
exit 0
25+
fi
26+
27+
# Filter the full_list to include only items in the allow_list
28+
filtered_list=()
29+
for item in $full_list; do
30+
for allowed in "${allow_list[@]}"; do
31+
if [[ "$item" == "$allowed" ]]; then
32+
filtered_list+=("$item")
33+
fi
34+
done
35+
done
36+
37+
# Print the filtered list in JSON format
38+
echo ${filtered_list[@]} | jq -Rc 'split(" ")'

scripts/ci/get_e2e_jobs.sh

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
set -eu
3+
4+
# Enter repo root.
5+
cd "$(dirname "$0")"/../..
6+
7+
BRANCH=$1
8+
LABELS=$2
9+
10+
# Define the allow_list
11+
allow_list=(
12+
"e2e-2-pxes"
13+
"e2e-authwit"
14+
"e2e-avm-simulator"
15+
"e2e-block-building"
16+
"e2e-cross-chain-messaging"
17+
"e2e-deploy-contract"
18+
"e2e-fees"
19+
"e2e-fees-gas-estimation"
20+
"e2e-fees-private-payments"
21+
"e2e-max-block-number"
22+
"e2e-nested-contract"
23+
"e2e-ordering"
24+
"e2e-prover-full"
25+
"e2e-static-calls"
26+
)
27+
28+
# Add labels from input to the allow_list
29+
IFS=',' read -r -a input_labels <<< "$LABELS"
30+
allow_list+=("${input_labels[@]}")
31+
32+
# Generate full list of targets, excluding specific entries, on one line
33+
full_list=$(earthly ls ./yarn-project/end-to-end | grep -v '+base' | grep -v '+bench' | grep -v "+network" | grep -v 'devnet' | sed 's/+//' | xargs echo)
34+
35+
# If branch is master or allow_list contains 'e2e-all', return full list
36+
if [[ "$BRANCH" == "master" ]] || [[ " ${allow_list[@]} " =~ "e2e-all" ]]; then
37+
# print as JSON list
38+
echo "$full_list" | jq -Rc 'split(" ")'
39+
exit 0
40+
fi
41+
42+
# Filter the full_list to include only items in the allow_list
43+
filtered_list=()
44+
for item in $full_list; do
45+
for allowed in "${allow_list[@]}"; do
46+
if [[ "$item" == "$allowed" ]]; then
47+
filtered_list+=("$item")
48+
fi
49+
done
50+
done
51+
52+
# Print the filtered list in JSON format
53+
echo ${filtered_list[@]} | jq -Rc 'split(" ")'

0 commit comments

Comments
 (0)