Clear space if it's github hosted runner #84
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 Linux Runfile Installer | ||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| rocm_version: | ||
| description: ROCm version used to build runfile installer (7.12.0~20260218 for nightly, 7.11.0~rc2 for 7.11 prerelease RC2 or 7.12.0 if you're triggering the job manually) | ||
| required: true | ||
| type: string | ||
| release_type: | ||
| description: The type of release to build ("dev", "nightly", or "prerelease"). All developer-triggered jobs should use "dev"! | ||
| required: true | ||
| type: string | ||
| default: "dev" | ||
| gfx_archs: | ||
| description: gfx architectures to build (eg "gfx90x", "gfx94x", "gfx950", "gfx110x", "gfx1150", "gfx1151", "gfx1152", "gfx120x") | ||
| required: true | ||
| type: string | ||
| pull_type: | ||
| description: Specify where you want to pull packages from ("nightly" or "prereleases") which pull from rocm.nightlies.amd.com or rocm.prereleases.amd.com | ||
| required: true | ||
| type: string | ||
| default: "nightly" | ||
| pull_tag: | ||
| description: Set build date in the format (YYYYMMDD) to specify nightly build to build runfile installer off of if pull_type = nightly. Set to rc[BUILD_NUM] if pull_type = prerelease. | ||
| required: false | ||
| type: string | ||
| pull_run_id: | ||
| description: Workflow run id of deb and rpm packages used to build runfile installer off of. Only needed if release_type is nightly. | ||
| required: false | ||
| type: string | ||
| pull_pkg: | ||
| description: Set base package name with optional type prefix. Can set it to base:amdrocm-amdsmi to quickly test your code. Otherwise, leave empty. To see what values are valid, run command "bash build-runfile-installer.sh help" | ||
| required: false | ||
| type: string | ||
| default: "amdrocm-core-sdk" | ||
| workflow_dispatch: | ||
| inputs: | ||
| rocm_version: | ||
| description: ROCm version used to build runfile installer (7.12.0~20260218 for nightly, 7.11.0~rc2 for 7.11 prerelease RC2 or 7.12.0 if you're triggering the job manually). | ||
| required: true | ||
| type: string | ||
| release_type: | ||
| description: The type of release to build. All developer-triggered jobs should use "dev"! | ||
| type: choice | ||
| options: | ||
| - dev | ||
| - nightly | ||
| - prerelease | ||
| default: "dev" | ||
| gfx_archs: | ||
| description: gfx architectures to build (eg "gfx90x", "gfx94x", "gfx950", "gfx110x", "gfx1150", "gfx1151", "gfx1152", "gfx120x") | ||
| required: true | ||
| type: string | ||
| default: "gfx110x" | ||
| pull_type: | ||
| description: Specify where you want to pull packages from, which pull from rocm.nightlies.amd.com or rocm.prereleases.amd.com | ||
| type: choice | ||
| options: | ||
| - nightly | ||
| - prerelease | ||
| default: "nightly" | ||
| pull_tag: | ||
| description: Set build date in the format (YYYYMMDD) to specify nightly build to build runfile installer off of if pull_type = nightly. Set to rc[BUILD_NUM] if pull_type = prerelease. | ||
| required: false | ||
| type: string | ||
| pull_run_id: | ||
| description: Workflow run id of deb and rpm packages used to build runfile installer off of. Only needed if release_type is nightly. | ||
| required: false | ||
| type: string | ||
| pull_pkg: | ||
| description: Set base package name with optional type prefix. Can set it to base:amdrocm-amdsmi to quickly test your code. Otherwise, leave empty. To see what values are valid, run command "bash build-runfile-installer.sh help" | ||
| required: false | ||
| type: string | ||
| default: "amdrocm-core-sdk" | ||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
| run-name: Build Linux Runfile Installer Test job (${{ inputs.rocm_version }}, ${{ inputs.release_type }}, ${{ inputs.pull_type }}, ${{ inputs.pull_tag }}, ${{ inputs.gfx_archs }}, ${{ inputs.pull_run_id }}) | ||
| jobs: | ||
| build_linux_runfile_installer: | ||
| name: Build and Release Linux Runfile Installer | ||
| strategy: | ||
| fail-fast: false | ||
| # runs-on: ${{ github.repository_owner == 'ROCm' && 'azure-linux-scale-rocm' || 'ubuntu-24.04' }} | ||
| runs-on: ubuntu-24.04 | ||
| container: | ||
| image: ghcr.io/rocm/therock_build_manylinux_x86_64@sha256:d6ae5712a9c7e8b88281d021e907b312cd8a26295b95690baef3e8dde4805858 | ||
| defaults: | ||
| run: | ||
| working-directory: ${{ github.workspace}}/build_tools/packaging/runfile-installer | ||
| env: | ||
| BUILD_IMAGE: ghcr.io/rocm/therock_build_manylinux_x86_64@sha256:d6ae5712a9c7e8b88281d021e907b312cd8a26295b95690baef3e8dde4805858 | ||
| BUILD_RUNID: ${{ github.run_id }} | ||
| OUTPUT_DIR: ${{ github.workspace }}/build | ||
| RUNFILE_BUILD_DIR: ${{ github.workspace }}/build | ||
| RELEASE_TYPE: ${{ inputs.release_type }} | ||
| PULL_TAG: ${{ inputs.pull_tag }} | ||
| PULL_RUN_ID: ${{ inputs.pull_run_id }} | ||
| PULL_TYPE: ${{ inputs.pull_type }} | ||
| PULL_PKG: ${{ inputs.pull_pkg }} | ||
| BUILD_TAG: ${{ inputs.pull_tag }} | ||
| GFX_ARCHS: ${{ inputs.gfx_archs }} | ||
| S3_BUCKET_RUNFILE: therock-${{ inputs.release_type }}-runfile | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| - name: Get space (before) | ||
| run: df -h | ||
| - name: Free disk space | ||
| if: ${{ runner.environment == 'github-hosted' }} | ||
| uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be | ||
| with: | ||
| tool-cache: false | ||
| android: true | ||
| dotnet: true | ||
| haskell: true | ||
| large-packages: true | ||
| swap-storage: true | ||
| - name: Get space (after) | ||
| run: df -h | ||
| - name: Set ROCM_VERSION | ||
| run: | | ||
| ROCM_VERSION=$(echo "${{ inputs.rocm_version }}" | cut -d'~' -f1) | ||
| echo "Set value of ROCM_VERSION = '$ROCM_VERSION'" | ||
| echo "ROCM_VERSION=$ROCM_VERSION" >> $GITHUB_ENV | ||
| # Value of inputs.rocm_version for daily nightly job would be in the format 7.12.0~20260218. | ||
| # We need the 20260218 and set it to pull_tag | ||
| # Value of inputs.rocm_version for prerelease job would be in the format 7.12.0~rc2. | ||
| # We need the rc2 and set it to pull_tag. | ||
| - name: Set PULL_TAG | ||
| run: | | ||
| if [[ -z $PULL_TAG ]]; then | ||
| PULL_TAG=$(echo "${{ inputs.rocm_version }}" | cut -d'~' -f2) | ||
| echo "Set value of PULL_TAG = '$PULL_TAG'" | ||
| echo "PULL_TAG=$PULL_TAG" >> $GITHUB_ENV | ||
| fi | ||
| - name: Set MSCOMP | ||
| run: | | ||
| if [[ $RELEASE_TYPE == "dev" ]]; then | ||
| MSCOMP=dev | ||
| else | ||
| MSCOMP=prodmedium | ||
| fi | ||
| echo "Set value of MSCOMP = '$MSCOMP'" | ||
| echo "MSCOMP=$MSCOMP" >> $GITHUB_ENV | ||
| - name: Set BUILD_TAG for dev branch | ||
| if: ${{ env.RELEASE_TYPE == 'dev' }} | ||
| run: | | ||
| git config --global --add safe.directory "$GITHUB_WORKSPACE" | ||
| BUILD_TAG="dev-$(git rev-parse --short HEAD)" | ||
| echo "Set value of BUILD_TAG = '$BUILD_TAG'" | ||
| echo "BUILD_TAG=$BUILD_TAG" >> $GITHUB_ENV | ||
| - name: Run build-runfile-installer.sh | ||
| run: | | ||
| echo "### Runfile Build Options" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
| echo "\`bash build-runfile-installer.sh rocm amdgpu rocm-archs=$GFX_ARCHS pull=$PULL_TYPE pulltag=$PULL_TAG pullrunid=$PULL_RUN_ID pullrocmver=$ROCM_VERSION pullpkg=$PULL_PKG buildtag=$BUILD_TAG buildrunid=$BUILD_RUNID mscomp=$MSCOMP\`" >> $GITHUB_STEP_SUMMARY | ||
| bash build-runfile-installer.sh rocm amdgpu rocm-archs=$GFX_ARCHS pull=$PULL_TYPE pulltag=$PULL_TAG pullrunid=$PULL_RUN_ID pullrocmver=$ROCM_VERSION pullpkg=$PULL_PKG buildtag=$BUILD_TAG buildrunid=$BUILD_RUNID mscomp=$MSCOMP | ||
| - name: Show .run file | ||
| run: find . -name "*.run" -type f -exec ls -lctrh {} \; | ||
| - name: Install AWS CLI | ||
| working-directory: ${{ github.workspace }} | ||
| run: bash ./dockerfiles/install_awscli.sh | ||
| - name: Configure AWS Credentials | ||
| if: ${{ github.repository_owner == 'ROCm' }} | ||
| uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7 # v6.0.0 | ||
| with: | ||
| aws-region: us-east-1 | ||
| role-to-assume: arn:aws:iam::317668459450:role/therock-${{ env.RELEASE_TYPE }}-runfile-s3-oidc | ||
| - name: Upload runfile to S3 | ||
| if: ${{ github.repository_owner == 'ROCm' }} | ||
| run: | | ||
| RUNFILE=$(find . -name "*.run" -type f | head -1) | ||
| if [ -z "$RUNFILE" ]; then | ||
| echo "ERROR: No .run file found" | ||
| exit 1 | ||
| fi | ||
| RUNFILE_NAME=$(basename "$RUNFILE") | ||
| echo "Uploading $RUNFILE to s3://${{ env.S3_BUCKET_RUNFILE }}/" | ||
| aws s3 cp "$RUNFILE" "s3://${{ env.S3_BUCKET_RUNFILE }}/" | ||
| # Append to GitHub Actions summary | ||
| echo "### Runfile Uploaded to S3" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
| echo "**File:** \`${RUNFILE_NAME}\`" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
| echo "**S3 Bucket:** \`${{ env.S3_BUCKET_RUNFILE }}\`" >> $GITHUB_STEP_SUMMARY | ||
| - name: Generate index.html needed to display runfile installers. | ||
| if: ${{ github.repository_owner == 'ROCm' }} | ||
| working-directory: ${{ github.workspace }}/build_tools | ||
| run: | | ||
| python -m venv .venv | ||
| source .venv/bin/activate | ||
| pip install boto3 | ||
| python index_generation_s3_runfile.py --bucket ${{ env.S3_BUCKET_RUNFILE }} --upload | ||