another attempt

This commit is contained in:
Donato Capitella
2025-08-06 09:52:55 +01:00
parent d6b964a5bc
commit 3f28d3930e
+38 -23
View File
@@ -1,13 +1,11 @@
name: Build & Publish AMD Strix Halo Toolboxes (Params) name: Build & Publish AMD Strix Halo Toolboxes (Params)
# Only manual runs, with a "backends" input
on: on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
backends: backends:
description: > description: >
Comma-separated list of backends to build Comma-separated backends to build (e.g. "rocm-7beta,rocm-7rc").
(e.g. "rocm-7beta,rocm-7rc").
Use "all" to build everything. Use "all" to build everything.
required: false required: false
default: all default: all
@@ -17,20 +15,37 @@ env:
LOCAL_PREFIX: llama LOCAL_PREFIX: llama
jobs: jobs:
# 1) Prepare a clean JSON array for the matrix
prepare:
runs-on: ubuntu-latest
outputs:
matrix_json: ${{ steps.mk.outputs.matrix_json }}
steps:
- id: mk
shell: bash
run: |
# Input from the Run workflow form
IN='${{ inputs.backends }}'
if [[ "$IN" == "all" || -z "$IN" ]]; then
JSON='["rocm-6.4.2","rocm-7beta","rocm-7rc","vulkan-amdvlk","vulkan-radv"]'
else
# Remove spaces and build JSON array from comma list
IN_CLEAN=$(echo "$IN" | tr -d '[:space:]')
JSON='["'${IN_CLEAN//,/\",\"}'"]'
fi
echo "matrix_json=${JSON}" >> "$GITHUB_OUTPUT"
echo "Using matrix: ${JSON}"
# 2) Build each backend in parallel using the prepared matrix
build-and-push: build-and-push:
name: Build & push ${{ matrix.backend }} needs: prepare
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
backend: ${{ fromJson( backend: ${{ fromJson(needs.prepare.outputs.matrix_json) }}
github.event.inputs.backends == 'all'
? '["rocm-6.4.2","rocm-7beta","rocm-7rc","vulkan-amdvlk","vulkan-radv"]'
: format(
'[\"{0}\"]',
replace(github.event.inputs.backends, ',', '\",\"')
)
) }}
steps: steps:
- name: Check out repository - name: Check out repository
@@ -47,23 +62,23 @@ jobs:
- name: Build & push ${{ matrix.backend }} - name: Build & push ${{ matrix.backend }}
working-directory: toolboxes working-directory: toolboxes
shell: bash
run: | run: |
set -euo pipefail set -euo pipefail
B="${{ matrix.backend }}" B="${{ matrix.backend }}"
DF="Dockerfile.$B" DF="Dockerfile.$B"
LI="${LOCAL_PREFIX}-$B" LI="${LOCAL_PREFIX}-$B"
TAG="${B}_${BUILD_TS}" TAG="${B}_${BUILD_TS}"
IMM_REF="${DOCKERHUB_REPO}:${TAG}" IMM="${DOCKERHUB_REPO}:${TAG}"
CH_REF="${DOCKERHUB_REPO}:${B}" CHN="${DOCKERHUB_REPO}:${B}"
echo "→ Building $DF" echo "→ Building ${DF}"
docker build --no-cache -t "$LI" -f "$DF" . docker build --no-cache -t "${LI}" -f "${DF}" .
echo "→ Pushing immutable → $IMM_REF" echo "→ Tag & push immutable → ${IMM}"
docker tag "$LI" "$IMM_REF" docker tag "${LI}" "${IMM}"
docker push "$IMM_REF" docker push "${IMM}"
echo "→ Updating channel → $CH_REF" echo "→ Tag & push channel → ${CHN}"
docker tag "$IMM_REF" "$CH_REF" docker tag "${IMM}" "${CHN}"
docker push "$CH_REF" docker push "${CHN}"