7272 execute-modinput_functional : ${{ steps.delay-destroy-setup.outputs.execute-modinput_functional }}
7373 execute-scripted_inputs : ${{ steps.delay-destroy-setup.outputs.execute-scripted_inputs }}
7474 execute-requirement_test : ${{ steps.delay-destroy-setup.outputs.execute-requirement_test }}
75+ execute-labeled-knowledge : ${{ steps.configure-tests-on-labels.outputs.execute-labeled-knowledge }}
76+ execute-labeled-ui : ${{ steps.configure-tests-on-labels.outputs.execute-labeled-ui }}
77+ execute-labeled-escu : ${{ steps.configure-tests-on-labels.outputs.execute-labeled-escu }}
78+ execute-labeled-modinput : ${{ steps.configure-tests-on-labels.outputs.execute-labeled-modinput_functional }}
79+ execute-labeled-scripted_inputs : ${{ steps.configure-tests-on-labels.outputs.execute-labeled-scripted_inputs }}
80+ execute-labeled-requirement : ${{ steps.configure-tests-on-labels.outputs.execute-labeled-requirement_test }}
7581 steps :
7682 - name : skip workflow if description is empty for labeled pr
7783 id : skip-workflow
@@ -106,7 +112,7 @@ jobs:
106112 TESTSET="${{ steps.skip-workflow.outputs.testset }}"
107113 for test_type in $TESTSET; do
108114 eval DELAY_DESTROY_"$test_type"="No"
109- eval EXECUTE_"$test_type"="Yes "
115+ eval EXECUTE_"$test_type"="No "
110116 done
111117 if [[ '${{ github.event.label.name }}' == 'preserve_infra' ]]; then
112118 echo "$PR_BODY" >> body.txt
@@ -116,9 +122,8 @@ jobs:
116122 fi
117123 for test_type in $TESTSET; do
118124 if [[ $tests =~ $test_type ]]; then
125+ eval EXECUTE_"$test_type"="Yes"
119126 eval DELAY_DESTROY_"$test_type"="Yes"
120- else
121- eval EXECUTE_"$test_type"="No"
122127 fi
123128 done
124129 fi
@@ -138,6 +143,53 @@ jobs:
138143 echo "execute-escu=$EXECUTE_escu"
139144 echo "execute-requirement_test=$EXECUTE_requirement_test"
140145 } >> "$GITHUB_OUTPUT"
146+ - name : configure tests based on labels
147+ id : configure-tests-on-labels
148+ run : |
149+ set +e
150+ declare -A EXECUTE_LABELED
151+ TESTSET=("execute_knowledge" "execute_ui" "execute_modinput_functional" "execute_scripted_inputs" "execute_escu" "execute_requirement_test")
152+ for test_type in "${TESTSET[@]}"; do
153+ EXECUTE_LABELED["$test_type"]="false"
154+ done
155+
156+ case "${{ github.event_name }}" in
157+ "pull_request")
158+ if ${{ github.base_ref == 'main' }} || ${{ contains(github.event.pull_request.labels.*.name, 'execute_all_tests') }}; then
159+ for test_type in "${TESTSET[@]}"; do
160+ EXECUTE_LABELED["$test_type"]="true"
161+ done
162+ else
163+ labels=$(echo '${{ toJSON(github.event.pull_request.labels) }}' | jq -r '.[] | .name')
164+ for test_type in "${TESTSET[@]}"; do
165+ if [[ "$labels" =~ $test_type ]]; then
166+ EXECUTE_LABELED["$test_type"]="true"
167+ fi
168+ done
169+ fi
170+ ;;
171+ "push")
172+ if ${{ github.ref_name == 'main' }} || ${{ github.ref_name == 'develop' }}; then
173+ for test_type in "${TESTSET[@]}"; do
174+ EXECUTE_LABELED["$test_type"]="true"
175+ done
176+ fi
177+ ;;
178+ "schedule")
179+ for test_type in "${TESTSET[@]}"; do
180+ EXECUTE_LABELED["$test_type"]="true"
181+ done
182+ ;;
183+ *)
184+ echo "No tests were labeled for execution!"
185+ ;;
186+ esac
187+
188+ echo "Tests to execute based on labels:"
189+ for test_type in "${TESTSET[@]}"; do
190+ echo "execute-labeled-$test_type=${EXECUTE_LABELED["$test_type"]}" >> "$GITHUB_OUTPUT"
191+ echo "execute-labeled-$test_type: ${EXECUTE_LABELED["$test_type"]}"
192+ done
141193 meta :
142194 runs-on : ubuntu-latest
143195 needs :
@@ -735,7 +787,7 @@ jobs:
735787 } >> "$GITHUB_OUTPUT"
736788
737789 run-knowledge-tests :
738- if : ${{ needs.test-inventory.outputs.knowledge == 'true' && needs.setup-workflow.outputs.execute-ko == 'Yes' }}
790+ if : ${{ needs.test-inventory.outputs.knowledge == 'true' && ( needs.setup-workflow.outputs.execute-ko == 'Yes' || needs.setup-workflow.outputs.execute-labeled-knowledge == 'true') }}
739791 needs :
740792 - build
741793 - test-inventory
@@ -942,7 +994,7 @@ jobs:
942994 ${{ needs.setup.outputs.directory-path }}/diag*
943995
944996 run-requirement-tests :
945- if : ${{ needs.test-inventory.outputs.requirement_test == 'true' && needs.setup-workflow.outputs.execute-requirement_test == 'Yes' }}
997+ if : ${{ needs.test-inventory.outputs.requirement_test == 'true' && ( needs.setup-workflow.outputs.execute-requirement_test == 'Yes' || needs.setup-workflow.outputs.execute-labeled-requirement == 'true') }}
946998 needs :
947999 - build
9481000 - test-inventory
@@ -1128,7 +1180,7 @@ jobs:
11281180 ${{ needs.setup.outputs.directory-path }}/diag*
11291181
11301182 run-ui-tests :
1131- if : ${{ needs.test-inventory.outputs.ui == 'true' && needs.setup-workflow.outputs.execute-ui == 'Yes' }}
1183+ if : ${{ needs.test-inventory.outputs.ui == 'true' && ( needs.setup-workflow.outputs.execute-ui == 'Yes' || needs.setup-workflow.outputs.execute-labeled-ui == 'true') }}
11321184 needs :
11331185 - build
11341186 - test-inventory
@@ -1322,7 +1374,7 @@ jobs:
13221374 ${{ needs.setup.outputs.directory-path }}/diag*
13231375
13241376 run-modinput-tests :
1325- if : ${{ needs.test-inventory.outputs.modinput_functional == 'true' && needs.setup-workflow.outputs.execute-modinput_functional == 'Yes' }}
1377+ if : ${{ needs.test-inventory.outputs.modinput_functional == 'true' && ( needs.setup-workflow.outputs.execute-modinput_functional == 'Yes' || needs.setup-workflow.outputs.execute-labeled-modinput == 'true') }}
13261378 needs :
13271379 - build
13281380 - test-inventory
@@ -1529,7 +1581,7 @@ jobs:
15291581 ${{ needs.setup.outputs.directory-path }}/diag*
15301582
15311583 run-scripted-input-tests-full-matrix :
1532- if : ${{ needs.test-inventory.outputs.scripted_inputs == 'true' && ( github.base_ref == 'main' || github.ref_name == 'main' ) && needs.setup-workflow.outputs.execute-scripted_inputs == 'Yes' }}
1584+ if : ${{ needs.test-inventory.outputs.scripted_inputs == 'true' && ( github.base_ref == 'main' || github.ref_name == 'main' ) && ( needs.setup-workflow.outputs.execute-scripted_inputs == 'Yes' || needs.setup-workflow.outputs.execute-labeled-scripted_inputs == 'true') }}
15331585 needs :
15341586 - build
15351587 - test-inventory
@@ -1730,7 +1782,7 @@ jobs:
17301782 ${{ needs.setup.outputs.directory-path }}/diag*
17311783
17321784 run-scripted-input-tests-canary :
1733- if : ${{ needs.test-inventory.outputs.scripted_inputs == 'true' && ( github.base_ref == 'develop' || github.ref_name == 'develop' ) && needs.setup-workflow.outputs.execute-scripted_inputs == 'Yes' }}
1785+ if : ${{ needs.test-inventory.outputs.scripted_inputs == 'true' && ( github.base_ref == 'develop' || github.ref_name == 'develop' ) && ( needs.setup-workflow.outputs.execute-scripted_inputs == 'Yes' || needs.setup-workflow.outputs.execute-labeled-scripted_inputs == 'true') }}
17341786 needs :
17351787 - build
17361788 - test-inventory
@@ -1930,7 +1982,7 @@ jobs:
19301982 ${{ needs.setup.outputs.directory-path }}/diag*
19311983
19321984 run-escu-tests :
1933- if : ${{ needs.test-inventory.outputs.escu == 'true' && ( github.base_ref == 'main' || github.ref_name == 'main' || github.base_ref == 'develop' || github.ref_name == 'develop' ) && needs.setup-workflow.outputs.execute-escu == 'Yes' }}
1985+ if : ${{ needs.test-inventory.outputs.escu == 'true' && ( github.base_ref == 'main' || github.ref_name == 'main' || github.base_ref == 'develop' || github.ref_name == 'develop' ) && ( needs.setup-workflow.outputs.execute-escu == 'Yes' || needs.setup-workflow.outputs.execute-labeled-escu == 'true') }}
19341986 needs :
19351987 - build
19361988 - test-inventory
0 commit comments