Allow selecting architecture for build workflow. (#13113)

Signed-off-by: Satadru Pramanik <satadru@gmail.com>
This commit is contained in:
Satadru Pramanik, DO, MPH, MEng
2025-10-10 21:53:16 -04:00
committed by GitHub
parent 3d1b946e6d
commit 6ac9bc0a43
2 changed files with 67 additions and 4 deletions

View File

@@ -32,6 +32,21 @@ on:
pr_label:
description: "PR Label"
required: false
build-on-i686:
description: "Build on i686"
default: true
type: boolean
required: false
build-on-x86_64:
description: "Build on x86_64"
default: true
type: boolean
required: false
build-on-armv7l:
description: "Build on armv7l"
default: true
type: boolean
required: false
env:
BRANCH: ${{ inputs.branch || github.ref_name }}
permissions:
@@ -68,6 +83,7 @@ jobs:
i686_packages: ${{ steps.get-compatibility.outputs.i686_PACKAGES }}
x86_64_packages: ${{ steps.get-compatibility.outputs.x86_64_PACKAGES }}
armv7l_packages: ${{ steps.get-compatibility.outputs.armv7l_PACKAGES }}
matrix: ${{ steps.set-generate-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v5
with:
@@ -159,10 +175,26 @@ jobs:
echo "i686_PACKAGES=${i686_PACKAGES}" >> "$GITHUB_OUTPUT"
echo "Branch ${{ inputs.branch || github.ref_name }} has these i686 compatible packages: ${i686_PACKAGES}"
fi
- name: Create Generate Matrix
id: set-generate-matrix
env:
i686_PACKAGES: ${{ steps.get-compatibility.outputs.i686_PACKAGES }}
x86_64_PACKAGES: ${{ steps.get-compatibility.outputs.x86_64_PACKAGES }}
armv7l_PACKAGES: ${{ steps.get-compatibility.outputs.armv7l_PACKAGES }}
run: |
function join_by { local IFS="$1"; shift; echo "$*"; }
[[ "${{ ( inputs.build-on-i686) }}" == 'true' ]] && [[ -n "${i686_PACKAGES}" ]] && export CONTAINER_ARCH+=( "\"i686\"" )
[[ "${{ ( inputs.build-on-x86_64) }}" == 'true' ]] && [[ -n "${x86_64_PACKAGES}" ]] && export CONTAINER_ARCH+=( "\"x86_64\"" )
[[ "${{ ( inputs.build-on-armv7l) }}" == 'true' ]] && [[ -n "${armv7l_PACKAGES}" ]] && export CONTAINER_ARCH+=( "\"armv7l\"" )
export ARCHES="$(join_by , "${CONTAINER_ARCH[@]}")"
echo "matrix=[${ARCHES}]" >> $GITHUB_OUTPUT
echo "matrix=[${ARCHES}]"
generate:
needs: setup
strategy:
fail-fast: false
matrix:
arch: [i686, x86_64, armv7l]
arch: ${{ fromJSON(needs.setup.outputs.matrix) }}
runner:
- ubuntu-24.04
- ubuntu-24.04-arm
@@ -174,7 +206,6 @@ jobs:
- arch: armv7l
runner: ubuntu-24.04
runs-on: ${{ matrix.runner }}
needs: setup
env:
CREW_BUILD_NO_PACKAGE_FILE_HASH_UPDATES: 1
CREW_REPO: ${{ github.event.repository.clone_url }}
@@ -285,6 +316,13 @@ jobs:
mkdir pkg_cache
sudo setfacl -R -m u:1000:rwx .
# See https://github.com/containerd/containerd/pull/7566#issuecomment-1461134737 for why we set ulimit.
if [ -z ${CI+x} ]; then
echo "CI is not set."
else
CI_PASSTHROUGH=-e
CI_PASSTHROUGH+=" "
CI_PASSTHROUGH+=NESTED_CI=${CI}
fi
docker run \
--rm \
--platform "${PLATFORM}" \
@@ -297,6 +335,7 @@ jobs:
-e CREW_BRANCH="${{ inputs.branch || github.ref_name }}" \
-e GITLAB_TOKEN="${{ secrets.GITLAB_TOKEN }}" \
-e GITLAB_TOKEN_USERNAME="${{ secrets.GITLAB_TOKEN_USERNAME }}" \
${CI_PASSTHROUGH} \
-v "$(pwd)"/pkg_cache:/usr/local/tmp/packages:rshared \
-v "$(pwd)":/output:rshared \
--tmpfs /tmp \

View File

@@ -63,6 +63,7 @@ jobs:
i686_packages: ${{ steps.get-compatibility.outputs.i686_PACKAGES }}
x86_64_packages: ${{ steps.get-compatibility.outputs.x86_64_PACKAGES }}
armv7l_packages: ${{ steps.get-compatibility.outputs.armv7l_PACKAGES }}
matrix: ${{ steps.set-generate-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v5
with:
@@ -158,11 +159,26 @@ jobs:
echo "i686_PACKAGES=${i686_PACKAGES}" >> "$GITHUB_OUTPUT"
echo "Branch ${{ inputs.branch || github.ref_name }} has these i686 compatible packages: ${i686_PACKAGES}"
fi
- name: Create Generate Matrix
id: set-generate-matrix
env:
i686_PACKAGES: ${{ steps.get-compatibility.outputs.i686_PACKAGES }}
x86_64_PACKAGES: ${{ steps.get-compatibility.outputs.x86_64_PACKAGES }}
armv7l_PACKAGES: ${{ steps.get-compatibility.outputs.armv7l_PACKAGES }}
run: |
function join_by { local IFS="$1"; shift; echo "$*"; }
[[ -n "${i686_PACKAGES}" ]] && export CONTAINER_ARCH+=( "\"i686\"" )
# Always run workflow on the x86_64 container as a fallback.
export CONTAINER_ARCH+=( "\"x86_64\"" )
[[ -n "${armv7l_PACKAGES}" ]] && export CONTAINER_ARCH+=( "\"armv7l\"" )
export ARCHES="$(join_by , "${CONTAINER_ARCH[@]}")"
echo "matrix=[${ARCHES}]" >> $GITHUB_OUTPUT
echo "matrix=[${ARCHES}]"
update-package-files:
strategy:
max-parallel: 1
matrix:
arch: [i686, x86_64, armv7l]
arch: ${{ fromJSON(needs.setup.outputs.matrix) }}
runner:
- ubuntu-24.04
- ubuntu-24.04-arm
@@ -288,6 +304,13 @@ jobs:
mkdir pkg_cache
sudo setfacl -R -m u:1000:rwx .
# See https://github.com/containerd/containerd/pull/7566#issuecomment-1461134737 for why we set ulimit.
if [ -z ${CI+x} ]; then
echo "CI is not set."
else
CI_PASSTHROUGH=-e
CI_PASSTHROUGH+=" "
CI_PASSTHROUGH+=NESTED_CI=${CI}
fi
docker run \
--rm \
--platform "${PLATFORM}" \
@@ -300,6 +323,7 @@ jobs:
-e CREW_BRANCH="${{ inputs.branch || github.ref_name }}" \
-e GITLAB_TOKEN="${{ secrets.GITLAB_TOKEN }}" \
-e GITLAB_TOKEN_USERNAME="${{ secrets.GITLAB_TOKEN_USERNAME }}" \
${CI_PASSTHROUGH} \
-v "$(pwd)"/pkg_cache:/usr/local/tmp/packages:rshared \
-v "$(pwd)":/output:rshared \
--tmpfs /tmp \
@@ -412,7 +436,7 @@ jobs:
x86_64_PACKAGES: ${{ needs.setup.outputs.x86_64_packages }}
armv7l_PACKAGES: ${{ needs.setup.outputs.armv7l_packages }}
run: |
sudo gem install ptools
sudo gem install -N ptools --conservative
function join_by { local IFS="$1"; shift; echo "$*"; }
rm -rf /tmp/pr.txt
echo -e "## Description" >> /tmp/pr.txt