Build portable Linux packages #35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build portable Linux packages | |
on: | |
# Trigger from another workflow (typically to build dev packages and then test them) | |
workflow_call: | |
inputs: | |
build_type: | |
description: The type of build version to produce ("rc", or "dev") | |
type: string | |
default: "dev" | |
package_suffix: | |
type: string | |
# Trigger manually (typically to test the workflow or manually build a release [candidate]) | |
workflow_dispatch: | |
inputs: | |
build_type: | |
description: The type of build version to produce ("rc", or "dev") | |
type: string | |
default: "rc" | |
package_suffix: | |
type: string | |
# Trigger on a schedule to build nightly release candidates. | |
schedule: | |
# Runs at 11:00 AM UTC, which is 3:00 AM PST (UTC-8) | |
- cron: '0 11 * * *' | |
permissions: | |
contents: read | |
jobs: | |
setup_metadata: | |
if: ${{ github.repository_owner == 'ROCm' || github.event_name != 'schedule' }} | |
runs-on: ubuntu-24.04 | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Setup Python | |
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0 | |
with: | |
python-version: 3.12 | |
# Compute version suffix based on inputs (default to 'rc') | |
- name: Compute rc version suffix | |
if: ${{ inputs.build_type == 'rc' || inputs.build_type == '' }} | |
run: | | |
version_suffix="$(printf 'rc%(%Y%m%d)T')" | |
echo "version_suffix=${version_suffix}" >> $GITHUB_ENV | |
- name: Compute dev version suffix | |
if: ${{ inputs.build_type == 'dev' }} | |
run: | | |
version_suffix=".dev0+${{ github.sha }}" | |
echo "version_suffix=${version_suffix}" >> $GITHUB_ENV | |
- name: Compute version | |
id: version | |
run: | | |
base_version=$(jq -r '.["rocm-version"]' version.json) | |
echo "version=${base_version}${version_suffix}" >> $GITHUB_OUTPUT | |
portable_linux_packages: | |
name: ${{ matrix.target_bundle.amdgpu_family }}::Build Portable Linux | |
runs-on: ${{ github.repository_owner == 'ROCm' && 'azure-linux-scale-rocm' || 'ubuntu-24.04' }} | |
permissions: | |
contents: write | |
needs: [setup_metadata] | |
env: | |
TEATIME_LABEL_GH_GROUP: 1 | |
OUTPUT_DIR: ${{ github.workspace }}/output | |
BUILD_IMAGE: ghcr.io/rocm/therock_build_manylinux_x86_64:main | |
DIST_ARCHIVE: "${{ github.workspace }}/output/therock-dist-linux-${{ matrix.target_bundle.amdgpu_family }}${{ inputs.package_suffix }}-${{ needs.setup_metadata.outputs.version }}.tar.gz" | |
strategy: | |
fail-fast: false | |
matrix: | |
target_bundle: | |
- amdgpu_family: "gfx94X-dcgpu" | |
- amdgpu_family: "gfx110X-dgpu" | |
- amdgpu_family: "gfx1151" | |
- amdgpu_family: "gfx1201" | |
steps: | |
- name: "Checking out repository" | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 | |
with: | |
python-version: '3.10' | |
# TODO: We shouldn't be using a cache on actual release branches, but it | |
# really helps for iteration time. | |
- name: Enable cache | |
uses: actions/cache/restore@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 | |
with: | |
path: ${{ env.OUTPUT_DIR }}/caches | |
key: portable-linux-package-matrix-v1-${{ matrix.target_bundle.amdgpu_family }}-${{ github.sha }} | |
restore-keys: | | |
portable-linux-package-matrix-v1-${{ matrix.target_bundle.amdgpu_family }}- | |
- name: Fetch sources | |
run: | | |
# Prefetch docker container in background. | |
docker pull ${{ env.BUILD_IMAGE }} & | |
git config --global user.email "nobody@amd.com" | |
git config --global user.name "Nobody" | |
./build_tools/fetch_sources.py --jobs 10 | |
wait | |
- name: Build Projects | |
run: | | |
./build_tools/linux_portable_build.py \ | |
--image=${{ env.BUILD_IMAGE }} \ | |
--output-dir=${{ env.OUTPUT_DIR }} \ | |
-- \ | |
"-DTHEROCK_AMDGPU_FAMILIES=${{ matrix.target_bundle.amdgpu_family }}" | |
cd ${{ env.OUTPUT_DIR }}/build/dist/rocm | |
echo "Building ${{ env.DIST_ARCHIVE }}" | |
tar cfz "${{ env.DIST_ARCHIVE }}" . | |
- name: Upload Nightly Release | |
if: ${{ inputs.build_type == 'rc' || inputs.build_type == '' }} | |
uses: ncipollo/release-action@440c8c1cb0ed28b9f43e4d1d670870f059653174 # v1.16.0 | |
with: | |
artifacts: "${{ env.DIST_ARCHIVE }}" | |
tag: "nightly-release" | |
name: "nightly-release" | |
body: "Automatic nightly release of TheRock." | |
removeArtifacts: false | |
allowUpdates: true | |
replacesArtifacts: true | |
makeLatest: false | |
- name: Upload Development Release | |
if: ${{ inputs.build_type == 'dev'}} | |
uses: ncipollo/release-action@440c8c1cb0ed28b9f43e4d1d670870f059653174 # v1.16.0 | |
with: | |
artifacts: "${{ env.DIST_ARCHIVE }}" | |
tag: "dev-release" | |
name: "dev-release" | |
body: "Development release of TheRock." | |
removeArtifacts: false | |
allowUpdates: true | |
replacesArtifacts: true | |
makeLatest: false | |
- name: Report | |
if: ${{ !cancelled() }} | |
run: | | |
echo "Full SDK du:" | |
echo "------------" | |
du -h -d 1 ${{ env.OUTPUT_DIR }}/build/dist/rocm | |
- name: Save cache | |
uses: actions/cache/save@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 | |
if: always() | |
with: | |
path: ${{ env.OUTPUT_DIR }}/caches | |
key: portable-linux-package-matrix-v1-${{ matrix.target_bundle.amdgpu_family }}-${{ github.sha }} |