Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor github.actor to replace 'fixed' strings and add context checks of buildx for sequential compilation and partial failures scenario #1903

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,26 @@ jobs:
llvm_commit: ${{ steps.repo_info.outputs.llvm_commit }}
pybind11_commit: ${{ steps.repo_info.outputs.pybind11_commit }}
platform_config: ${{ steps.config.outputs.platforms }}
actor_lower: ${{ steps.set_actor_lower.outputs.actor_lower }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set GitHub Actor to Lowercase
id: set_actor_lower
run: |
actor_lower=$(echo '${{ github.actor }}' | tr '[:upper:]' '[:lower:]')
echo "actor_lower=$actor_lower"
echo "ACTOR_LOWER=$actor_lower" >> $GITHUB_ENV
echo "actor_lower=$actor_lower" >> $GITHUB_OUTPUT

- id: config
run: |
platforms="{}"
for platform_id in amd64 arm64; do
if [ "$platform_id" == "amd64" ]; then minimal_base_image=ghcr.io/nvidia/amd64/almalinux:8
elif [ "$platform_id" == "arm64" ]; then minimal_base_image=ghcr.io/nvidia/arm64v8/almalinux:8
if [ "$platform_id" == "amd64" ]; then minimal_base_image=ghcr.io/${ACTOR_LOWER}/amd64/almalinux:8
elif [ "$platform_id" == "arm64" ]; then minimal_base_image=ghcr.io/${ACTOR_LOWER}/arm64v8/almalinux:8
fi
platform={\"$platform_id\":{\"minimal_base_image\":\"$minimal_base_image\"}}
platforms=`echo $platforms | jq ". |= . + $platform"`
Expand Down Expand Up @@ -111,7 +120,7 @@ jobs:
dockerfile: build/devdeps.manylinux.Dockerfile
toolchain: gcc11
build_args: |
base_image=ghcr.io/nvidia/pypa/manylinux_2_28${{ (matrix.platform == 'arm64' && '_aarch64') || (matrix.platform == 'amd64' && '_x86_64') || '' }}:latest
base_image=ghcr.io/${{ needs.metadata.outputs.actor_lower }}/pypa/manylinux_2_28${{ (matrix.platform == 'arm64' && '_aarch64') || (matrix.platform == 'amd64' && '_x86_64') || '' }}:latest
distro=rhel8
llvm_commit=${{ needs.metadata.outputs.llvm_commit }}
pybind11_commit=${{ needs.metadata.outputs.pybind11_commit }}
Expand Down
18 changes: 15 additions & 3 deletions .github/workflows/create_cache_command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
outputs:
pull_request_number: ${{ steps.pr_info.outputs.pull_request_number }}
target_branch: ${{ steps.pr_info.outputs.target_branch }}
actor_lower: ${{ steps.set_actor_lower.outputs.actor_lower }}

steps:
- name: Download PR info
Expand All @@ -36,6 +37,15 @@ jobs:
echo "source_sha=$head_sha" >> $GITHUB_OUTPUT
echo "pull_request_number=$pr_nr" >> $GITHUB_OUTPUT

- name: Set GitHub Actor to Lowercase
id: set_actor_lower
run: |
actor_lower=$(echo "${{ github.actor }}" | tr '[:upper:]' '[:lower:]')
echo "actor_lower=$actor_lower"
echo "ACTOR_LOWER=$actor_lower" >> $GITHUB_ENV
echo "actor_lower=$actor_lower" >> $GITHUB_OUTPUT


- name: Add reaction
if: inputs.comment_id
uses: peter-evans/create-or-update-comment@v3
Expand Down Expand Up @@ -64,12 +74,14 @@ jobs:
with:
ref: "${{ format('refs/pull/{0}/merge', needs.pr_info.outputs.pull_request_number) }}"



- id: config
run: |
platforms="{}"
for platform_id in amd64 arm64; do
if [ "$platform_id" == "amd64" ]; then minimal_base_image=ghcr.io/nvidia/amd64/almalinux:8
elif [ "$platform_id" == "arm64" ]; then minimal_base_image=ghcr.io/nvidia/arm64v8/almalinux:8
if [ "$platform_id" == "amd64" ]; then minimal_base_image=ghcr.io/${{ needs.pr_info.outputs.actor_lower }}/amd64/almalinux:8
elif [ "$platform_id" == "arm64" ]; then minimal_base_image=ghcr.io/${{ needs.pr_info.outputs.actor_lower }}/arm64v8/almalinux:8
fi
platform={\"$platform_id\":{\"minimal_base_image\":\"$minimal_base_image\"}}
platforms=`echo $platforms | jq ". |= . + $platform"`
Expand Down Expand Up @@ -122,7 +134,7 @@ jobs:
dockerfile: build/devdeps.manylinux.Dockerfile
toolchain: gcc11
build_args: |
base_image=ghcr.io/nvidia/pypa/manylinux_2_28${{ (matrix.platform == 'arm64' && '_aarch64') || (matrix.platform == 'amd64' && '_x86_64') || '' }}:latest
base_image=ghcr.io/${{ needs.pr_info.outputs.actor_lower }}/pypa/manylinux_2_28${{ (matrix.platform == 'arm64' && '_aarch64') || (matrix.platform == 'amd64' && '_x86_64') || '' }}:latest
distro=rhel8
llvm_commit=${{ needs.metadata.outputs.llvm_commit }}
pybind11_commit=${{ needs.metadata.outputs.pybind11_commit }}
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/deployments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,17 @@ jobs:
multi_platform: ${{ steps.build_info.outputs.multi_platform }}
platforms: ${{ steps.build_info.outputs.platforms }}
environment: ${{ steps.build_info.outputs.environment }}
actor_lower: ${{ steps.set_actor_lower.outputs.actor_lower }}

steps:
- name: Set GitHub Actor to Lowercase
id: set_actor_lower
run: |
actor_lower=$(echo '${{ github.actor }}' | tr '[:upper:]' '[:lower:]')
echo "actor_lower=$actor_lower"
echo "ACTOR_LOWER=$actor_lower" >> $GITHUB_ENV
echo "actor_lower=$actor_lower" >> $GITHUB_OUTPUT

- name: Retrieve PR info
if: github.event_name == 'workflow_run'
id: pr_info
Expand Down Expand Up @@ -209,7 +218,7 @@ jobs:
dockerfile: build/devdeps.manylinux.Dockerfile
toolchain: gcc11
build_args: |
base_image=ghcr.io/nvidia/pypa/manylinux_2_28${{ (matrix.platform == 'arm64' && '_aarch64') || (matrix.platform == 'amd64' && '_x86_64') || '' }}:latest
base_image=ghcr.io/${{ needs.metadata.outputs.actor_lower }}/pypa/manylinux_2_28${{ (matrix.platform == 'arm64' && '_aarch64') || (matrix.platform == 'amd64' && '_x86_64') || '' }}:latest
distro=rhel8
llvm_commit=${{ needs.metadata.outputs.llvm_commit }}
pybind11_commit=${{ needs.metadata.outputs.pybind11_commit }}
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/dev_environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ jobs:
echo "runner=linux-amd64-cpu8" >> $GITHUB_OUTPUT
fi

repo_owner=${{ github.repository_owner }}
repo_owner=${{ github.actor }}
registry=${{ vars.registry || 'localhost:5000' }}
build_target=${{ inputs.build_target }}
image_id=`basename ${{ inputs.dockerfile }} .Dockerfile`${build_target:+.$build_target}
Expand Down Expand Up @@ -212,7 +212,12 @@ jobs:

- name: Set up context for buildx
run: |
docker context create builder_context
if ! docker context inspect builder_context > /dev/null 2>&1; then
echo "Context 'builder_context' does not exist. Creating it..."
docker context create builder_context
else
echo "Context 'builder_context' already exists. No need to create."
fi

- name: Set up buildx runner
uses: docker/setup-buildx-action@v3
Expand Down
33 changes: 29 additions & 4 deletions .github/workflows/docker_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
platform_tag: ${{ steps.info.outputs.platform_tag }}
build_docs: ${{ steps.info.outputs.build_docs }}
push_to_ngc: ${{ steps.info.outputs.push_to_ngc }}
actor_lower: ${{ steps.set_actor_lower.outputs.actor_lower }}

# Needed to define metadata depending on whether an environment secret is defined.
environment:
Expand Down Expand Up @@ -74,6 +75,15 @@ jobs:
echo "build_docs=${{ inputs.build_docs != 'false' }}" >> $GITHUB_OUTPUT
fi

- name: Set GitHub Actor to Lowercase
id: set_actor_lower
run: |
actor_lower=$(echo '${{ github.actor }}' | tr '[:upper:]' '[:lower:]')
echo "actor_lower=$actor_lower"
echo "ACTOR_LOWER=$actor_lower" >> $GITHUB_ENV
echo "actor_lower=$actor_lower" >> $GITHUB_OUTPUT


ompi_image:
name: open-mpi
needs: metadata
Expand Down Expand Up @@ -147,7 +157,12 @@ jobs:

- name: Set up context for buildx
run: |
docker context create builder_context
if ! docker context inspect builder_context > /dev/null 2>&1; then
echo "Context 'builder_context' does not exist. Creating it..."
docker context create builder_context
else
echo "Context 'builder_context' already exists. No need to create."
fi

- name: Set up buildx runner
uses: docker/setup-buildx-action@v3
Expand Down Expand Up @@ -284,7 +299,12 @@ jobs:

- name: Set up context for buildx
run: |
docker context create builder_context
if ! docker context inspect builder_context > /dev/null 2>&1; then
echo "Context 'builder_context' does not exist. Creating it..."
docker context create builder_context
else
echo "Context 'builder_context' already exists. No need to create."
fi

- name: Set up buildx runner
uses: docker/setup-buildx-action@v3
Expand Down Expand Up @@ -414,7 +434,7 @@ jobs:
id: prereqs
run: |
if ${{ needs.ompi_image.result == 'skipped' }}; then
base_image=ghcr.io/nvidia/ubuntu:22.04
base_image=ghcr.io/${{ needs.metadata.outputs.actor_lower }}/ubuntu:22.04
elif ${{ steps.restore_openmpi.outcome != 'skipped' }}; then
load_output=`docker load --input "${{ needs.ompi_image.outputs.tar_archive }}"`
base_image=`echo "$load_output" | grep -o 'Loaded image: \S*:\S*' | head -1 | cut -d ' ' -f 3`
Expand Down Expand Up @@ -485,7 +505,12 @@ jobs:

- name: Set up context for buildx
run: |
docker context create builder_context
if ! docker context inspect builder_context > /dev/null 2>&1; then
echo "Context 'builder_context' does not exist. Creating it..."
docker context create builder_context
else
echo "Context 'builder_context' already exists. No need to create."
fi

- name: Set up buildx runner
uses: docker/setup-buildx-action@v3
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/gh_registry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,12 @@ jobs:

- name: Set up context for buildx
run: |
docker context create builder_context
if ! docker context inspect builder_context > /dev/null 2>&1; then
echo "Context 'builder_context' does not exist. Creating it..."
docker context create builder_context
else
echo "Context 'builder_context' already exists. No need to create."
fi

- name: Set up buildx runner
uses: docker/setup-buildx-action@v3
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,12 @@ jobs:

- name: Set up context for buildx
run: |
docker context create builder_context
if ! docker context inspect builder_context > /dev/null 2>&1; then
echo "Context 'builder_context' does not exist. Creating it..."
docker context create builder_context
else
echo "Context 'builder_context' already exists. No need to create."
fi

- name: Set up buildx runner
uses: docker/setup-buildx-action@v3
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/prebuilt_binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,12 @@ jobs:

- name: Set up context for buildx
run: |
docker context create builder_context
if ! docker context inspect builder_context > /dev/null 2>&1; then
echo "Context 'builder_context' does not exist. Creating it..."
docker context create builder_context
else
echo "Context 'builder_context' already exists. No need to create."
fi

- name: Set up buildx runner
uses: docker/setup-buildx-action@v3
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/publishing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,12 @@ jobs:

- name: Set up context for buildx
run: |
docker context create builder_context
if ! docker context inspect builder_context > /dev/null 2>&1; then
echo "Context 'builder_context' does not exist. Creating it..."
docker context create builder_context
else
echo "Context 'builder_context' already exists. No need to create."
fi

- name: Set up buildx runner
uses: docker/setup-buildx-action@v3
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/python_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,12 @@ jobs:

- name: Set up context for buildx
run: |
docker context create builder_context
if ! docker context inspect builder_context > /dev/null 2>&1; then
echo "Context 'builder_context' does not exist. Creating it..."
docker context create builder_context
else
echo "Context 'builder_context' already exists. No need to create."
fi

- name: Set up buildx runner
uses: docker/setup-buildx-action@v3
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/test_in_devenv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ jobs:

- name: Set up context for buildx
run: |
docker context create builder_context
if ! docker context inspect builder_context > /dev/null 2>&1; then
echo "Context 'builder_context' does not exist. Creating it..."
docker context create builder_context
else
echo "Context 'builder_context' already exists. No need to create."
fi

- name: Set up buildx runner
uses: docker/setup-buildx-action@v3
Expand Down
Loading