Optimize Alpine packaging workflow
Build Alpine Packages / build-and-publish (v3.24, 3.24) (push) Successful in 2h16m43s
Build Alpine Packages / build-and-publish (v3.24, 3.24) (push) Successful in 2h16m43s
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
apk_test_install_run() {
|
||||
local repo_root="$1"
|
||||
local package_name="$2"
|
||||
local package_version="$3"
|
||||
local alpine_version="${ALPINE_VERSION:-3.24}"
|
||||
local arch="${ALPINE_ARCH:-x86_64}"
|
||||
local repository_url="${ALPINE_REPOSITORY_URL:-}"
|
||||
local repository_key_url="${ALPINE_REPOSITORY_KEY_URL:-}"
|
||||
local platform
|
||||
local test_command
|
||||
|
||||
case "${arch}" in
|
||||
x86_64) platform="${ALPINE_TEST_PLATFORM:-linux/amd64}" ;;
|
||||
aarch64) platform="${ALPINE_TEST_PLATFORM:-linux/arm64}" ;;
|
||||
*)
|
||||
printf 'unsupported Alpine architecture: %s\n' "${arch}" >&2
|
||||
return 2
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ -z "${repository_url}" && "${SKIP_BUILD:-0}" != "1" ]]; then
|
||||
ALPINE_PACKAGE="${package_name}" "${repo_root}/scripts/apk/build.sh" build "${arch}"
|
||||
fi
|
||||
|
||||
if [[ -z "${repository_url}" && ! -d "${repo_root}/packages/local/${arch}" ]]; then
|
||||
printf 'missing local repository: packages/local/%s\n' "${arch}" >&2
|
||||
printf 'run: ALPINE_PACKAGE=%s mise run apk:build\n' "${package_name}" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
test_command="$(cat)"
|
||||
docker run --rm --platform "${platform}" \
|
||||
-e "ALPINE_ARCH=${arch}" \
|
||||
-e "PACKAGE_NAME=${package_name}" \
|
||||
-e "PACKAGE_VERSION=${package_version}" \
|
||||
-e "ALPINE_REPOSITORY_URL=${repository_url}" \
|
||||
-e "ALPINE_REPOSITORY_KEY_URL=${repository_key_url}" \
|
||||
-v "${repo_root}/packages/local:/repo:ro" \
|
||||
"alpine:${alpine_version}" \
|
||||
sh -lc "${test_command}"
|
||||
}
|
||||
Reference in New Issue
Block a user