forked from ROCm/rocm-libraries
-
Notifications
You must be signed in to change notification settings - Fork 0
192 lines (178 loc) · 7.74 KB
/
Copy paththerock-multi-arch-ci.yml
File metadata and controls
192 lines (178 loc) · 7.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# Copyright Advanced Micro Devices, Inc.
# SPDX-License-Identifier: MIT
# Multi-Arch CI for rocm-libraries
#
# This workflow replicates TheRock's multi-arch CI pipeline by calling
# TheRock's reusable workflows directly. It provides sharded, multi-stage
# builds with per-architecture testing.
#
# Key differences from therock-ci.yml:
# - Uses TheRock's multi-arch sharded build pipeline (foundation -> compiler-runtime -> math-libs)
# - Supports prebuilt stages to skip certain build stages
# - Better parallelization across GPU architectures
name: TheRock Multi-Arch CI
# TheRock ref: using main until full migration, then switch to pinned SHA (TheRock#3343)
# NOTE: update all `@<ref>` refs and `ref:` inputs together when switching
on:
schedule:
- cron: "0 7 * * *" # Runs nightly at 7 AM UTC
workflow_dispatch:
inputs:
linux_amdgpu_families:
type: string
description: "Insert comma-separated list of Linux GPU families to build and test. ex: gfx94X, gfx120X (empty = skip linux)"
default: ""
linux_test_labels:
type: string
description: "If enabled, reduce test set on Linux to the list of labels prefixed with 'test:'. ex: test:rocprim, test:hipcub"
default: ""
windows_amdgpu_families:
type: string
description: "Insert comma-separated list of Windows GPU families to build and test. ex: gfx94X, gfx120X (empty = skip windows)"
default: ""
windows_test_labels:
type: string
description: "If enabled, reduce test set on Windows to the list of labels prefixed with 'test:' ex: test:rocprim, test:hipcub"
default: ""
prebuilt_stages:
type: string
default: ""
description: "Comma-separated build stages to skip (or 'all' for all stages); artifacts are copied from baseline_run_id instead"
baseline_run_id:
type: string
default: ""
description: "Workflow run ID to copy prebuilt stage artifacts from; required when prebuilt_stages is set"
permissions:
contents: read
concurrency:
# A PR number if a pull request and otherwise the commit hash. This cancels
# queued and in-progress runs for the same PR (presubmit) or commit
# (postsubmit). The workflow name is prepended to avoid conflicts between
# different workflows.
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
cancel-in-progress: true
jobs:
configure:
name: Configure Changed Projects
runs-on: ubuntu-24.04
outputs:
changed_projects: ${{ steps.configure.outputs.changed_projects }}
run_all_tests: ${{ steps.configure.outputs.run_all_tests }}
skip_tests: ${{ steps.configure.outputs.skip_tests }}
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
sparse-checkout: .github
sparse-checkout-cone-mode: true
# pydantic is required by repo_config_model.py (used by config_loader.py)
- name: Install dependencies
run: pip install pydantic
- name: Determine changed projects from git diff
id: configure
run: |
if [ "${{ github.event_name }}" = "schedule" ]; then
# For scheduled runs, run all tests
echo "Event: schedule - running all tests"
echo "run_all_tests=true" >> "$GITHUB_OUTPUT"
echo "skip_tests=false" >> "$GITHUB_OUTPUT"
echo "changed_projects=" >> "$GITHUB_OUTPUT"
elif [ -n "${{ github.event.pull_request.base.sha }}" ]; then
# For PRs, compute the merge-base to match the actual PR diff
BASE_REF=$(git merge-base ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }})
echo "Using merge-base for PR: $BASE_REF"
export BASE_REF
python3 .github/scripts/get_changed_projects.py
else
# For pushes, compare against the previous commit
BASE_REF="HEAD^"
echo "Using HEAD^ for push"
export BASE_REF
python3 .github/scripts/get_changed_projects.py
fi
setup:
needs: configure
uses: ROCm/TheRock/.github/workflows/setup_multi_arch.yml@main
with:
build_variant: "release"
# Limit GPU families for rocm-libraries CI
linux_amdgpu_families: ${{ inputs.linux_amdgpu_families || 'gfx94X,gfx950' }}
windows_amdgpu_families: ${{ inputs.windows_amdgpu_families || 'gfx1151' }}
linux_test_labels: ${{ inputs.linux_test_labels || '' }}
windows_test_labels: ${{ inputs.windows_test_labels || '' }}
prebuilt_stages: ${{ inputs.prebuilt_stages || '' }}
baseline_run_id: ${{ inputs.baseline_run_id || '' }}
repository: ROCm/TheRock
ref: main
external_repo: '{"repository":"${{ github.repository }}","ref":"${{ github.sha }}"}'
linux_build_and_test:
name: Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }}
needs: [configure, setup]
if: >-
${{
needs.setup.outputs.linux_build_config != '' &&
needs.setup.outputs.enable_build_jobs == 'true' &&
needs.configure.outputs.skip_tests != 'true'
}}
uses: ROCm/TheRock/.github/workflows/multi_arch_ci_linux.yml@main
secrets: inherit
with:
build_config: ${{ needs.setup.outputs.linux_build_config }}
test_labels: ${{ needs.setup.outputs.linux_test_labels }}
rocm_package_version: ${{ needs.setup.outputs.rocm_package_version }}
test_type: ${{ needs.setup.outputs.test_type }}
external_repo_config: ${{ needs.setup.outputs.external_repo_config }}
# Empty string when run_all_tests=true triggers full test run in downstream workflow
changed_projects: ${{ needs.configure.outputs.run_all_tests == 'true' && '' || needs.configure.outputs.changed_projects }}
repository: ROCm/TheRock
ref: main
permissions:
contents: read
id-token: write
windows_build_and_test:
name: Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }}
needs: [configure, setup]
if: >-
${{
needs.setup.outputs.windows_build_config != '' &&
needs.setup.outputs.enable_build_jobs == 'true' &&
needs.configure.outputs.skip_tests != 'true'
}}
uses: ROCm/TheRock/.github/workflows/multi_arch_ci_windows.yml@main
secrets: inherit
with:
build_config: ${{ needs.setup.outputs.windows_build_config }}
test_labels: ${{ needs.setup.outputs.windows_test_labels }}
rocm_package_version: ${{ needs.setup.outputs.rocm_package_version }}
test_type: ${{ needs.setup.outputs.test_type }}
external_repo_config: ${{ needs.setup.outputs.external_repo_config }}
# Empty string when run_all_tests=true triggers full test run in downstream workflow
changed_projects: ${{ needs.configure.outputs.run_all_tests == 'true' && '' || needs.configure.outputs.changed_projects }}
repository: ROCm/TheRock
ref: main
permissions:
contents: read
id-token: write
multi_arch_ci_summary:
name: Multi-Arch CI Summary
if: always()
needs:
- setup
- linux_build_and_test
- windows_build_and_test
runs-on: ubuntu-24.04
steps:
- name: Checkout TheRock repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: "ROCm/TheRock"
ref: main
sparse-checkout: build_tools/github_actions
sparse-checkout-cone-mode: true
- name: Evaluate workflow results
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
python build_tools/github_actions/workflow_summary.py \
--needs-json '${{ toJSON(needs) }}'