@@ -85,8 +85,13 @@ get_tests() {
8585 gitea_tests=(" ${filtered_tests[@]} " )
8686 fi
8787
88+ local -a ghe_tests=()
89+ if [[ " ${target} " == github_ghe* ]]; then
90+ mapfile -t ghe_tests < <( echo " ${all_tests} " | grep -iP ' GithubGHE' 2> /dev/null | grep -ivP ' Concurrency' 2> /dev/null | sort 2> /dev/null)
91+ fi
92+
8893 local -a github_tests=()
89- if [[ " ${target} " == * " github" * ]] && [[ " ${target} " != " github_ghe" ]] && [[ " ${target} " != " github_second_controller" ]]; then
94+ if [[ " ${target} " == * " github" * ]] && [[ " ${target} " != github_ghe* ]] && [[ " ${target} " != " github_second_controller" ]]; then
9095 mapfile -t github_tests < <( echo " ${all_tests} " | grep -iP ' ^TestGithub' 2> /dev/null | grep -ivP ' Concurrency|GithubGHE' 2> /dev/null | sort 2> /dev/null)
9196 fi
9297
@@ -97,6 +102,13 @@ get_tests() {
97102 remainder=$(( ${# gitea_tests[@]} % 3 ))
98103 fi
99104
105+ # Calculate chunk sizes for splitting GHE tests into 3 parts
106+ local ghe_chunk_size ghe_remainder
107+ if [[ ${# ghe_tests[@]} -gt 0 ]]; then
108+ ghe_chunk_size=$(( ${# ghe_tests[@]} / 3 ))
109+ ghe_remainder=$(( ${# ghe_tests[@]} % 3 ))
110+ fi
111+
100112 # TODO: revert once the new workflow matrix lands on main.
101113 # Backward compat: github_1/github_2 chunking for pull_request_target
102114 # which runs the workflow YAML from main (old target names).
@@ -135,11 +147,28 @@ get_tests() {
135147 printf ' %s\n' " ${github_tests[@]: $((github_chunk_size + github_remainder))} "
136148 fi
137149 ;;
138- github_second_controller)
150+ # TODO: revert - remove github_second_controller, github_ghe aliases
151+ # once the new workflow matrix lands on main. These exist because
152+ # pull_request_target runs the workflow YAML from main which still sends old
153+ # target names.
154+ github_second_controller | github_ghe)
139155 printf ' %s\n' " ${all_tests} " | grep -iP ' GithubGHE' | grep -ivP ' Concurrency'
140156 ;;
141- github_ghe)
142- printf ' %s\n' " ${all_tests} " | grep -iP ' GithubGHE' | grep -ivP ' Concurrency'
157+ github_ghe_1)
158+ if [[ ${# ghe_tests[@]} -gt 0 ]]; then
159+ printf ' %s\n' " ${ghe_tests[@]: 0: ${ghe_chunk_size} } "
160+ fi
161+ ;;
162+ github_ghe_2)
163+ if [[ ${# ghe_tests[@]} -gt 0 ]]; then
164+ printf ' %s\n' " ${ghe_tests[@]: ${ghe_chunk_size} : ${ghe_chunk_size} } "
165+ fi
166+ ;;
167+ github_ghe_3)
168+ if [[ ${# ghe_tests[@]} -gt 0 ]]; then
169+ local start_idx=$(( ghe_chunk_size * 2 ))
170+ printf ' %s\n' " ${ghe_tests[@]: ${start_idx} : $((ghe_chunk_size + ghe_remainder))} "
171+ fi
143172 ;;
144173 gitlab_bitbucket)
145174 printf ' %s\n' " ${all_tests} " | grep -iP ' Gitlab|Bitbucket' | grep -ivP ' Concurrency'
@@ -162,8 +191,8 @@ get_tests() {
162191 ;;
163192 * )
164193 echo " Invalid target: ${target} "
165- echo " supported targets: github_public, github_ghe , gitlab_bitbucket, gitea_1, gitea_2, gitea_3, concurrency, flaky"
166- echo " backward compat aliases: github_1, github_2, github_second_controller"
194+ echo " supported targets: github_public, github_ghe_1, github_ghe_2, github_ghe_3 , gitlab_bitbucket, gitea_1, gitea_2, gitea_3, concurrency, flaky"
195+ echo " backward compat aliases: github_1, github_2, github_second_controller, github_ghe "
167196 ;;
168197 esac
169198}
@@ -308,7 +337,7 @@ output_logs)
308337 ;;
309338print_tests)
310339 set +x
311- for target in github_public github_ghe gitlab_bitbucket gitea_1 gitea_2 gitea_3 concurrency flaky; do
340+ for target in github_public github_ghe_1 github_ghe_2 github_ghe_3 gitlab_bitbucket gitea_1 gitea_2 gitea_3 concurrency flaky; do
312341 mapfile -t tests < <( get_tests " ${target} " )
313342 echo " Tests for target: ${target} Total: ${# tests[@]} "
314343 printf ' %s\n' " ${tests[@]} "
0 commit comments