Files
alpine-packages/packaging/alpine/local/gitea/scripts/test-install.sh
T
Joachim Schlöffel 7ec03eeada
Build Alpine Packages / build-and-publish (v3.23, 3.23) (pull_request) Successful in 28m12s
Build Alpine Packages / build-and-publish (v3.24, 3.24) (pull_request) Successful in 28m5s
Add Gitea 1.26.4 Alpine package
2026-07-08 15:11:06 +02:00

89 lines
3.0 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
repo_root="${REPO_ROOT:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../../.." && pwd)}"
package_name="${PACKAGE_NAME:-gitea}"
package_version="${PACKAGE_VERSION:-1.26.4-r0}"
alpine_version="${ALPINE_VERSION:-3.24}"
arch="${ALPINE_ARCH:-x86_64}"
repository_url="${ALPINE_REPOSITORY_URL:-}"
repository_key_url="${ALPINE_REPOSITORY_KEY_URL:-}"
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
exit 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
exit 1
fi
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 '
set -e
if [ -n "${ALPINE_REPOSITORY_URL}" ]; then
if [ -n "${ALPINE_REPOSITORY_KEY_URL}" ]; then
apk add --no-cache curl >/dev/null
cd /etc/apk/keys
curl -fsSLOJ "${ALPINE_REPOSITORY_KEY_URL}"
fi
printf "%s\n" "${ALPINE_REPOSITORY_URL}" >> /etc/apk/repositories
else
apk update
apk add "${PACKAGE_NAME}"
installed_before="$(apk list -I "${PACKAGE_NAME}" | awk "{print \$1}")"
printf "Installed repository package before local upgrade: %s\n" "${installed_before}"
if [ "${installed_before}" = "${PACKAGE_NAME}-${PACKAGE_VERSION}" ]; then
printf "default repository already has %s; upgrade path was not exercised\n" "${PACKAGE_VERSION}" >&2
exit 1
fi
cp "/repo/${ALPINE_ARCH}"/*.rsa.pub /etc/apk/keys/
printf "%s\n" /repo >> /etc/apk/repositories
fi
apk update
apk add --upgrade "${PACKAGE_NAME}" "${PACKAGE_NAME}-doc" "${PACKAGE_NAME}-openrc"
installed_after="$(apk list -I "${PACKAGE_NAME}" | awk "{print \$1}")"
printf "Installed package after local upgrade: %s\n" "${installed_after}"
test "${installed_after}" = "${PACKAGE_NAME}-${PACKAGE_VERSION}"
test -x /usr/bin/gitea
test -f /etc/gitea/app.ini
test -d /var/lib/gitea
test -d /var/lib/gitea/git
test -d /var/lib/gitea/data
test -d /var/lib/gitea/db
test -d /var/log/gitea
test -d /usr/share/webapps/gitea/options
test -d /usr/share/webapps/gitea/public
test -d /usr/share/webapps/gitea/templates
test -f /etc/init.d/gitea
gitea --version
rc-update add gitea default
test -L /etc/runlevels/default/gitea
'