Release portable Linux packages (gfx94X-dcgpu, dev) #973
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: Release portable Linux packages | |
| on: | |
| # Trigger from another workflow (typically to build dev packages and then test them) | |
| workflow_call: | |
| inputs: | |
| release_type: | |
| description: The type of release to build ("dev", "nightly", or "prerelease"). All developer-triggered jobs should use "dev"! | |
| type: string | |
| default: "dev" | |
| package_suffix: | |
| type: string | |
| s3_subdir: | |
| description: "Subdirectory to push the packages" | |
| type: string | |
| default: "v2" | |
| s3_staging_subdir: | |
| description: "Staging subdirectory to push the packages" | |
| type: string | |
| default: "v2-staging" | |
| families: | |
| description: "Comma separated list of AMD GPU families, e.g. `gfx94X,gfx103x`" | |
| type: string | |
| prerelease_version: | |
| description: "(Optional) Number of the prerelease" | |
| type: string | |
| repository: | |
| description: "Repository to checkout. Otherwise, defaults to `github.repository`." | |
| type: string | |
| ref: | |
| description: "Branch, tag or SHA to checkout. Defaults to the reference or SHA that triggered the workflow." | |
| type: string | |
| # Trigger manually (typically to test the workflow or manually build a release [candidate]) | |
| workflow_dispatch: | |
| inputs: | |
| release_type: | |
| description: The type of release to build ("dev", "nightly", or "prerelease"). All developer-triggered jobs should use "dev"! | |
| type: string | |
| default: "dev" | |
| package_suffix: | |
| type: string | |
| s3_subdir: | |
| description: "Subdirectory to push the packages" | |
| type: string | |
| default: "v2" | |
| s3_staging_subdir: | |
| description: "Staging subdirectory to push the packages" | |
| type: string | |
| default: "v2-staging" | |
| families: | |
| description: "Comma separated list of AMD GPU families, e.g. `gfx94X,gfx103x`" | |
| type: string | |
| prerelease_version: | |
| description: "(Optional) Number of the prerelease" | |
| type: string | |
| # Trigger on a schedule to build nightly release candidates. | |
| schedule: | |
| # Runs at 04:00 AM UTC, which is 8:00 PM PST (UTC-8) | |
| - cron: '0 04 * * *' | |
| permissions: | |
| contents: read | |
| run-name: Release portable Linux packages (${{ inputs.families || 'default' }}, ${{ inputs.release_type || 'nightly' }}) | |
| jobs: | |
| setup_metadata: | |
| if: ${{ github.repository_owner == 'ROCm' || github.event_name != 'schedule' }} | |
| runs-on: ubuntu-24.04 | |
| env: | |
| release_type: ${{ inputs.release_type || 'nightly' }} | |
| outputs: | |
| version: ${{ steps.rocm_package_version.outputs.rocm_package_version }} | |
| rpm_version: ${{ steps.rocm_native_package_version.outputs.rocm_rpm_package_version }} | |
| deb_version: ${{ steps.rocm_native_package_version.outputs.rocm_deb_package_version }} | |
| release_type: ${{ env.release_type }} | |
| package_targets: ${{ steps.configure.outputs.package_targets }} | |
| cloudfront_url: ${{ steps.release_information.outputs.cloudfront_url }} | |
| cloudfront_staging_url: ${{ steps.release_information.outputs.cloudfront_staging_url }} | |
| cloudfront_base_url: ${{ steps.release_information.outputs.cloudfront_base_url }} | |
| s3_subdir_tar: ${{ steps.release_information.outputs.s3_subdir_tar }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| repository: ${{ inputs.repository || github.repository }} | |
| ref: ${{ inputs.ref || '' }} | |
| - name: Setup Python | |
| uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | |
| with: | |
| python-version: 3.12 | |
| - name: Compute package version | |
| id: rocm_package_version | |
| run: | | |
| python ./build_tools/compute_rocm_package_version.py \ | |
| --release-type=${{ env.release_type }} \ | |
| --prerelease-version=${{ inputs.prerelease_version }} | |
| - name: Compute native package version | |
| id: rocm_native_package_version | |
| run: | | |
| # Compute rpm package version | |
| # This sets the 'rocm_rpm_package_version' output | |
| python ./build_tools/compute_rocm_package_version.py \ | |
| --release-type=${{ env.release_type }} \ | |
| --prerelease-version=${{ inputs.prerelease_version }} \ | |
| --package-type="rpm" | |
| # Compute debian package version | |
| # This sets the 'rocm_deb_package_version' output | |
| python ./build_tools/compute_rocm_package_version.py \ | |
| --release-type=${{ env.release_type }} \ | |
| --prerelease-version=${{ inputs.prerelease_version }} \ | |
| --package-type="deb" | |
| - name: Set variables for nightly release | |
| if: ${{ env.release_type == 'nightly' }} | |
| run: | | |
| echo "tmp_cloudfront_url=https://rocm.nightlies.amd.com/v2" >> $GITHUB_ENV | |
| echo "tmp_cloudfront_staging_url=https://rocm.nightlies.amd.com/v2-staging" >> $GITHUB_ENV | |
| echo "tmp_s3_subdir_tar=''" >> $GITHUB_ENV | |
| - name: Set variables for prerelease | |
| if: ${{ env.release_type == 'prerelease' }} | |
| run: | | |
| echo "tmp_cloudfront_url=https://rocm.prereleases.amd.com/whl" >> $GITHUB_ENV | |
| echo "tmp_cloudfront_staging_url=https://rocm.prereleases.amd.com/whl-staging" >> $GITHUB_ENV | |
| echo "tmp_s3_subdir_tar=v3/tarball/" >> $GITHUB_ENV | |
| - name: Set variables for development release | |
| if: ${{ env.release_type == 'dev' }} | |
| run: | | |
| echo "tmp_cloudfront_url=https://rocm.devreleases.amd.com/v2" >> $GITHUB_ENV | |
| echo "tmp_cloudfront_staging_url=https://rocm.devreleases.amd.com/v2-staging" >> $GITHUB_ENV | |
| echo "tmp_s3_subdir_tar=''" >> $GITHUB_ENV | |
| - name: Generate release information | |
| id: release_information | |
| run: | | |
| echo "cloudfront_url=${tmp_cloudfront_url}" >> $GITHUB_OUTPUT | |
| echo "cloudfront_staging_url=${tmp_cloudfront_staging_url}" >> $GITHUB_OUTPUT | |
| echo "s3_subdir_tar=${tmp_s3_subdir_tar}" >> $GITHUB_OUTPUT | |
| # TODO: Refactor to use the base URL as CloudFront URL once bucket paths (v2 vs. whl) are harmonized. | |
| # Uses bash parameter expansion to strip off subdirectories. | |
| echo "cloudfront_base_url=${tmp_cloudfront_url%/*}" >> $GITHUB_OUTPUT | |
| - name: Generating package target matrix | |
| id: configure | |
| env: | |
| AMDGPU_FAMILIES: ${{ inputs.families }} | |
| THEROCK_PACKAGE_PLATFORM: "linux" | |
| run: python ./build_tools/github_actions/fetch_package_targets.py | |
| 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' }} | |
| container: | |
| image: ghcr.io/rocm/therock_build_manylinux_x86_64@sha256:d6ae5712a9c7e8b88281d021e907b312cd8a26295b95690baef3e8dde4805858 | |
| options: -v /runner/config:/home/awsconfig/ | |
| continue-on-error: ${{ matrix.target_bundle.expect_failure == true }} # for GPU families that are flaky, we mark as xfail | |
| timeout-minutes: 720 # 12 hour timeout | |
| needs: [setup_metadata] | |
| permissions: | |
| contents: write | |
| actions: write # Added permission to trigger workflows | |
| id-token: write # Added permission for AWS S3 upload | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| target_bundle: ${{ fromJSON(needs.setup_metadata.outputs.package_targets) }} | |
| env: | |
| TEATIME_LABEL_GH_GROUP: 1 | |
| OUTPUT_DIR: ${{ github.workspace }}/output | |
| DIST_ARCHIVE: "${{ github.workspace }}/output/therock-dist-linux-${{ matrix.target_bundle.amdgpu_family }}${{ inputs.package_suffix }}-${{ needs.setup_metadata.outputs.version }}.tar.gz" | |
| FILE_NAME: "therock-dist-linux-${{ matrix.target_bundle.amdgpu_family }}${{ inputs.package_suffix }}-${{ needs.setup_metadata.outputs.version }}.tar.gz" | |
| RELEASE_TYPE: "${{ needs.setup_metadata.outputs.release_type }}" | |
| AWS_SHARED_CREDENTIALS_FILE: /home/awsconfig/credentials.ini | |
| S3_BUCKET_TAR: "therock-${{ needs.setup_metadata.outputs.release_type }}-tarball" | |
| S3_SUBDIR_TAR: ${{ needs.setup_metadata.outputs.s3_subdir_tar }} | |
| S3_BUCKET_PY: "therock-${{ needs.setup_metadata.outputs.release_type }}-python" | |
| S3_SUBDIR: ${{ inputs.s3_subdir || 'v2' }} | |
| S3_STAGING_SUBDIR: ${{ inputs.s3_staging_subdir || 'v2-staging' }} | |
| BUILD_DIR: ${{ github.workspace }}/output/build | |
| EXTRA_C_COMPILER_LAUNCHER: "${{ github.workspace }}/build_tools/resource_info.py" | |
| EXTRA_CXX_COMPILER_LAUNCHER: "${{ github.workspace }}/build_tools/resource_info.py" | |
| THEROCK_BUILD_PROF_LOG_DIR: ${{ github.workspace }}/output/build/logs/therock-build-prof | |
| CCACHE_DIR: ${{ github.workspace }}/output/caches/ccache | |
| PIP_CACHE_DIR: ${{ github.workspace }}/output/caches/pip | |
| steps: | |
| - name: "Checking out repository" | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| repository: ${{ inputs.repository || github.repository }} | |
| ref: ${{ inputs.ref || '' }} | |
| - name: Install Python requirements | |
| run: pip install -r requirements.txt | |
| - name: Adjust git config | |
| run: | | |
| git config --global --add safe.directory $PWD | |
| git config fetch.parallel 10 | |
| - name: Runner health status | |
| run: | | |
| ./build_tools/health_status.py | |
| # 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@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 | |
| 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: Install the AWS tool | |
| run: ./dockerfiles/install_awscli.sh | |
| - name: Fetch sources | |
| timeout-minutes: 30 | |
| run: | | |
| ./build_tools/fetch_sources.py --jobs 10 | |
| - name: Configure Projects | |
| env: | |
| amdgpu_families: ${{ matrix.target_bundle.amdgpu_family }} | |
| package_version: ${{ needs.setup_metadata.outputs.version }} | |
| extra_cmake_options: '' | |
| cmake_preset: '' | |
| run: | | |
| python3 ./build_tools/github_actions/build_configure.py \ | |
| --build-dir ${{ env.BUILD_DIR }} \ | |
| --manylinux | |
| - name: Build Projects | |
| run: | | |
| cmake --build ${{ env.OUTPUT_DIR }}/build --target therock-archives therock-dist | |
| cd ${{ env.OUTPUT_DIR }}/build/dist/rocm | |
| echo "Building ${{ env.DIST_ARCHIVE }}" | |
| tar cfz "${{ env.DIST_ARCHIVE }}" . | |
| - name: Build Python Packages | |
| run: | | |
| python ./build_tools/build_python_packages.py \ | |
| --artifact-dir=${{ env.OUTPUT_DIR }}/build/artifacts \ | |
| --dest-dir=${{ env.OUTPUT_DIR }}/packages \ | |
| "--version=${{ needs.setup_metadata.outputs.version }}" | |
| - name: Build Report | |
| if: ${{ !cancelled() }} | |
| run: | | |
| echo "Full SDK du:" | |
| echo "------------" | |
| du -h -d 1 ${{ env.OUTPUT_DIR }}/build/dist/rocm | |
| # Analyze ninja build log to generate per-component timing report | |
| - name: Analyze Build Times | |
| if: ${{ !cancelled() }} | |
| env: | |
| THEROCK_BUILD_PROF_LOG_DIR: ${{ env.OUTPUT_DIR }}/build/logs/therock-build-prof | |
| run: | | |
| python3 build_tools/resource_info.py --finalize | |
| python3 build_tools/analyze_build_times.py --build-dir ${{ env.OUTPUT_DIR }}/build | |
| - name: Configure AWS Credentials | |
| if: ${{ github.repository_owner == 'ROCm' && !cancelled() }} | |
| uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7 # v6.0.0 | |
| with: | |
| aws-region: us-east-2 | |
| role-to-assume: arn:aws:iam::692859939525:role/therock-${{ env.RELEASE_TYPE }} | |
| - name: Post Build Upload | |
| if: ${{ github.repository_owner == 'ROCm' && !cancelled() }} | |
| run: | | |
| python3 build_tools/github_actions/post_build_upload.py \ | |
| --run-id ${{ github.run_id }} \ | |
| --artifact-group "${{ matrix.target_bundle.amdgpu_family }}" \ | |
| --build-dir ${{ env.OUTPUT_DIR }}/build \ | |
| --upload \ | |
| --job-status ${{ job.status }} | |
| - name: Upload Releases to staging S3 | |
| if: ${{ github.repository_owner == 'ROCm' }} | |
| run: | | |
| aws s3 cp ${{ env.OUTPUT_DIR }}/packages/dist/ s3://${{ env.S3_BUCKET_PY }}/${{ env.S3_STAGING_SUBDIR }}/${{ matrix.target_bundle.amdgpu_family }}/ \ | |
| --recursive --no-follow-symlinks \ | |
| --exclude "*" \ | |
| --include "*.whl" \ | |
| --include "*.tar.gz" | |
| - name: (Re-)Generate Python package release index for staging | |
| if: ${{ github.repository_owner == 'ROCm' }} | |
| env: | |
| # Environment variable to be set for `manage.py` | |
| CUSTOM_PREFIX: "${{ env.S3_STAGING_SUBDIR }}/${{ matrix.target_bundle.amdgpu_family }}" | |
| run: | | |
| pip install boto3 packaging | |
| python ./build_tools/third_party/s3_management/manage.py ${{ env.CUSTOM_PREFIX }} | |
| ## TODO: Restrict uploading to the non-staging S3 directory until ROCm sanity checks and all validation tests have successfully passed. | |
| - name: Upload Releases to S3 | |
| if: ${{ github.repository_owner == 'ROCm' }} | |
| run: | | |
| aws s3 cp ${{ env.DIST_ARCHIVE }} s3://${{ env.S3_BUCKET_TAR }}/${{ env.S3_SUBDIR_TAR }} | |
| aws s3 cp ${{ env.OUTPUT_DIR }}/packages/dist/ s3://${{ env.S3_BUCKET_PY }}/${{ env.S3_SUBDIR }}/${{ matrix.target_bundle.amdgpu_family }}/ \ | |
| --recursive --no-follow-symlinks \ | |
| --exclude "*" \ | |
| --include "*.whl" \ | |
| --include "*.tar.gz" | |
| - name: (Re-)Generate release index pages | |
| if: ${{ github.repository_owner == 'ROCm' }} | |
| env: | |
| # Environment variable to be set for `manage.py` | |
| CUSTOM_PREFIX: "${{ env.S3_SUBDIR }}/${{ matrix.target_bundle.amdgpu_family }}" | |
| run: | | |
| pip install boto3 packaging | |
| python ./build_tools/third_party/s3_management/manage.py ${{ env.CUSTOM_PREFIX }} | |
| python ./build_tools/index_generation_s3_tar.py \ | |
| --bucket ${{ env.S3_BUCKET_TAR }} \ | |
| --directory ${{ env.S3_SUBDIR_TAR }} \ | |
| --upload | |
| - name: Trigger building PyTorch wheels | |
| if: ${{ github.repository_owner == 'ROCm' && matrix.target_bundle.expect_pytorch_failure == false }} | |
| uses: benc-uk/workflow-dispatch@e2e5e9a103e331dad343f381a29e654aea3cf8fc # v1.2.4 | |
| with: | |
| workflow: release_portable_linux_pytorch_wheels.yml | |
| inputs: | | |
| { "amdgpu_family": "${{ matrix.target_bundle.amdgpu_family }}", | |
| "release_type": "${{ env.RELEASE_TYPE }}", | |
| "s3_subdir": "${{ env.S3_SUBDIR }}", | |
| "s3_staging_subdir": "${{ env.S3_STAGING_SUBDIR }}", | |
| "cloudfront_url": "${{ needs.setup_metadata.outputs.cloudfront_url }}", | |
| "cloudfront_staging_url": "${{ needs.setup_metadata.outputs.cloudfront_staging_url }}", | |
| "rocm_version": "${{ needs.setup_metadata.outputs.version }}", | |
| "ref": "${{ inputs.ref || '' }}" | |
| } | |
| - name: URL-encode .tar URL | |
| # TODO: Enable JAX wheels for prereleases | |
| if: ${{ env.RELEASE_TYPE != 'prerelease' }} | |
| id: url-encode-tar | |
| run: python -c "from urllib.parse import quote; print('tar_url=${{ needs.setup_metadata.outputs.cloudfront_base_url }}/tarball/' + quote('${{ env.FILE_NAME }}'))" >> ${GITHUB_OUTPUT} | |
| - name: Trigger release JAX wheels | |
| # TODO: Enable JAX wheels for prereleases | |
| if: ${{ env.RELEASE_TYPE != 'prerelease' && github.repository_owner == 'ROCm' }} | |
| uses: benc-uk/workflow-dispatch@e2e5e9a103e331dad343f381a29e654aea3cf8fc # v1.2.4 | |
| with: | |
| workflow: release_portable_linux_jax_wheels.yml | |
| ref: ${{ inputs.ref || github.ref_name }} | |
| inputs: | | |
| { "amdgpu_family": "${{ matrix.target_bundle.amdgpu_family }}", | |
| "release_type": "${{ env.RELEASE_TYPE }}", | |
| "s3_subdir": "${{ env.S3_SUBDIR }}", | |
| "s3_staging_subdir": "${{ env.S3_STAGING_SUBDIR }}", | |
| "cloudfront_url": "${{ needs.setup_metadata.outputs.cloudfront_url }}", | |
| "cloudfront_staging_url": "${{ needs.setup_metadata.outputs.cloudfront_staging_url }}", | |
| "rocm_version": "${{ needs.setup_metadata.outputs.version }}", | |
| "tar_url": "${{ steps.url-encode-tar.outputs.tar_url }}", | |
| "ref": "${{ inputs.ref || '' }}" | |
| } | |
| - name: Trigger build native rpm package | |
| if: ${{ github.repository_owner == 'ROCm' }} | |
| uses: benc-uk/workflow-dispatch@e2e5e9a103e331dad343f381a29e654aea3cf8fc # v1.2.4 | |
| with: | |
| workflow: build_native_linux_packages.yml | |
| inputs: | | |
| { "artifact_group": "${{ matrix.target_bundle.amdgpu_family }}", | |
| "rocm_version": "${{ needs.setup_metadata.outputs.rpm_version }}", | |
| "release_type": "${{ env.RELEASE_TYPE }}", | |
| "artifact_run_id": "${{ github.run_id }}", | |
| "ref": "${{ inputs.ref || '' }}", | |
| "native_package_type": "rpm" | |
| } | |
| - name: Trigger build native debian package | |
| if: ${{ github.repository_owner == 'ROCm' }} | |
| uses: benc-uk/workflow-dispatch@e2e5e9a103e331dad343f381a29e654aea3cf8fc # v1.2.4 | |
| with: | |
| workflow: build_native_linux_packages.yml | |
| inputs: | | |
| { "artifact_group": "${{ matrix.target_bundle.amdgpu_family }}", | |
| "rocm_version": "${{ needs.setup_metadata.outputs.deb_version }}", | |
| "release_type": "${{ env.RELEASE_TYPE }}", | |
| "artifact_run_id": "${{ github.run_id }}", | |
| "ref": "${{ inputs.ref || '' }}", | |
| "native_package_type": "deb" | |
| } | |
| - name: Save cache | |
| uses: actions/cache/save@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 | |
| if: ${{ !cancelled() }} | |
| with: | |
| path: ${{ env.OUTPUT_DIR }}/caches | |
| key: portable-linux-package-matrix-v1-${{ matrix.target_bundle.amdgpu_family }}-${{ github.sha }} |