-
Notifications
You must be signed in to change notification settings - Fork 11
227 lines (204 loc) · 8.01 KB
/
Copy pathpack-bundle.yml
File metadata and controls
227 lines (204 loc) · 8.01 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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
name: Pack Offline Bundle
on:
# Automatic: fires after all images are built on a release tag push.
# The job condition below filters to v* tags on the main repo only.
workflow_run:
workflows: ["Build Docker Images"]
types: [completed]
# Manual: for testing or on-demand bundle creation.
workflow_dispatch:
inputs:
gpu_type:
description: 'GPU type (determines target architecture and HSA config)'
required: true
default: 'strix-halo'
type: choice
options:
- strix-halo # gfx1151 — Ryzen AI Max+ 395 / Max 390
- phx # gfx110x — Ryzen AI 300 (Phoenix)
- strix # gfx1150 — Ryzen AI 300 (Strix Point)
- rdna4 # gfx120x — Radeon RX 9000 series
image_tag:
description: 'Image tag prefix (default: current branch/tag name)'
required: false
default: ''
type: string
image_registry:
description: 'Registry prefix for custom images (override for forks or private registries)'
required: false
default: 'ghcr.io/amdresearch'
type: string
permissions:
contents: write
packages: read
jobs:
# ── Automatic release: one job per GPU target, triggered by workflow_run ──
pack-release:
name: "Pack Bundle (${{ matrix.gpu_type }}) — Release"
if: |
github.event_name == 'workflow_run' &&
github.event.workflow_run.conclusion == 'success' &&
startsWith(github.event.workflow_run.head_branch, 'v')
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
gpu_type: [strix-halo, phx, strix, rdna4]
steps:
- name: Free disk space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: false
- name: Check available disk space
run: df -h /
- name: Checkout code at the release tag
uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_sha }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Resolve image tag and registry
id: tag
run: |
RAW="${{ github.event.workflow_run.head_branch }}"
SANITIZED="${RAW//\//-}"
echo "value=${SANITIZED}" >> "$GITHUB_OUTPUT"
echo "Resolved IMAGE_TAG: ${SANITIZED}"
OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
echo "registry=ghcr.io/${OWNER}" >> "$GITHUB_OUTPUT"
- name: Check if bundle already exists in release
id: check
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="${{ steps.tag.outputs.value }}"
GPU="${{ matrix.gpu_type }}"
if gh release view "${TAG}" &>/dev/null; then
# Check if a bundle for this GPU type is already attached
if gh release view "${TAG}" --json assets --jq '.assets[].name' 2>/dev/null \
| grep -q "auplc-bundle.*${GPU}"; then
echo "skip=true" >> "$GITHUB_OUTPUT"
echo "Bundle for ${GPU} already exists in release ${TAG}, skipping."
else
echo "skip=false" >> "$GITHUB_OUTPUT"
fi
else
echo "skip=false" >> "$GITHUB_OUTPUT"
fi
- name: Run pack command
if: steps.check.outputs.skip != 'true'
env:
GPU_TYPE: ${{ matrix.gpu_type }}
IMAGE_REGISTRY: ${{ steps.tag.outputs.registry }}
IMAGE_TAG: ${{ steps.tag.outputs.value }}
run: ./auplc-installer pack
- name: Verify bundle
if: steps.check.outputs.skip != 'true'
run: |
BUNDLE=$(ls auplc-bundle-*.tar.gz)
echo "Bundle: ${BUNDLE}"
echo "Size: $(du -sh "${BUNDLE}" | cut -f1)"
- name: Upload bundle as artifact
if: steps.check.outputs.skip != 'true'
uses: actions/upload-artifact@v4
with:
name: auplc-bundle-${{ matrix.gpu_type }}
path: auplc-bundle-*.tar.gz
retention-days: 30
compression-level: 0 # already compressed
- name: Attach bundle to GitHub Release
if: steps.check.outputs.skip != 'true'
continue-on-error: true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
BUNDLE=$(ls auplc-bundle-*.tar.gz)
TAG="${{ github.event.workflow_run.head_branch }}"
# Upload to the existing release. Releases are created manually with
# proper release notes before tagging; CI only attaches the bundle.
if gh release view "${TAG}" &>/dev/null; then
gh release upload "${TAG}" "${BUNDLE}" --clobber
echo "Bundle uploaded to release ${TAG}"
else
echo "No release found for ${TAG}, skipping upload."
fi
# ── Manual: single GPU target via workflow_dispatch ──
pack-manual:
name: "Pack Bundle (${{ inputs.gpu_type }})"
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- name: Free disk space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: false
- name: Check available disk space
run: df -h /
- name: Checkout code
uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Resolve image tag
id: tag
run: |
# Use explicit input if provided; otherwise derive from branch/tag name.
# Sanitize: Docker tags cannot contain '/' — replace with '-'.
RAW="${{ inputs.image_tag || github.ref_name }}"
echo "value=${RAW//\//-}" >> "$GITHUB_OUTPUT"
echo "Resolved IMAGE_TAG: ${RAW//\//-}"
- name: Run pack command
env:
GPU_TYPE: ${{ inputs.gpu_type }}
IMAGE_REGISTRY: ${{ inputs.image_registry }}
IMAGE_TAG: ${{ steps.tag.outputs.value }}
run: ./auplc-installer pack
- name: Verify bundle
run: |
BUNDLE=$(ls auplc-bundle-*.tar.gz)
echo "Bundle: ${BUNDLE}"
echo "Size: $(du -sh "${BUNDLE}" | cut -f1)"
- name: Upload bundle as artifact
uses: actions/upload-artifact@v4
with:
name: auplc-bundle-${{ inputs.gpu_type }}
path: auplc-bundle-*.tar.gz
retention-days: 7
compression-level: 0 # already compressed