name: Build Multi-Arch Native Linux Packages on: workflow_call: inputs: dist_amdgpu_families: description: "Semicolon-separated list of all GPU families (e.g., 'gfx94X-dcgpu;gfx120X-all')" required: true type: string artifact_run_id: description: "Workflow run id to download the artifacts from" required: false type: string default: "" rocm_version: description: "ROCm version to append to the package (8.0.0, 8.0.1rc1, ...)" required: true type: string native_package_type: description: "Package type (deb or rpm)" required: true type: string package_suffix: description: "The suffix to be added to package name (asan, tsan, static or rpath)" required: false type: string default: "" build_variant: description: "Build variant (e.g. 'asan'). When set to 'asan', changes the install prefix to DEFAULT_INSTALL_PREFIX-asan-MAJOR.MINOR (e.g. /opt/rocm/core-asan-7.15)." required: false type: string default: "" release_type: description: "Release type: 'ci', 'dev', 'nightly', or 'prerelease'" required: false type: string default: ci repository: description: "Repository to checkout. Otherwise, defaults to `github.repository`" type: string required: false ref: description: "Branch, tag or SHA to checkout. Defaults to the reference or SHA that triggered the workflow" type: string required: false outputs: package_repository_url: description: "Public repository URL for package installation" value: ${{ jobs.build_native_packages.outputs.package_repository_url }} permissions: id-token: write contents: read run-name: Build ${{ inputs.native_package_type }} packages (${{ inputs.rocm_version }}, ${{ inputs.dist_amdgpu_families }}${{ inputs.release_type && format(', {0}', inputs.release_type) || '' }}) jobs: build_native_packages: name: Build ${{ inputs.native_package_type }} packages runs-on: ${{ github.repository_owner == 'ROCm' && 'aws-linux-scale-rocm-prod-rc' || 'ubuntu-24.04' }} container: image: ghcr.io/rocm/no_rocm_image_ubuntu24_04:latest outputs: package_repository_url: ${{ steps.upload-packages.outputs.package_repository_url }} env: ARTIFACT_RUN_ID: "${{ inputs.artifact_run_id != '' && inputs.artifact_run_id || github.run_id }}" DIST_AMDGPU_FAMILIES: ${{ inputs.dist_amdgpu_families }} PACKAGE_SUFFIX: ${{ inputs.package_suffix }} # Use relative paths to avoid host/container path mismatch OUTPUT_DIR: output ARTIFACTS_DIR: output/artifacts PACKAGE_DIST_DIR: output/packages RELEASE_TYPE: ${{ inputs.release_type }} steps: - name: Checking out repository uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: repository: ${{ inputs.repository || github.repository }} ref: ${{ inputs.ref || '' }} - name: Set up Python uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: python-version: '3.12' - name: Install Python requirements run: | pip install pyelftools boto3 jinja2 pyzstd - name: Install System requirements run: | # Install the needed tools for creating rpm / deb packages # Also install tools for creating repo files sudo apt-get update sudo apt-get install -y llvm-20 sudo apt-get install -y rpm debhelper-compat build-essential sudo apt-get install -y dpkg-dev createrepo-c sudo apt-get install -y patchelf - name: Fetch Artifacts for all GPU families run: | # Use artifact_manager.py for consistent multi-arch artifact fetching # NOTE: artifact_manager.py appends /artifacts to --output-dir in non-flatten mode, # so we pass OUTPUT_DIR (parent) to have artifacts land in $OUTPUT_DIR/artifacts # which matches the ARTIFACTS_DIR environment variable python ./build_tools/artifact_manager.py fetch \ --run-id="${{ env.ARTIFACT_RUN_ID }}" \ --stage=all \ --amdgpu-families="${{ env.DIST_AMDGPU_FAMILIES }}" \ --expand-family-to-targets \ --output-dir="${{ env.OUTPUT_DIR }}" - name: Build Packages id: build-packages run: | # GFX architectures are auto-detected from the artifact directory # (populated by --expand-family-to-targets in the fetch step). # KPACK_SPLIT_ARTIFACTS is auto-detected from therock_manifest.json. python ./build_tools/packaging/linux/build_package.py \ --dest-dir "${{ env.PACKAGE_DIST_DIR }}" \ --rocm-version "${{ inputs.rocm_version }}" \ --artifacts-dir "${{ env.ARTIFACTS_DIR }}" \ --pkg-type "${{ inputs.native_package_type }}" \ --version-suffix "${{ env.ARTIFACT_RUN_ID }}" \ --build-variant "${{ inputs.build_variant }}" - name: Simulated install Test id: test-packages run: | python ./build_tools/packaging/linux/native_linux_package_install_test.py \ --test-type simulate \ --packages-dir "${{ env.PACKAGE_DIST_DIR }}" \ --pkg-type ${{ inputs.native_package_type }} - name: Configure AWS credentials for artifact uploads uses: ./.github/actions/configure_aws_artifacts_credentials with: release_type: ${{ inputs.release_type }} - name: Upload Package repo to S3 id: upload-packages run: | python ./build_tools/packaging/linux/upload_package_repo.py \ --pkg-type "${{ inputs.native_package_type }}" \ --run-id "${{ env.ARTIFACT_RUN_ID }}" \ --package-dir "${{ env.PACKAGE_DIST_DIR }}"