mirror of
https://github.com/NVIDIA/OpenShell.git
synced 2026-10-24 06:34:33 +08:00
97 lines
2.8 KiB
YAML
97 lines
2.8 KiB
YAML
name: Shadow CI Image
|
|
|
|
# OS-129 Phase 5: non-publishing CI image builds on supported shared CPU
|
|
# runners. This builds each architecture natively with the local Buildx driver
|
|
# instead of the EKS remote builder.
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "pull-request/[0-9]+"
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
CI_IMAGE: ghcr.io/nvidia/openshell/ci
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
pr_metadata:
|
|
name: Resolve PR metadata
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
pull-requests: read
|
|
outputs:
|
|
should_run: ${{ steps.gate.outputs.should_run }}
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- id: gate
|
|
uses: ./.github/actions/pr-gate
|
|
|
|
build-ci-image:
|
|
name: Build (${{ matrix.arch }})
|
|
needs: pr_metadata
|
|
if: needs.pr_metadata.outputs.should_run == 'true'
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- arch: amd64
|
|
platform: linux/amd64
|
|
runner: linux-amd64-cpu8
|
|
- arch: arm64
|
|
platform: linux/arm64
|
|
runner: linux-arm64-cpu8
|
|
runs-on: ${{ matrix.runner }}
|
|
timeout-minutes: 60
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Resolve BuildKit config
|
|
id: buildkit
|
|
run: |
|
|
if [[ -r /etc/buildkit/buildkitd.toml ]]; then
|
|
echo "config=/etc/buildkit/buildkitd.toml" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "config=" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: ./.github/actions/setup-buildx
|
|
with:
|
|
driver: local
|
|
buildkitd-config: ${{ steps.buildkit.outputs.config }}
|
|
|
|
- name: Build CI image
|
|
env:
|
|
MISE_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
SHADOW_IMAGE: ${{ env.CI_IMAGE }}:shadow-${{ github.sha }}-${{ matrix.arch }}
|
|
run: |
|
|
set -euo pipefail
|
|
docker buildx build \
|
|
--builder openshell \
|
|
--platform "${{ matrix.platform }}" \
|
|
--secret id=MISE_GITHUB_TOKEN,env=MISE_GITHUB_TOKEN \
|
|
--cache-from "type=gha,scope=ci-image-${{ matrix.arch }}" \
|
|
--cache-to "type=gha,mode=max,scope=ci-image-${{ matrix.arch }}" \
|
|
--load \
|
|
-t "$SHADOW_IMAGE" \
|
|
-f deploy/docker/Dockerfile.ci \
|
|
.
|
|
|
|
- name: Smoke check CI image
|
|
env:
|
|
SHADOW_IMAGE: ${{ env.CI_IMAGE }}:shadow-${{ github.sha }}-${{ matrix.arch }}
|
|
run: |
|
|
set -euo pipefail
|
|
docker run --rm --platform "${{ matrix.platform }}" "$SHADOW_IMAGE" mise --version
|
|
docker run --rm --platform "${{ matrix.platform }}" "$SHADOW_IMAGE" gh --version
|
|
docker run --rm --platform "${{ matrix.platform }}" "$SHADOW_IMAGE" docker buildx version
|