Files
TheRock/compiler/amd-llvm/.github/actions/build-container/action.yml
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

96 lines
2.8 KiB
YAML

name: Build Container
description: >-
Build and test a container using the standard llvm naming scheme for containers.
inputs:
tag:
description: >-
The tag to use for this container.
required: false
container-name:
description: >-
The name for the container.
required: true
dockerfile:
description: >-
Path to docker file.
required: false
target:
description: >-
The container target to build 'passed to podman via ---target option'
required: false
context:
description: >-
Path to context for the container build.
required: false
test-command:
description: >-
Test command to run to ensure the container is working correctly.
required: false
runs:
using: "composite"
steps:
# podman is not installed by default on the ARM64 images.
- name: Install Podman
if: runner.arch == 'ARM64'
shell: bash
run: |
sudo apt-get install podman
- name: Build Container
shell: bash
env:
INPUT_TAG: ${{inputs.tag }}
INPUT_CONTAINER_NAME: ${{ inputs.container-name }}
INPUT_TARGET: ${{ inputs.target }}
INPUT_DOCKERFILE: ${{ inputs.dockerfile }}
INPUT_CONTEXT: ${{ inputs.context }}
id: build
run: |
env
tag="${INPUT_TAG:-$(git rev-parse --short=12 HEAD)}"
case "$RUNNER_ARCH" in
ARM64)
container_arch="arm64v8"
;;
*)
container_arch="amd64"
;;
esac
container_name="ghcr.io/$GITHUB_REPOSITORY_OWNER/$container_arch/$INPUT_CONTAINER_NAME:$tag"
container_filename="$(echo $container_name | sed -e 's/\//-/g' -e 's/:/-/g').tar"
if [ -n "$INPUT_TARGET" ]; then
podman_options="$podman_options --target $INPUT_TARGET"
fi
if [ -n "$INPUT_DOCKERFILE" ]; then
podman_options="$podman_options -f $INPUT_DOCKERFILE"
fi
podman_options="$podman_options ${INPUT_CONTEXT:-.}"
echo "Podman Options: $podman_options"
podman build -t $container_name $podman_options
podman save $container_name > $container_filename
echo "container-full-name=$container_name" >> $GITHUB_OUTPUT
- name: Create container artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ inputs.container-name }}-${{ runner.arch }}
path: "*.tar"
retention-days: 14
- name: Test container
shell: bash
if: inputs.test-command
env:
INPUT_TEST_COMMAND: ${{ inputs.test-command }}
CONTAINER_FULL_NAME: ${{ steps.build.outputs.container-full-name }}
run: |
podman run --pull=never --rm -it $CONTAINER_FULL_NAME /usr/bin/bash -x -c "$INPUT_TEST_COMMAND"