# Copyright Advanced Micro Devices, Inc. # SPDX-License-Identifier: MIT name: Test Artifacts on: workflow_dispatch: inputs: artifact_group: type: string artifact_run_id: type: string default: "" amdgpu_families: type: string amdgpu_targets: type: string default: "" test_runs_on: type: string benchmark_runs_on: type: string default: "" sanity_check_only_for_family: type: boolean default: false test_type: type: string test_labels: type: string run_extended_tests: type: string default: 'false' windows_hip_rocr_tests: type: string default: 'false' changed_projects: description: 'Comma-separated list of projects to test (e.g., "rocblas,hipblas" or "projects/rocblas"). Empty = run all tests.' type: string default: "" release_type: description: 'Release type: "ci" or "dev".' type: choice options: - ci - dev default: ci repository: description: "Repository to checkout. Defaults to github.repository." type: string ref: description: "Branch, tag, or SHA to checkout. Defaults to the triggering ref." type: string build_variant: description: "Build variant (e.g., release, asan)." type: choice options: - release - asan default: release workflow_call: inputs: artifact_group: type: string artifact_run_id: type: string default: "" amdgpu_families: type: string amdgpu_targets: type: string default: "" test_runs_on: type: string benchmark_runs_on: type: string default: "" sanity_check_only_for_family: type: boolean default: false test_type: type: string test_labels: type: string run_extended_tests: type: string default: 'false' windows_hip_rocr_tests: type: string default: 'false' changed_projects: description: 'Comma-separated list of projects to test (e.g., "rocblas,hipblas" or "projects/rocblas"). Empty = run all tests.' type: string default: "" release_type: type: string default: ci repository: description: "Repository to checkout. Defaults to github.repository." type: string ref: description: "Branch, tag, or SHA to checkout. Defaults to the triggering ref." type: string build_variant: description: "Build variant (e.g., release, asan)." type: string default: "release" push: branches: - ADHOCBUILD permissions: contents: read run-name: Test Artifacts (${{ inputs.amdgpu_families }}, ${{ inputs.release_type }}, ${{ inputs.test_type }}, ${{ inputs.build_variant }}, ${{ inputs.test_runs_on }}) jobs: configure_test_matrix: name: "Configure test matrix (${{ inputs.amdgpu_families }})" # if there is a test machine available if: ${{ inputs.test_runs_on != '' }} runs-on: ubuntu-24.04 outputs: sanity_component: ${{ steps.configure.outputs.sanity_component }} components: ${{ steps.configure.outputs.components }} platform: ${{ steps.configure.outputs.platform }} shard_arr: ${{ steps.configure.outputs.shard_arr }} steps: - name: Checking out repository uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: repository: ${{ inputs.repository || github.repository }} ref: ${{ inputs.ref }} - name: Checkout CI config uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: repository: ROCm/therock-ci-config ref: main path: ci-config continue-on-error: true - name: Setting up Python uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: python-version: 3.12 - name: "Determine test dependencies" id: test_deps shell: bash env: CHANGED_PROJECTS: ${{ inputs.changed_projects }} run: | python ./test_tools/determine_rocm_test_dependencies.py \ --changed-projects "$CHANGED_PROJECTS" \ --gha-output - name: "Configuring CI options" id: configure env: ARTIFACT_GROUP: ${{ inputs.artifact_group }} AMDGPU_FAMILIES: ${{ inputs.amdgpu_families }} TEST_TYPE: ${{ inputs.test_type }} TEST_LABELS: ${{ inputs.test_labels }} RUN_EXTENDED_TESTS: ${{ inputs.run_extended_tests }} WINDOWS_HIP_ROCR_TESTS: ${{ inputs.windows_hip_rocr_tests }} PROJECTS_TO_TEST: ${{ steps.test_deps.outputs.projects_to_test }} CI_CONFIG_PATH: ci-config BUILD_VARIANT: ${{ inputs.build_variant }} run: | python ./build_tools/github_actions/fetch_test_configurations.py \ --platform=${{ contains(inputs.test_runs_on, 'windows') && 'windows' || 'linux' }} test_sanity_check: name: 'Test Sanity Check' needs: configure_test_matrix uses: './.github/workflows/test_component.yml' with: artifact_run_id: ${{ inputs.artifact_run_id }} artifact_group: ${{ inputs.artifact_group }} amdgpu_families: ${{ inputs.amdgpu_families }} amdgpu_targets: ${{ inputs.amdgpu_targets }} # For workflow_dispatch, honor the explicit test_runs_on input if provided. # Otherwise, use the runner selected by fetch_test_configurations.py. test_runs_on: ${{ (github.event_name == 'workflow_dispatch' && inputs.test_runs_on) || fromJSON(needs.configure_test_matrix.outputs.sanity_component).test_runner }} platform: ${{ needs.configure_test_matrix.outputs.platform }} component: ${{ needs.configure_test_matrix.outputs.sanity_component }} release_type: ${{ inputs.release_type }} repository: ${{ inputs.repository }} ref: ${{ inputs.ref }} build_variant: ${{ inputs.build_variant }} test_components: name: 'Test ${{ matrix.components.job_name }}' needs: [test_sanity_check, configure_test_matrix] # Run when: # - sanity check passed # - there are components to test # - sanity_check_only_for_family is not set if: >- ${{ !failure() && !cancelled() && needs.configure_test_matrix.outputs.components != '' && needs.configure_test_matrix.outputs.components != '[]' && !inputs.sanity_check_only_for_family }} strategy: fail-fast: false matrix: components: ${{ fromJSON(needs.configure_test_matrix.outputs.components || '[]') }} uses: './.github/workflows/test_component.yml' secrets: inherit with: artifact_run_id: ${{ inputs.artifact_run_id }} artifact_group: ${{ inputs.artifact_group }} amdgpu_families: ${{ inputs.amdgpu_families }} amdgpu_targets: ${{ inputs.amdgpu_targets }} # Route to the appropriate runner: # 0. For workflow_dispatch, honor the explicit test_runs_on input if provided # 1. Benchmark components use the dedicated benchmark runner # 2. Multi-GPU components use the multi-GPU runner # 3. CPU-only components use standard GitHub runners (azure-linux-scale-rocm) # 4. Per-component runner (set by fetch_test_configurations.py) test_runs_on: >- ${{ (github.event_name == 'workflow_dispatch' && inputs.test_runs_on != '' && inputs.test_runs_on) || (matrix.components.is_benchmark == true && inputs.benchmark_runs_on != '' && inputs.benchmark_runs_on) || (matrix.components.multi_gpu_runner != '' && matrix.components.multi_gpu_runner) || (matrix.components.linux_cpu_runner == true && 'azure-linux-scale-rocm') || matrix.components.test_runner }} platform: ${{ needs.configure_test_matrix.outputs.platform }} component: ${{ toJSON(matrix.components) }} release_type: ${{ inputs.release_type }} repository: ${{ inputs.repository }} ref: ${{ inputs.ref }} build_variant: ${{ inputs.build_variant }}