Skip to content

Commit 5dde11a

Browse files
authored
[ci] Enabling test labels for workflow dispatch (#1805)
## Motivation When working with MIOpen team to trigger specific tests, I noticed that the `test_labels` functionality for workflow dispatch was not working ## Technical Details with this change, developers can specify which full tests to run instead of having to wait on specific tests ## Test Plan Verifying with Github Actions ## Test Result Works here: https://github.com/ROCm/TheRock/actions/runs/18545752517/job/52863296833 ## Submission Checklist - [x] Look over the contributing guidelines at https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.
1 parent d85e76d commit 5dde11a

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

.github/workflows/setup.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ jobs:
5858
id: configure
5959
env:
6060
INPUT_LINUX_AMDGPU_FAMILIES: ${{ github.event.inputs.linux_amdgpu_families }}
61+
LINUX_TEST_LABELS: ${{ github.event.inputs.linux_test_labels }}
6162
LINUX_USE_PREBUILT_ARTIFACTS: ${{ github.event.inputs.linux_use_prebuilt_artifacts }}
6263
INPUT_WINDOWS_AMDGPU_FAMILIES: ${{ github.event.inputs.windows_amdgpu_families }}
64+
WINDOWS_TEST_LABELS: ${{ github.event.inputs.windows_test_labels }}
6365
WINDOWS_USE_PREBUILT_ARTIFACTS: ${{ github.event.inputs.windows_use_prebuilt_artifacts }}
6466
run: ./build_tools/github_actions/configure_ci.py

build_tools/github_actions/configure_ci.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
* GITHUB_OUTPUT : path to write workflow output variables.
1212
* GITHUB_STEP_SUMMARY : path to write workflow summary output.
1313
* INPUT_LINUX_AMDGPU_FAMILIES (optional): Comma-separated string of Linux AMD GPU families
14+
* LINUX_TEST_LABELS (optional): Comma-separated list of test labels to test
1415
* LINUX_USE_PREBUILT_ARTIFACTS (optional): If enabled, CI will only run Linux tests
1516
* INPUT_WINDOWS_AMDGPU_FAMILIES (optional): Comma-separated string of Windows AMD GPU families
17+
* WINDOWS_TEST_LABELS (optional): Comma-separated list of test labels to test
1618
* WINDOWS_USE_PREBUILT_ARTIFACTS (optional): If enabled, CI will only run Windows tests
1719
* BRANCH_NAME (optional): The branch name
1820
@@ -280,6 +282,25 @@ def matrix_generator(
280282
filter_known_names(requested_target_names, "target")
281283
)
282284

285+
# If any workflow dispatch test labels are specified, we run full tests for those specific tests
286+
workflow_dispatch_test_labels_str = (
287+
base_args.get("workflow_dispatch_linux_test_labels", "")
288+
if platform == "linux"
289+
else base_args.get("workflow_dispatch_windows_test_labels", "")
290+
)
291+
# (ex: "test:rocprim, test:hipcub" -> ["test:rocprim", "test:hipcub"])
292+
workflow_dispatch_test_labels = [
293+
test_label.strip()
294+
for test_label in workflow_dispatch_test_labels_str.split(",")
295+
]
296+
297+
requested_test_names = []
298+
for label in workflow_dispatch_test_labels:
299+
if "test:" in label:
300+
_, test_name = label.split(":")
301+
requested_test_names.append(test_name)
302+
selected_test_names.extend(filter_known_names(requested_test_names, "test"))
303+
283304
if is_pull_request:
284305
print(f"[PULL_REQUEST] Generating build matrix with {str(base_args)}")
285306

@@ -458,5 +479,11 @@ def main(base_args, linux_families, windows_families):
458479
base_args["windows_use_prebuilt_artifacts"] = (
459480
os.environ.get("WINDOWS_USE_PREBUILT_ARTIFACTS") == "true"
460481
)
482+
base_args["workflow_dispatch_linux_test_labels"] = os.getenv(
483+
"LINUX_TEST_LABELS", ""
484+
)
485+
base_args["workflow_dispatch_windows_test_labels"] = os.getenv(
486+
"WINDOWS_TEST_LABELS", ""
487+
)
461488

462489
main(base_args, linux_families, windows_families)

build_tools/github_actions/tests/configure_ci_test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@ def test_valid_linux_workflow_dispatch_matrix_generator(self):
8989
is_workflow_dispatch=True,
9090
is_push=False,
9191
is_schedule=False,
92-
base_args={},
92+
base_args={
93+
"workflow_dispatch_linux_test_labels": "",
94+
"workflow_dispatch_windows_test_labels": "",
95+
},
9396
families=build_families,
9497
platform="linux",
9598
)

0 commit comments

Comments
 (0)