From 50509125063fa8ceaa88eb57e8f0704eaf0aba7e Mon Sep 17 00:00:00 2001 From: ludamad Date: Wed, 11 Sep 2024 22:33:48 +0000 Subject: [PATCH 1/7] chore(ci): use labels and master to control jobs --- .github/workflows/ci.yml | 16 +++++++---- scripts/ci/get_bench_jobs.sh | 36 +++++++++++++++++++++++++ scripts/ci/get_e2e_jobs.sh | 52 ++++++++++++++++++++++++++++++++++++ 3 files changed, 99 insertions(+), 5 deletions(-) create mode 100755 scripts/ci/get_bench_jobs.sh create mode 100755 scripts/ci/get_e2e_jobs.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 78bab204d48..8782ecdacfe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -113,7 +113,7 @@ jobs: build: needs: [build-images, changes] - if: needs.changes.outputs.non-docs == 'true' && needs.changes.outputs.non-misc-ci == 'true' && needs.changes.outputs.non-barretenberg-cpp == 'true' + 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' runs-on: ${{ github.event.pull_request.user.login || github.actor }}-x86 outputs: e2e_list: ${{ steps.e2e_list.outputs.list }} @@ -133,15 +133,21 @@ jobs: # (Note ARM uses just 2 tests as a smoketest) - name: Create list of non-bench end-to-end jobs id: e2e_list - 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 + run: + LABELS=$(jq -r '.pull_request.labels | map(.name) | join(",")' "$GITHUB_EVENT_PATH") + echo Labels: $LABELS + echo "list=$(./scripts/ci/get_e2e_jobs.sh ${{github.ref_name}} "$LABELS")" >> $GITHUB_OUTPUT - name: Create list of bench end-to-end jobs id: bench_list - run: echo "list=$(earthly ls ./yarn-project/end-to-end | grep '+bench' | sed 's/+//' | jq -R . | jq -cs .)" >> $GITHUB_OUTPUT + run: + LABELS=$(jq -r '.pull_request.labels | map(.name) | join(",")' "$GITHUB_EVENT_PATH") + echo Labels: $LABELS + echo "list=$(./scripts/ci/get_bench_jobs.sh ${{github.ref_name}} "$LABELS")" >> $GITHUB_OUTPUT # all the non-bench end-to-end integration tests for aztec e2e: needs: [build, changes] - if: needs.changes.outputs.non-barretenberg-cpp == 'true' + if: needs.changes.outputs.non-barretenberg-cpp == 'true' || github.ref_name == 'master' runs-on: ubuntu-20.04 strategy: fail-fast: false @@ -171,7 +177,7 @@ jobs: # all the benchmarking end-to-end integration tests for aztec (not required to merge) bench-e2e: needs: [build, changes] - if: needs.changes.outputs.non-barretenberg-cpp == 'true' + if: needs.changes.outputs.non-barretenberg-cpp == 'true' || github.ref_name == 'master' runs-on: ubuntu-20.04 strategy: fail-fast: false diff --git a/scripts/ci/get_bench_jobs.sh b/scripts/ci/get_bench_jobs.sh new file mode 100755 index 00000000000..970be4fc9b6 --- /dev/null +++ b/scripts/ci/get_bench_jobs.sh @@ -0,0 +1,36 @@ +#!/bin/bash +set -eu + +# Enter repo root. +cd $(dirname $0)/../.. + +BRANCH=$1 +LABELS=$2 + +# Define the allow_list +allow_list=() + +# Add labels from input to the allow_list +IFS=',' read -r -a input_labels <<< "$LABELS" +allow_list+=("${input_labels[@]}") + +# Convert allow_list to items prepended with '+' +allow_list_plus=() +for item in "${allow_list[@]}"; do + allow_list_plus+=("+$item") +done + +# Generate full list of targets +full_list=$(earthly ls ./yarn-project/end-to-end | grep '+bench' | sed 's/+//' | jq -R . | jq -cs .) + +# If branch is master or allow_list contains '+e2e-all', return full list +if [[ "$BRANCH" == "master" ]] || [[ " ${allow_list[@]} " =~ "bench-all" ]]; then + echo "$full_list" + exit 0 +fi + +# Filter full_list with only things inside allow_list_plus +filtered_list=$(echo "$full_list" | jq -c ".[] | select(. as \$i | $(printf 'contains(\"%s\") or ' "${allow_list_plus[@]}" | sed 's/ or $//'))" | jq -cs .) + +# Print the filtered list +echo "$filtered_list" diff --git a/scripts/ci/get_e2e_jobs.sh b/scripts/ci/get_e2e_jobs.sh new file mode 100755 index 00000000000..9340a2b51e8 --- /dev/null +++ b/scripts/ci/get_e2e_jobs.sh @@ -0,0 +1,52 @@ +#!/bin/bash +set -eu + +# Enter repo root. +cd "$(dirname "$0")"/../.. + +BRANCH=$1 +LABELS=$2 + +# Define the allow_list +allow_list=( + "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" +) + +# Add labels from input to the allow_list +IFS=',' read -r -a input_labels <<< "$LABELS" +allow_list+=("${input_labels[@]}") + +# Generate full list of targets, excluding specific entries +full_list=$(earthly ls ./yarn-project/end-to-end | grep -v '+base' | grep -v '+bench' | grep -v "+network" | grep -v 'devnet' | sed 's/+//') + +# If branch is master or allow_list contains 'e2e-all', return full list +if [[ "$BRANCH" == "master" ]] || [[ " ${allow_list[@]} " =~ "e2e-all" ]]; then + echo "$full_list" + exit 0 +fi + +# Filter the full_list to include only items in the allow_list +filtered_list=() +for item in $full_list; do + for allowed in "${allow_list[@]}"; do + if [[ "$item" == "$allowed" ]]; then + filtered_list+=("$item") + fi + done +done + +# Print the filtered list +echo "${filtered_list[@]}" From bc8fdde7f3e9c1837ce6289eae62584a96c1fdc0 Mon Sep 17 00:00:00 2001 From: ludamad Date: Wed, 11 Sep 2024 19:09:49 -0400 Subject: [PATCH 2/7] Update ci.yml --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8782ecdacfe..1078010bdb2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -133,13 +133,13 @@ jobs: # (Note ARM uses just 2 tests as a smoketest) - name: Create list of non-bench end-to-end jobs id: e2e_list - run: + run: | LABELS=$(jq -r '.pull_request.labels | map(.name) | join(",")' "$GITHUB_EVENT_PATH") echo Labels: $LABELS echo "list=$(./scripts/ci/get_e2e_jobs.sh ${{github.ref_name}} "$LABELS")" >> $GITHUB_OUTPUT - name: Create list of bench end-to-end jobs id: bench_list - run: + run: | LABELS=$(jq -r '.pull_request.labels | map(.name) | join(",")' "$GITHUB_EVENT_PATH") echo Labels: $LABELS echo "list=$(./scripts/ci/get_bench_jobs.sh ${{github.ref_name}} "$LABELS")" >> $GITHUB_OUTPUT From 9a838b110642840a2e47de4bf9e0c9d46c776107 Mon Sep 17 00:00:00 2001 From: ludamad Date: Thu, 12 Sep 2024 16:42:49 +0000 Subject: [PATCH 3/7] try again --- scripts/ci/get_bench_jobs.sh | 33 ++++++++++++++++++--------------- scripts/ci/get_e2e_jobs.sh | 7 ++++--- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/scripts/ci/get_bench_jobs.sh b/scripts/ci/get_bench_jobs.sh index 970be4fc9b6..d3b424d3a08 100755 --- a/scripts/ci/get_bench_jobs.sh +++ b/scripts/ci/get_bench_jobs.sh @@ -2,7 +2,7 @@ set -eu # Enter repo root. -cd $(dirname $0)/../.. +cd "$(dirname "$0")"/../.. BRANCH=$1 LABELS=$2 @@ -14,23 +14,26 @@ allow_list=() IFS=',' read -r -a input_labels <<< "$LABELS" allow_list+=("${input_labels[@]}") -# Convert allow_list to items prepended with '+' -allow_list_plus=() -for item in "${allow_list[@]}"; do - allow_list_plus+=("+$item") -done - -# Generate full list of targets -full_list=$(earthly ls ./yarn-project/end-to-end | grep '+bench' | sed 's/+//' | jq -R . | jq -cs .) +# Generate full list of targets on one line +full_list=$(earthly ls ./yarn-project/end-to-end | grep '+bench' | sed 's/+//' | xargs echo) -# If branch is master or allow_list contains '+e2e-all', return full list +echo "$full_list" +# If branch is master or allow_list contains 'bench-all', return full list if [[ "$BRANCH" == "master" ]] || [[ " ${allow_list[@]} " =~ "bench-all" ]]; then - echo "$full_list" + # print as JSON list + echo "$full_list" | jq -R 'split(" ")' exit 0 fi -# Filter full_list with only things inside allow_list_plus -filtered_list=$(echo "$full_list" | jq -c ".[] | select(. as \$i | $(printf 'contains(\"%s\") or ' "${allow_list_plus[@]}" | sed 's/ or $//'))" | jq -cs .) +# Filter the full_list to include only items in the allow_list +filtered_list=() +for item in $full_list; do + for allowed in "${allow_list[@]}"; do + if [[ "$item" == "$allowed" ]]; then + filtered_list+=("$item") + fi + done +done -# Print the filtered list -echo "$filtered_list" +# Print the filtered list in JSON format +echo ${filtered_list[@]} | jq -R 'split(" ")' diff --git a/scripts/ci/get_e2e_jobs.sh b/scripts/ci/get_e2e_jobs.sh index 9340a2b51e8..06f59201a2d 100755 --- a/scripts/ci/get_e2e_jobs.sh +++ b/scripts/ci/get_e2e_jobs.sh @@ -34,7 +34,8 @@ full_list=$(earthly ls ./yarn-project/end-to-end | grep -v '+base' | grep -v '+b # If branch is master or allow_list contains 'e2e-all', return full list if [[ "$BRANCH" == "master" ]] || [[ " ${allow_list[@]} " =~ "e2e-all" ]]; then - echo "$full_list" + # print as JSON list + echo "$full_list" | jq -R 'split(" ")' exit 0 fi @@ -48,5 +49,5 @@ for item in $full_list; do done done -# Print the filtered list -echo "${filtered_list[@]}" +# Print the filtered list in JSON format +echo ${filtered_list[@]} | jq -R 'split(" ")' \ No newline at end of file From d2c45426a5e23c6cbbe1248933be2433e122c149 Mon Sep 17 00:00:00 2001 From: ludamad Date: Thu, 12 Sep 2024 16:54:44 +0000 Subject: [PATCH 4/7] one liner --- scripts/ci/get_bench_jobs.sh | 4 ++-- scripts/ci/get_e2e_jobs.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/ci/get_bench_jobs.sh b/scripts/ci/get_bench_jobs.sh index d3b424d3a08..0adb45a186d 100755 --- a/scripts/ci/get_bench_jobs.sh +++ b/scripts/ci/get_bench_jobs.sh @@ -21,7 +21,7 @@ echo "$full_list" # If branch is master or allow_list contains 'bench-all', return full list if [[ "$BRANCH" == "master" ]] || [[ " ${allow_list[@]} " =~ "bench-all" ]]; then # print as JSON list - echo "$full_list" | jq -R 'split(" ")' + echo "$full_list" | jq -Rc 'split(" ")' exit 0 fi @@ -36,4 +36,4 @@ for item in $full_list; do done # Print the filtered list in JSON format -echo ${filtered_list[@]} | jq -R 'split(" ")' +echo ${filtered_list[@]} | jq -Rc 'split(" ")' diff --git a/scripts/ci/get_e2e_jobs.sh b/scripts/ci/get_e2e_jobs.sh index 06f59201a2d..569982f6e62 100755 --- a/scripts/ci/get_e2e_jobs.sh +++ b/scripts/ci/get_e2e_jobs.sh @@ -35,7 +35,7 @@ full_list=$(earthly ls ./yarn-project/end-to-end | grep -v '+base' | grep -v '+b # If branch is master or allow_list contains 'e2e-all', return full list if [[ "$BRANCH" == "master" ]] || [[ " ${allow_list[@]} " =~ "e2e-all" ]]; then # print as JSON list - echo "$full_list" | jq -R 'split(" ")' + echo "$full_list" | jq -Rc 'split(" ")' exit 0 fi @@ -50,4 +50,4 @@ for item in $full_list; do done # Print the filtered list in JSON format -echo ${filtered_list[@]} | jq -R 'split(" ")' \ No newline at end of file +echo ${filtered_list[@]} | jq -Rc 'split(" ")' \ No newline at end of file From 41abe531fc9477fb7561f95aafbae98f9077d6fa Mon Sep 17 00:00:00 2001 From: ludamad Date: Thu, 12 Sep 2024 18:51:54 +0000 Subject: [PATCH 5/7] try fix --- .github/workflows/ci.yml | 4 ++-- scripts/ci/get_bench_jobs.sh | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1078010bdb2..fbf4a72f9b6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -147,7 +147,7 @@ jobs: # all the non-bench end-to-end integration tests for aztec e2e: needs: [build, changes] - if: needs.changes.outputs.non-barretenberg-cpp == 'true' || github.ref_name == 'master' + if: needs.changes.outputs.non-barretenberg-cpp == 'true' || github.ref_name == 'master' || contains(github.event.pull_request.labels.*.name, 'e2e') runs-on: ubuntu-20.04 strategy: fail-fast: false @@ -177,7 +177,7 @@ jobs: # all the benchmarking end-to-end integration tests for aztec (not required to merge) bench-e2e: needs: [build, changes] - if: needs.changes.outputs.non-barretenberg-cpp == 'true' || github.ref_name == 'master' + if: needs.changes.outputs.non-barretenberg-cpp == 'true' || github.ref_name == 'master' || contains(github.event.pull_request.labels.*.name, 'bench') runs-on: ubuntu-20.04 strategy: fail-fast: false diff --git a/scripts/ci/get_bench_jobs.sh b/scripts/ci/get_bench_jobs.sh index 0adb45a186d..a93ef001f9a 100755 --- a/scripts/ci/get_bench_jobs.sh +++ b/scripts/ci/get_bench_jobs.sh @@ -17,7 +17,6 @@ allow_list+=("${input_labels[@]}") # Generate full list of targets on one line full_list=$(earthly ls ./yarn-project/end-to-end | grep '+bench' | sed 's/+//' | xargs echo) -echo "$full_list" # If branch is master or allow_list contains 'bench-all', return full list if [[ "$BRANCH" == "master" ]] || [[ " ${allow_list[@]} " =~ "bench-all" ]]; then # print as JSON list From 8076c924f92a509b58f1a4e6ab7c1375c0926c64 Mon Sep 17 00:00:00 2001 From: ludamad Date: Thu, 12 Sep 2024 15:39:59 -0400 Subject: [PATCH 6/7] Update ci.yml --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fbf4a72f9b6..b297ee1f5de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,6 +8,7 @@ on: - reopened - synchronize - ready_for_review + - labeled branches-ignore: [devnet] workflow_dispatch: inputs: {} From b833a3ef4ca3ff39ddd88eba074000226e1e06ba Mon Sep 17 00:00:00 2001 From: ludamad Date: Thu, 12 Sep 2024 20:43:18 +0000 Subject: [PATCH 7/7] fix --- scripts/ci/get_e2e_jobs.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ci/get_e2e_jobs.sh b/scripts/ci/get_e2e_jobs.sh index 569982f6e62..7f18611db9a 100755 --- a/scripts/ci/get_e2e_jobs.sh +++ b/scripts/ci/get_e2e_jobs.sh @@ -29,8 +29,8 @@ allow_list=( IFS=',' read -r -a input_labels <<< "$LABELS" allow_list+=("${input_labels[@]}") -# Generate full list of targets, excluding specific entries -full_list=$(earthly ls ./yarn-project/end-to-end | grep -v '+base' | grep -v '+bench' | grep -v "+network" | grep -v 'devnet' | sed 's/+//') +# Generate full list of targets, excluding specific entries, on one line +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) # If branch is master or allow_list contains 'e2e-all', return full list if [[ "$BRANCH" == "master" ]] || [[ " ${allow_list[@]} " =~ "e2e-all" ]]; then