Repository navigation
ignore downloading -test- ROCm package #560
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 Relocatable Packages | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - main | |
| - 'release/**' | |
| pull_request: | |
| branches: | |
| - master | |
| - main | |
| schedule: | |
| # Run daily at 5:00 AM PST (13:00 UTC; PST is UTC-8) | |
| - cron: '0 13 * * *' | |
| workflow_dispatch: | |
| inputs: | |
| rocm_version: | |
| description: 'Optional pin — empty uses latest nightly (unless vars.ROCM_VERSION set). Release X.Y.Z vs nightly x.y.za… selects tarball host by format.' | |
| required: false | |
| default: '' | |
| gpu_family: | |
| description: 'GPU family target' | |
| required: false | |
| type: choice | |
| options: | |
| - gfx94X-dcgpu | |
| - gfx950-dcgpu | |
| - gfx110X-all | |
| - gfx1151 | |
| - gfx120X-all | |
| default: 'gfx110X-all' | |
| build_transferbench_cli: | |
| description: 'Build and bundle TransferBench CLI in DEB/RPM/TGZ' | |
| required: false | |
| type: boolean | |
| default: true | |
| permissions: | |
| contents: read | |
| id-token: write | |
| env: | |
| # Leave unset unless you pin a version via repo variable or workflow_dispatch input. | |
| # With vars.ROCM_SDK_RELEASE_URL set, the script picks latest X.Y.Z from that listing for GPU_FAMILY. | |
| ROCM_VERSION: ${{ vars.ROCM_VERSION }} | |
| GPU_FAMILY: ${{ vars.GPU_FAMILY || 'gfx110X-all' }} | |
| BUILD_TYPE: Release | |
| # TransferBench CLI: OFF in build_packages_local.sh by default; ON in CI unless overridden. | |
| BUILD_TRANSFERBENCH_CLI: ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.build_transferbench_cli && 'ON' || 'OFF') || vars.BUILD_TRANSFERBENCH_CLI || 'ON' }} | |
| # Optional Step 6 in build_packages_local.sh: set repo Actions variable | |
| # RVS_AUTO_DETECT_LOCAL_UPLOAD to "1" to probe localhost:8080 when UPLOAD_TARGET is unset. | |
| # Leave the variable undefined for default (no probe; S3 uses workflow steps only). | |
| RVS_AUTO_DETECT_LOCAL_UPLOAD: ${{ vars.RVS_AUTO_DETECT_LOCAL_UPLOAD }} | |
| # Optional local package server upload (Step 6 of build_packages_local.sh). | |
| # Disabled by default. To enable, set repo Actions variable | |
| # LOCAL_PACKAGE_SERVER_URL to a reachable HTTP server that accepts PUT. | |
| # S3 upload steps also run when repository variable RVS_S3_UPLOAD_ENABLED is the string 'true' | |
| # (in addition to the upstream ROCm/ROCmValidationSuite repo). See README_BUILD_PACKAGES.md. | |
| jobs: | |
| prepare-nightly-branches: | |
| name: Prepare nightly branch matrix | |
| runs-on: ${{ vars.RUNNER_LABEL_UTILITY || 'ubuntu-latest' }} | |
| outputs: | |
| branches_json: ${{ steps.branches.outputs.branches_json }} | |
| steps: | |
| - name: Resolve branch matrix | |
| id: branches | |
| env: | |
| ACTIVE_BRANCHES: ${{ vars.ACTIVE_BRANCHES }} | |
| DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} | |
| EVENT_NAME: ${{ github.event_name }} | |
| REF_NAME: ${{ github.ref_name }} | |
| PR_HEAD_REF: ${{ github.event.pull_request.head.ref }} | |
| GITHUB_TOKEN: ${{ github.token }} | |
| GITHUB_REPOSITORY: ${{ github.repository }} | |
| run: | | |
| python3 <<'PY' | |
| import json | |
| import os | |
| import re | |
| import urllib.request | |
| def list_remote_branches(): | |
| token = os.environ["GITHUB_TOKEN"] | |
| repo = os.environ["GITHUB_REPOSITORY"] | |
| names = [] | |
| page = 1 | |
| while True: | |
| url = ( | |
| f"https://api.github.com/repos/{repo}/branches" | |
| f"?per_page=100&page={page}" | |
| ) | |
| req = urllib.request.Request( | |
| url, | |
| headers={ | |
| "Authorization": f"Bearer {token}", | |
| "Accept": "application/vnd.github+json", | |
| "User-Agent": "rvs-build-relocatable-packages", | |
| }, | |
| ) | |
| with urllib.request.urlopen(req) as resp: | |
| batch = json.loads(resp.read().decode()) | |
| if not batch: | |
| break | |
| for item in batch: | |
| names.append(item["name"]) | |
| if len(batch) < 100: | |
| break | |
| page += 1 | |
| return names | |
| def branch_prefix(name: str) -> str: | |
| return name.split("/", 1)[0] if "/" in name else name | |
| def glob_match(name: str, pattern: str) -> bool: | |
| regex_parts = [] | |
| i = 0 | |
| while i < len(pattern): | |
| if pattern[i : i + 2] == "**": | |
| regex_parts.append(".*") | |
| i += 2 | |
| elif pattern[i] == "*": | |
| regex_parts.append("[^/]*") | |
| i += 1 | |
| else: | |
| regex_parts.append(re.escape(pattern[i])) | |
| i += 1 | |
| return re.fullmatch("".join(regex_parts), name) is not None | |
| def skip_upload_schedule(branch: str) -> bool: | |
| return branch == "release" or branch.startswith("release/") | |
| event = os.environ["EVENT_NAME"] | |
| default = os.environ["DEFAULT_BRANCH"] | |
| if event != "schedule": | |
| if event == "pull_request": | |
| branch = os.environ.get("PR_HEAD_REF") or os.environ["REF_NAME"] | |
| else: | |
| branch = os.environ["REF_NAME"] | |
| branches = [{ | |
| "branch": branch, | |
| "is_default": branch == default, | |
| "skip_upload": False, | |
| "branch_prefix": branch_prefix(branch), | |
| }] | |
| else: | |
| patterns = [ | |
| p.strip() | |
| for p in os.environ.get("ACTIVE_BRANCHES", "").split(",") | |
| if p.strip() | |
| ] | |
| remote_names = list_remote_branches() | |
| matched = set() | |
| for pattern in patterns: | |
| for name in remote_names: | |
| if glob_match(name, pattern) and name != default: | |
| matched.add(name) | |
| branches = [{ | |
| "branch": default, | |
| "is_default": True, | |
| "skip_upload": False, | |
| "branch_prefix": branch_prefix(default), | |
| }] | |
| for name in sorted(matched): | |
| branches.append({ | |
| "branch": name, | |
| "is_default": False, | |
| "skip_upload": skip_upload_schedule(name), | |
| "branch_prefix": branch_prefix(name), | |
| }) | |
| payload = json.dumps(branches) | |
| print(payload) | |
| with open(os.environ["GITHUB_OUTPUT"], "a", encoding="utf-8") as out: | |
| out.write(f"branches_json={payload}\n") | |
| PY | |
| build-ubuntu: | |
| name: Build Ubuntu Packages (${{ matrix.branch }}) | |
| needs: prepare-nightly-branches | |
| runs-on: ${{ vars.RUNNER_LABEL || 'ubuntu-22.04' }} | |
| container: | |
| image: ubuntu:22.04 | |
| # Allow the build container to reach the runner host via host.docker.internal. | |
| options: --add-host=host.docker.internal:host-gateway | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: ${{ fromJson(needs.prepare-nightly-branches.outputs.branches_json) }} | |
| # Apply to every step in the job so apt never drops into an interactive | |
| # frontend (tzdata, libssl, etc.) — each Actions step runs in a fresh | |
| # shell, so an `export` inside one step does not propagate to the next. | |
| env: | |
| DEBIAN_FRONTEND: noninteractive | |
| TZ: Etc/UTC | |
| outputs: | |
| s3_bucket_ubuntu: ${{ steps.upload-s3-ubuntu.outputs.bucket }} | |
| s3_paths_ubuntu: ${{ steps.upload-s3-ubuntu.outputs.paths }} | |
| steps: | |
| # Bootstrap the bare ubuntu:* image so actions/checkout and downstream steps | |
| # (dpkg-deb verify, apt-ftparchive, awscli) work without needing sudo on bare metal. | |
| - name: Bootstrap container (git, curl, packaging tools) | |
| run: | | |
| export DEBIAN_FRONTEND=noninteractive | |
| apt-get update | |
| apt-get install -y --no-install-recommends \ | |
| ca-certificates \ | |
| curl \ | |
| git \ | |
| dpkg-dev \ | |
| apt-utils \ | |
| python3 \ | |
| python3-pip | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ matrix.branch }} | |
| submodules: recursive | |
| fetch-depth: 0 | |
| - name: Set build branch context | |
| run: | | |
| echo "RVS_BUILD_REF_NAME=${{ matrix.branch }}" >> "$GITHUB_ENV" | |
| echo "RVS_IS_DEFAULT_BRANCH=${{ matrix.is_default }}" >> "$GITHUB_ENV" | |
| echo "RVS_SKIP_UPLOAD=${{ matrix.skip_upload }}" >> "$GITHUB_ENV" | |
| echo "RVS_BRANCH_PREFIX=${{ matrix.branch_prefix }}" >> "$GITHUB_ENV" | |
| # Schedule → nightly SDK. PR/push main|release/* → release SDK. Manual pin → format (auto). | |
| - name: Configure ROCm SDK channel and version | |
| run: bash .github/scripts/configure-rocm-sdk-channel.sh | |
| env: | |
| INPUT_ROCM_VERSION: ${{ github.event.inputs.rocm_version }} | |
| VAR_ROCM_VERSION: ${{ vars.ROCM_VERSION }} | |
| INPUT_GPU_FAMILY: ${{ github.event.inputs.gpu_family }} | |
| ROCM_SDK_RELEASE_URL: ${{ vars.ROCM_SDK_RELEASE_URL }} | |
| ROCM_SDK_RELEASE_BASE_URL: ${{ vars.ROCM_SDK_RELEASE_BASE_URL }} | |
| ROCM_SDK_NIGHTLY_BASE_URL: ${{ vars.ROCM_SDK_NIGHTLY_BASE_URL }} | |
| ROCM_SDK_NIGHTLY_INDEX_URL: ${{ vars.ROCM_SDK_NIGHTLY_INDEX_URL }} | |
| # Forward LOCAL_PACKAGE_SERVER_URL to the build script as UPLOAD_TARGET. | |
| - name: Configure local package upload | |
| if: vars.LOCAL_PACKAGE_SERVER_URL != '' | |
| run: | | |
| echo "UPLOAD_TARGET=${{ vars.LOCAL_PACKAGE_SERVER_URL }}" >> "$GITHUB_ENV" | |
| - name: Build and Package RVS | |
| run: | | |
| chmod +x build_packages_local.sh | |
| # Container runs as root; ROCM_SDK_* come from "Configure ROCm SDK channel" via GITHUB_ENV. | |
| ./build_packages_local.sh | |
| # Print the resulting download URL in the step log and run Summary. | |
| - name: Print local package download URL | |
| if: vars.LOCAL_PACKAGE_SERVER_URL != '' | |
| run: | | |
| REPO="${GITHUB_REPOSITORY##*/}" | |
| BRANCH="${RVS_BUILD_REF_NAME:-$GITHUB_REF_NAME}" | |
| SAFE_BRANCH=$(echo "$BRANCH" | sed 's|[^a-zA-Z0-9._/-]|-|g') | |
| DATE=$(date +%Y-%m-%d) | |
| URL="${{ vars.LOCAL_PACKAGE_SERVER_URL }}/${REPO}/${SAFE_BRANCH}/${DATE}/" | |
| echo "================================================================" | |
| echo " Package downloads for this build (Ubuntu)" | |
| echo " $URL" | |
| echo "================================================================" | |
| { | |
| echo "## Package Downloads (Ubuntu)" | |
| echo "" | |
| echo "[$URL]($URL)" | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| - name: Verify DEB Package | |
| run: | | |
| cd ./build | |
| DEB_FILE=$(ls amdrocm*-rvs*.deb | head -1) | |
| if [ -n "$DEB_FILE" ]; then | |
| echo "=== DEB Package Info ===" | |
| dpkg-deb -I "$DEB_FILE" | |
| echo "" | |
| echo "=== DEB Package Contents (first 30 files) ===" | |
| dpkg-deb -c "$DEB_FILE" | head -30 | |
| echo "" | |
| echo "Package filename: $DEB_FILE" | |
| fi | |
| # S3 upload: upstream repo, or any repo with vars.RVS_S3_UPLOAD_ENABLED == 'true' (skip fork PRs: OIDC empty → JSON parse fails) | |
| - name: Install AWS CLI | |
| if: (github.repository == 'ROCm/ROCmValidationSuite' || vars.RVS_S3_UPLOAD_ENABLED == 'true') && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && matrix.skip_upload != true | |
| run: apt-get update && apt-get install -y awscli | |
| - name: Configure AWS credentials | |
| if: (github.repository == 'ROCm/ROCmValidationSuite' || vars.RVS_S3_UPLOAD_ENABLED == 'true') && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && matrix.skip_upload != true | |
| run: | | |
| TOKEN=$(curl -s -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \ | |
| "${ACTIONS_ID_TOKEN_REQUEST_URL}&audience=sts.amazonaws.com" | python3 -c "import sys,json; print(json.load(sys.stdin)['value'])") | |
| CREDS=$(aws sts assume-role-with-web-identity \ | |
| --role-arn "${{ secrets.AWS_ROLE_ARN }}" \ | |
| --role-session-name "github-actions-${{ github.run_id }}" \ | |
| --web-identity-token "$TOKEN" \ | |
| --query 'Credentials' --output json) | |
| echo "AWS_ACCESS_KEY_ID=$(echo "$CREDS" | python3 -c "import sys,json; print(json.load(sys.stdin)['AccessKeyId'])")" >> $GITHUB_ENV | |
| echo "AWS_SECRET_ACCESS_KEY=$(echo "$CREDS" | python3 -c "import sys,json; print(json.load(sys.stdin)['SecretAccessKey'])")" >> $GITHUB_ENV | |
| echo "AWS_SESSION_TOKEN=$(echo "$CREDS" | python3 -c "import sys,json; print(json.load(sys.stdin)['SessionToken'])")" >> $GITHUB_ENV | |
| echo "AWS_DEFAULT_REGION=us-east-1" >> $GITHUB_ENV | |
| echo "::add-mask::$(echo "$CREDS" | python3 -c "import sys,json; print(json.load(sys.stdin)['SecretAccessKey'])")" | |
| echo "::add-mask::$(echo "$CREDS" | python3 -c "import sys,json; print(json.load(sys.stdin)['SessionToken'])")" | |
| env: | |
| AWS_DEFAULT_REGION: us-east-1 | |
| # S3 routing: POSIX script (ubuntu:22.04 container uses sh — no bash [[). | |
| - name: Upload Ubuntu packages to S3 | |
| id: upload-s3-ubuntu | |
| if: (github.repository == 'ROCm/ROCmValidationSuite' || vars.RVS_S3_UPLOAD_ENABLED == 'true') && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && matrix.skip_upload != true | |
| run: sh .github/scripts/rvs-s3-upload-route.sh upload-deb | |
| env: | |
| AWS_S3_BUCKET: ${{ vars.AWS_S3_BUCKET }} | |
| RVS_RUNNER_SUFFIX: ubuntu-22.04 | |
| # Generate APT repo metadata (Packages, Packages.gz, Release) so the S3 path | |
| # can be consumed directly as a DEB repository by apt. | |
| # Only runs when S3 upload is allowed (upstream or RVS_S3_UPLOAD_ENABLED) and the event is schedule, push, or manual. | |
| - name: Generate and upload DEB repo metadata to S3 | |
| if: (github.repository == 'ROCm/ROCmValidationSuite' || vars.RVS_S3_UPLOAD_ENABLED == 'true') && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && (github.event_name == 'schedule' || github.event_name == 'push' || github.event_name == 'workflow_dispatch') && matrix.skip_upload != true && (github.event_name != 'schedule' || matrix.is_default == true) | |
| run: | | |
| BUCKET="${{ vars.AWS_S3_BUCKET }}" | |
| [ -z "$BUCKET" ] && exit 0 | |
| # dpkg-dev and apt-utils were installed in the Bootstrap container step. | |
| set -- $(sh .github/scripts/rvs-s3-upload-route.sh deb-repo-prefix) | |
| DEB_PREFIX="$1" | |
| APT_SUITE="$2" | |
| STAGING=$(mktemp -d) | |
| echo "Downloading existing DEBs from s3://${BUCKET}/${DEB_PREFIX}/ ..." | |
| aws s3 sync "s3://${BUCKET}/${DEB_PREFIX}/" "$STAGING/" \ | |
| --exclude "Packages*" --exclude "Release*" --exclude "InRelease" \ | |
| --no-progress || true | |
| cp ./build/amdrocm*-rvs*.deb "$STAGING/" 2>/dev/null || true | |
| cd "$STAGING" | |
| dpkg-scanpackages --multiversion . /dev/null > Packages | |
| # dpkg-scanpackages emits "Filename: ./foo.deb". APT resolves that under the repo URL and may | |
| # request .../deb/./foo.deb — S3/CloudFront keys are literal, so that path 404s. Strip "./". | |
| sed -i 's#^Filename: \./#Filename: #g' Packages | |
| gzip -k -f Packages | |
| apt-ftparchive \ | |
| -o APT::FTPArchive::Release::Origin="ROCm Validation Suite" \ | |
| -o APT::FTPArchive::Release::Label="${APT_SUITE}" \ | |
| -o APT::FTPArchive::Release::Suite="${APT_SUITE}" \ | |
| -o APT::FTPArchive::Release::Codename="${APT_SUITE}" \ | |
| release . > Release | |
| aws s3 sync "$STAGING/" "s3://${BUCKET}/${DEB_PREFIX}/" --no-progress | |
| echo "=== DEB repo metadata uploaded to s3://${BUCKET}/${DEB_PREFIX}/ ===" | |
| aws s3 ls "s3://${BUCKET}/${DEB_PREFIX}/" --human-readable || true | |
| env: | |
| AWS_S3_BUCKET: ${{ vars.AWS_S3_BUCKET }} | |
| RVS_RUNNER_SUFFIX: ubuntu-22.04 | |
| build-centos: | |
| name: Build CentOS/RHEL Packages (${{ matrix.branch }}) | |
| needs: prepare-nightly-branches | |
| runs-on: ${{ vars.RUNNER_LABEL_CONTAINER || 'ubuntu-latest' }} | |
| container: | |
| image: quay.io/pypa/manylinux_2_28_x86_64 | |
| # Allow the build container to reach the runner host via host.docker.internal. | |
| options: --add-host=host.docker.internal:host-gateway | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: ${{ fromJson(needs.prepare-nightly-branches.outputs.branches_json) }} | |
| outputs: | |
| s3_bucket_centos: ${{ steps.upload-s3-centos.outputs.bucket }} | |
| s3_paths_centos: ${{ steps.upload-s3-centos.outputs.paths }} | |
| steps: | |
| - name: Install Git (for checkout) | |
| run: | | |
| yum install -y git | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ matrix.branch }} | |
| submodules: recursive | |
| fetch-depth: 0 | |
| - name: Set build branch context | |
| run: | | |
| echo "RVS_BUILD_REF_NAME=${{ matrix.branch }}" >> "$GITHUB_ENV" | |
| echo "RVS_IS_DEFAULT_BRANCH=${{ matrix.is_default }}" >> "$GITHUB_ENV" | |
| echo "RVS_SKIP_UPLOAD=${{ matrix.skip_upload }}" >> "$GITHUB_ENV" | |
| echo "RVS_BRANCH_PREFIX=${{ matrix.branch_prefix }}" >> "$GITHUB_ENV" | |
| - name: Configure ROCm SDK channel and version | |
| run: bash .github/scripts/configure-rocm-sdk-channel.sh | |
| env: | |
| INPUT_ROCM_VERSION: ${{ github.event.inputs.rocm_version }} | |
| VAR_ROCM_VERSION: ${{ vars.ROCM_VERSION }} | |
| INPUT_GPU_FAMILY: ${{ github.event.inputs.gpu_family }} | |
| ROCM_SDK_RELEASE_URL: ${{ vars.ROCM_SDK_RELEASE_URL }} | |
| ROCM_SDK_RELEASE_BASE_URL: ${{ vars.ROCM_SDK_RELEASE_BASE_URL }} | |
| ROCM_SDK_NIGHTLY_BASE_URL: ${{ vars.ROCM_SDK_NIGHTLY_BASE_URL }} | |
| ROCM_SDK_NIGHTLY_INDEX_URL: ${{ vars.ROCM_SDK_NIGHTLY_INDEX_URL }} | |
| - name: Configure local package upload | |
| if: vars.LOCAL_PACKAGE_SERVER_URL != '' | |
| run: | | |
| echo "UPLOAD_TARGET=${{ vars.LOCAL_PACKAGE_SERVER_URL }}" >> "$GITHUB_ENV" | |
| - name: Build and Package RVS | |
| run: | | |
| chmod +x build_packages_local.sh | |
| ./build_packages_local.sh | |
| - name: Print local package download URL | |
| if: vars.LOCAL_PACKAGE_SERVER_URL != '' | |
| run: | | |
| REPO="${GITHUB_REPOSITORY##*/}" | |
| BRANCH="${RVS_BUILD_REF_NAME:-$GITHUB_REF_NAME}" | |
| SAFE_BRANCH=$(echo "$BRANCH" | sed 's|[^a-zA-Z0-9._/-]|-|g') | |
| DATE=$(date +%Y-%m-%d) | |
| URL="${{ vars.LOCAL_PACKAGE_SERVER_URL }}/${REPO}/${SAFE_BRANCH}/${DATE}/" | |
| echo "================================================================" | |
| echo " Package downloads for this build (CentOS/RHEL)" | |
| echo " $URL" | |
| echo "================================================================" | |
| { | |
| echo "## Package Downloads (CentOS/RHEL)" | |
| echo "" | |
| echo "[$URL]($URL)" | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| - name: Verify RPM Package | |
| run: | | |
| cd ./build | |
| RPM_FILE=$(ls amdrocm*-rvs*.rpm | head -1) | |
| if [ -n "$RPM_FILE" ]; then | |
| echo "=== RPM Package Info ===" | |
| rpm -qip "$RPM_FILE" | |
| echo "" | |
| echo "=== RPM Package Contents (first 30 files) ===" | |
| rpm -qlp "$RPM_FILE" | head -30 | |
| echo "" | |
| echo "=== RPM Dependencies ===" | |
| rpm -qRp "$RPM_FILE" | |
| echo "" | |
| echo "Package filename: $RPM_FILE" | |
| fi | |
| # S3 upload: upstream repo, or RVS_S3_UPLOAD_ENABLED (skip fork PRs — OIDC not usable) | |
| - name: Install AWS CLI | |
| if: (github.repository == 'ROCm/ROCmValidationSuite' || vars.RVS_S3_UPLOAD_ENABLED == 'true') && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && matrix.skip_upload != true | |
| run: | | |
| python3 -m pip install --break-system-packages awscli || (yum install -y python3-pip && pip3 install awscli) | |
| - name: Configure AWS credentials | |
| if: (github.repository == 'ROCm/ROCmValidationSuite' || vars.RVS_S3_UPLOAD_ENABLED == 'true') && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && matrix.skip_upload != true | |
| run: | | |
| TOKEN=$(curl -s -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \ | |
| "${ACTIONS_ID_TOKEN_REQUEST_URL}&audience=sts.amazonaws.com" | python3 -c "import sys,json; print(json.load(sys.stdin)['value'])") | |
| CREDS=$(aws sts assume-role-with-web-identity \ | |
| --role-arn "${{ secrets.AWS_ROLE_ARN }}" \ | |
| --role-session-name "github-actions-${{ github.run_id }}" \ | |
| --web-identity-token "$TOKEN" \ | |
| --query 'Credentials' --output json) | |
| echo "AWS_ACCESS_KEY_ID=$(echo "$CREDS" | python3 -c "import sys,json; print(json.load(sys.stdin)['AccessKeyId'])")" >> $GITHUB_ENV | |
| echo "AWS_SECRET_ACCESS_KEY=$(echo "$CREDS" | python3 -c "import sys,json; print(json.load(sys.stdin)['SecretAccessKey'])")" >> $GITHUB_ENV | |
| echo "AWS_SESSION_TOKEN=$(echo "$CREDS" | python3 -c "import sys,json; print(json.load(sys.stdin)['SessionToken'])")" >> $GITHUB_ENV | |
| echo "AWS_DEFAULT_REGION=us-east-1" >> $GITHUB_ENV | |
| echo "::add-mask::$(echo "$CREDS" | python3 -c "import sys,json; print(json.load(sys.stdin)['SecretAccessKey'])")" | |
| echo "::add-mask::$(echo "$CREDS" | python3 -c "import sys,json; print(json.load(sys.stdin)['SessionToken'])")" | |
| env: | |
| AWS_DEFAULT_REGION: us-east-1 | |
| - name: Upload CentOS/RHEL packages to S3 | |
| id: upload-s3-centos | |
| if: (github.repository == 'ROCm/ROCmValidationSuite' || vars.RVS_S3_UPLOAD_ENABLED == 'true') && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && matrix.skip_upload != true | |
| run: sh .github/scripts/rvs-s3-upload-route.sh upload-rpm-tar | |
| env: | |
| AWS_S3_BUCKET: ${{ vars.AWS_S3_BUCKET }} | |
| RVS_RUNNER_SUFFIX: manylinux_2_28 | |
| # Generate YUM/DNF repo metadata (repodata/) so the S3 path can be consumed | |
| # directly as an RPM repository by yum/dnf. | |
| # Only runs when S3 upload is allowed (upstream or RVS_S3_UPLOAD_ENABLED) and the event is schedule, push, or manual. | |
| - name: Generate and upload RPM repodata to S3 | |
| if: (github.repository == 'ROCm/ROCmValidationSuite' || vars.RVS_S3_UPLOAD_ENABLED == 'true') && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && (github.event_name == 'schedule' || github.event_name == 'push' || github.event_name == 'workflow_dispatch') && matrix.skip_upload != true && (github.event_name != 'schedule' || matrix.is_default == true) | |
| run: | | |
| BUCKET="${{ vars.AWS_S3_BUCKET }}" | |
| [ -z "$BUCKET" ] && exit 0 | |
| yum install -y createrepo_c || yum install -y createrepo | |
| RPM_PREFIX=$(sh .github/scripts/rvs-s3-upload-route.sh rpm-repo-prefix) | |
| STAGING=$(mktemp -d) | |
| echo "Downloading existing RPMs from s3://${BUCKET}/${RPM_PREFIX}/ ..." | |
| aws s3 sync "s3://${BUCKET}/${RPM_PREFIX}/" "$STAGING/" \ | |
| --exclude "repodata/*" --no-progress || true | |
| cp ./build/amdrocm*-rvs*.rpm "$STAGING/" 2>/dev/null || true | |
| createrepo_c "$STAGING" || createrepo "$STAGING" | |
| aws s3 sync "$STAGING/" "s3://${BUCKET}/${RPM_PREFIX}/" --no-progress | |
| echo "=== RPM repodata uploaded to s3://${BUCKET}/${RPM_PREFIX}/repodata/ ===" | |
| aws s3 ls "s3://${BUCKET}/${RPM_PREFIX}/repodata/" --human-readable || true | |
| env: | |
| AWS_S3_BUCKET: ${{ vars.AWS_S3_BUCKET }} | |
| RVS_RUNNER_SUFFIX: manylinux_2_28 | |
| create-release: | |
| name: Create Release Summary | |
| needs: [build-ubuntu, build-centos] | |
| runs-on: ${{ vars.RUNNER_LABEL_UTILITY || 'ubuntu-latest' }} | |
| # Skip on schedule: matrix builds do not aggregate job outputs reliably | |
| if: always() && !cancelled() && github.event_name != 'schedule' | |
| steps: | |
| - name: Generate Build Report | |
| run: | | |
| cat > build-report.md << 'REPORT' | |
| # ROCm Validation Suite - Build Report | |
| ## Build Information | |
| - **Commit**: ${{ github.sha }} | |
| - **Branch**: ${{ github.ref_name }} | |
| - **Build Date**: $(date -u +'%Y-%m-%d %H:%M:%S UTC') | |
| ## Installation Instructions | |
| ### Ubuntu/Debian | |
| ```bash | |
| sudo dpkg -i amdrocm*-rvs_*.deb | |
| ``` | |
| ### CentOS/RHEL | |
| ```bash | |
| sudo rpm -i --replacefiles --nodeps amdrocm*-rvs-*.rpm | |
| ``` | |
| ### Relocatable TGZ (Any Linux Distribution) | |
| ```bash | |
| tar -xzf amdrocm*-rvs-*.tar.gz -C /opt/rocm/ | |
| export PATH=/opt/rocm/rvs/bin:$PATH | |
| export LD_LIBRARY_PATH=/opt/rocm/rvs/lib:$LD_LIBRARY_PATH | |
| ``` | |
| ## Notes | |
| - All packages are built with relocatable RPATH settings | |
| - TGZ packages can be extracted to any location | |
| - Install path: /opt/rocm/rvs | |
| - ROCm SDK from TheRock nightly builds is used | |
| REPORT | |
| - name: Add S3 upload links to build report | |
| run: | | |
| BUCKET="${{ needs.build-ubuntu.outputs.s3_bucket_ubuntu }}" | |
| if [ -z "$BUCKET" ]; then | |
| BUCKET="${{ needs.build-centos.outputs.s3_bucket_centos }}" | |
| fi | |
| if [ -z "$BUCKET" ]; then | |
| echo "No S3 upload in this run, skipping S3 links section." | |
| exit 0 | |
| fi | |
| echo "" >> build-report.md | |
| echo "## S3 Upload Locations" >> build-report.md | |
| echo "" >> build-report.md | |
| echo "Packages were uploaded to the following S3 locations (AWS Console links):" >> build-report.md | |
| echo "" >> build-report.md | |
| PATHS_UBUNTU="${{ needs.build-ubuntu.outputs.s3_paths_ubuntu }}" | |
| PATHS_CENTOS="${{ needs.build-centos.outputs.s3_paths_centos }}" | |
| echo "$PATHS_UBUNTU" | sed 's/||/\n/g' | while IFS= read -r part; do | |
| [ -z "$part" ] && continue | |
| label="${part%%|*}"; prefix="${part#*|}" | |
| enc=$(echo "$prefix" | sed 's|/|%2F|g')/ | |
| echo "- [$label](https://s3.console.aws.amazon.com/s3/buckets/${BUCKET}?prefix=${enc})" >> build-report.md | |
| done | |
| echo "$PATHS_CENTOS" | sed 's/||/\n/g' | while IFS= read -r part; do | |
| [ -z "$part" ] && continue | |
| label="${part%%|*}"; prefix="${part#*|}" | |
| enc=$(echo "$prefix" | sed 's|/|%2F|g')/ | |
| echo "- [$label](https://s3.console.aws.amazon.com/s3/buckets/${BUCKET}?prefix=${enc})" >> build-report.md | |
| done | |
| echo "" >> build-report.md | |
| cat build-report.md | |
| - name: Upload Build Report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-report | |
| path: build-report.md | |
| retention-days: 90 |