# Copyright Advanced Micro Devices, Inc. # SPDX-License-Identifier: MIT name: Test Native Linux Packages Install on: workflow_call: inputs: package_install_url: description: "Package installation URL (includes architecture subdirectory for RPM)." required: true type: string release_type: description: "Release Type (ci, dev, nightly, prerelease)." required: true type: string gpg_key_url: description: "GPG key URL for signed repos" required: false type: string default: "" os_profile: description: OS profile (e.g., ubuntu2404, rhel8, rhel10, sles16). Package type (deb/rpm) is derived from this. required: true type: string artifact_group: description: Artifact group to extract GPU architecture from (e.g., gfx94X-dcgpu). Default gfx94X-dcgpu. required: false type: string default: "gfx94X-dcgpu" install_prefix: description: Installation prefix path (optional, defaults to /opt/rocm/core). required: false type: string default: "/opt/rocm/core" test_type: description: "Test type: quick, standard, comprehensive, full, install, or sanity. CI test types are mapped to native install test modes." required: false type: string default: "" 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 build_variant: description: "Build variant (e.g. 'asan'). Changes expected package names to match variant-suffixed packages." required: false type: string default: "" workflow_dispatch: inputs: package_install_url: description: "Package installation URL (includes architecture subdirectory for RPM)" required: true type: string release_type: description: 'Release type: "ci" or "dev"' required: true type: choice options: - ci - dev gpg_key_url: description: "GPG key URL for signed repos" type: string default: "" os_profile: description: OS profile (package type deb/rpm is derived from this). required: true type: choice options: - ubuntu2404 - rhel8 - rhel10 - sles16 artifact_group: description: Artifact group to extract GPU architecture from (e.g., gfx94X-dcgpu) type: string default: "gfx94X-dcgpu" install_prefix: description: Installation prefix path type: string default: "/opt/rocm/core" required: false test_type: description: "Test type: quick, standard, comprehensive, full, install, or sanity (optional; leave empty for sanity)" type: string default: "" 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 build_variant: description: "Build variant (e.g. 'asan'). Changes expected package names." type: string default: "" permissions: id-token: write contents: read run-name: Test - Native Linux packages Install (${{ inputs.os_profile }}) jobs: prepare_install_context: name: Prepare install context (package type, GPU arch, container image) runs-on: ubuntu-24.04 outputs: pkg_type: ${{ steps.derive.outputs.pkg_type }} gfx_arch: ${{ steps.derive.outputs.gfx_arch }} container_image: ${{ steps.derive.outputs.container_image }} steps: - name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: repository: ${{ inputs.repository || github.repository }} ref: ${{ inputs.ref || '' }} - name: Derive package type, GPU architecture, and container image id: derive run: | case "${{ inputs.os_profile }}" in ubuntu*|debian*) PKG_TYPE="deb" ;; *) PKG_TYPE="rpm" ;; esac echo "pkg_type=${PKG_TYPE}" >> $GITHUB_OUTPUT python build_tools/packaging/linux/get_url_repo_params.py extract-gfx-arch \ --artifact-group "${{ inputs.artifact_group }}" python build_tools/packaging/linux/get_url_repo_params.py get-container-image \ --os-profile "${{ inputs.os_profile }}" test_native_linux_packages_install: name: Test Native Linux Packages Installation - ${{ inputs.os_profile }} needs: [prepare_install_context] strategy: fail-fast: false runs-on: ${{ github.repository_owner == 'ROCm' && 'linux-gfx942-1gpu-ccs-csp-ossci-rocm' || 'ubuntu-24.04' }} container: image: ${{ needs.prepare_install_context.outputs.container_image }} options: --ipc host env: REPO_URL: ${{ inputs.package_install_url }} GPG_KEY_URL: ${{ inputs.gpg_key_url || '' }} OS_PROFILE: ${{ inputs.os_profile }} PKG_TYPE: ${{ needs.prepare_install_context.outputs.pkg_type }} RELEASE_TYPE: ${{ inputs.release_type }} GFX_ARCH: ${{ needs.prepare_install_context.outputs.gfx_arch }} INSTALL_PREFIX: ${{ inputs.install_prefix || '/opt/rocm/core' }} TEST_TYPE: ${{ inputs.test_type }} BUILD_VARIANT: ${{ inputs.build_variant }} steps: - name: Install System Prerequisites run: | echo "Installing prerequisites for ${{ env.PKG_TYPE }} on container" if [ "${{ env.PKG_TYPE }}" = "deb" ]; then sudo apt update sudo apt install -y \ wget \ curl \ ca-certificates \ gpg \ lsb-release if [ "$TEST_TYPE" = "full" ] || [ "$TEST_TYPE" = "comprehensive" ]; then echo "Extra OS packages for --test-type full/comprehensive (e.g. rdhc): pciutils, kmod, apt-utils" sudo apt install -y pciutils kmod apt-utils fi elif [[ "${{ inputs.os_profile }}" == sles* ]]; then # SLES prerequisites (uses BCI base - zypper) zypper refresh zypper install -y \ wget \ curl \ ca-certificates \ gpg2 \ lsb-release \ update-alternatives if [ "$TEST_TYPE" = "full" ] || [ "$TEST_TYPE" = "comprehensive" ]; then echo "Extra OS packages for --test-type full/comprehensive on SLES (e.g. rdhc): pciutils, kmod" zypper install -y pciutils kmod fi else # rpm (non-SLES on RHEL/UBI); --allowerasing for curl vs curl-minimal on UBI dnf install -y --allowerasing \ wget \ curl \ ca-certificates \ gnupg2 \ dnf-plugins-core if [ "$TEST_TYPE" = "full" ] || [ "$TEST_TYPE" = "comprehensive" ]; then echo "Extra OS packages for --test-type full/comprehensive (e.g. rdhc): pciutils, kmod" dnf install -y --allowerasing pciutils kmod fi fi - name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: repository: ${{ inputs.repository || github.repository }} ref: ${{ inputs.ref || '' }} - name: Setup Python and install runtime run: | bash build_tools/packaging/linux/setup_python_cmd.sh \ --os-profile "${{ inputs.os_profile }}" \ --install-runtime \ --output-format github - name: Install Python Dependencies run: | # Use venv for all distros for consistency and future-proofing (PEP 668) $PYTHON_CMD -m venv /tmp/test-venv /tmp/test-venv/bin/python -m pip install --upgrade pip /tmp/test-venv/bin/python -m pip install -r build_tools/packaging/linux/tests/requirements.txt echo "PYTHON_CMD=/tmp/test-venv/bin/python" >> $GITHUB_ENV - name: Package Installation Test run: | echo "TEST - OS:${{ inputs.os_profile }} REPO:${{ env.REPO_URL }} Arch:${{ env.GFX_ARCH }} Type:${{ env.RELEASE_TYPE }}" $PYTHON_CMD -m pytest build_tools/packaging/linux/native_linux_package_install_test.py -vv --tb=long -s