Compare commits
7 Commits
codex/fix-
...
parallelis
| Author | SHA1 | Date | |
|---|---|---|---|
| 7bbde892d1 | |||
| 95186bbb94 | |||
| 6adf479d39 | |||
| 741c029a1b | |||
| 97b30bc25e | |||
| f2b143220e | |||
| a67ff4e3e1 |
@@ -1,6 +1,21 @@
|
|||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- DISTRO_NAME: ubuntu-22-04
|
||||||
|
IMAGE: ubuntu:22.04
|
||||||
|
- DISTRO_NAME: ubuntu-24-04
|
||||||
|
IMAGE: ubuntu:24.04
|
||||||
|
- DISTRO_NAME: ubuntu-26-04
|
||||||
|
IMAGE: ubuntu:26.04
|
||||||
|
- DISTRO_NAME: debian-12
|
||||||
|
IMAGE: debian:12
|
||||||
|
- DISTRO_NAME: debian-13
|
||||||
|
IMAGE: debian:13
|
||||||
|
- DISTRO_NAME: debian-11
|
||||||
|
IMAGE: debian:11
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build-and-upload-debian-package
|
- name: build-and-upload-debian-package-${DISTRO_NAME}
|
||||||
image: ubuntu:24.04
|
image: ${IMAGE}
|
||||||
pull: true
|
pull: true
|
||||||
environment:
|
environment:
|
||||||
GITEA_PACKAGE_TOKEN:
|
GITEA_PACKAGE_TOKEN:
|
||||||
|
|||||||
@@ -2,15 +2,40 @@
|
|||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
source "$(cd "$(dirname "$0")/.." && pwd)/lib/common.sh"
|
||||||
|
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
printf 'Acquire::http::Proxy "http://cbrapt01.lan.cyber.gent:3142";";\n' >/etc/apt/apt.conf.d/80proxy
|
distribution_id="$(detect_debian_distribution_id)"
|
||||||
|
distribution_codename="$(detect_debian_distribution)"
|
||||||
|
refresh_package_indexes=false
|
||||||
|
|
||||||
|
log "Bootstrapping APT packages for $distribution_id:$distribution_codename"
|
||||||
|
|
||||||
|
printf 'Acquire::http::Proxy "http://cbrapt01.lan.cyber.gent:3142";\n' >/etc/apt/apt.conf.d/80proxy
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get upgrade -y
|
apt-get upgrade -y
|
||||||
apt-get install -y --no-install-recommends build-essential
|
apt-get install -y --no-install-recommends build-essential
|
||||||
|
|
||||||
|
case "$distribution_id" in
|
||||||
|
ubuntu)
|
||||||
apt-get install -y --no-install-recommends software-properties-common
|
apt-get install -y --no-install-recommends software-properties-common
|
||||||
|
if ! grep -RqsE '(^|[[:space:]])universe([[:space:]]|$)' /etc/apt/sources.list /etc/apt/sources.list.d 2>/dev/null; then
|
||||||
add-apt-repository -y universe
|
add-apt-repository -y universe
|
||||||
|
refresh_package_indexes=true
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
debian)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
die "Unsupported distribution ID: $distribution_id"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [[ "$refresh_package_indexes" == true ]]; then
|
||||||
apt-get update
|
apt-get update
|
||||||
|
fi
|
||||||
|
|
||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y --no-install-recommends \
|
||||||
autoconf \
|
autoconf \
|
||||||
automake \
|
automake \
|
||||||
@@ -27,6 +52,7 @@ apt-get install -y --no-install-recommends \
|
|||||||
libtool-bin \
|
libtool-bin \
|
||||||
m4 \
|
m4 \
|
||||||
ncat \
|
ncat \
|
||||||
|
regina-rexx \
|
||||||
reprepro \
|
reprepro \
|
||||||
sudo \
|
sudo \
|
||||||
time \
|
time \
|
||||||
|
|||||||
@@ -13,10 +13,7 @@ load_build_config
|
|||||||
work_root="$(ci_work_root)"
|
work_root="$(ci_work_root)"
|
||||||
helper_dir="$work_root/hercules-helper"
|
helper_dir="$work_root/hercules-helper"
|
||||||
artifacts_dir="$work_root/artifacts"
|
artifacts_dir="$work_root/artifacts"
|
||||||
helper_entrypoint="$helper_dir/create-package-hyperion.sh"
|
|
||||||
compat_template_dir="$helper_dir/packagers/debian/hyperion-4.4"
|
|
||||||
build_path="/home/bill/hyperion-build-package"
|
build_path="/home/bill/hyperion-build-package"
|
||||||
raw_package_path="$build_path/hyperion-4.4.deb"
|
|
||||||
metadata_file="$artifacts_dir/package.env"
|
metadata_file="$artifacts_dir/package.env"
|
||||||
|
|
||||||
log "Preparing CI work root at $work_root"
|
log "Preparing CI work root at $work_root"
|
||||||
@@ -26,11 +23,17 @@ mkdir -p "$artifacts_dir"
|
|||||||
log "Cloning helper repo $REPO (branch: $BRANCH)"
|
log "Cloning helper repo $REPO (branch: $BRANCH)"
|
||||||
git clone --depth 1 --branch "$BRANCH" "$REPO" "$helper_dir"
|
git clone --depth 1 --branch "$BRANCH" "$REPO" "$helper_dir"
|
||||||
|
|
||||||
if [[ ! -e "$helper_entrypoint" ]]; then
|
helper_entrypoint=""
|
||||||
ln -s "packagers/debian/create-package-hyperion.sh" "$helper_entrypoint"
|
if [[ -f "$helper_dir/packagers/debian/create-package-hyperion.sh" ]]; then
|
||||||
|
helper_entrypoint="$helper_dir/packagers/debian/create-package-hyperion.sh"
|
||||||
|
elif [[ -f "$helper_dir/create-package-hyperion.sh" ]]; then
|
||||||
|
helper_entrypoint="$helper_dir/create-package-hyperion.sh"
|
||||||
|
else
|
||||||
|
die "No Hyperion package entrypoint found in $helper_dir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -e "$compat_template_dir" ]]; then
|
compat_template_dir="$helper_dir/packagers/debian/hyperion-4.4"
|
||||||
|
if [[ -d "$helper_dir/packagers/debian/hercules-hyperion" ]] && [[ ! -e "$compat_template_dir" ]]; then
|
||||||
ln -s "hercules-hyperion" "$compat_template_dir"
|
ln -s "hercules-hyperion" "$compat_template_dir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -46,24 +49,49 @@ log "Invoking helper repo Debian package script"
|
|||||||
opt_beeps=false \
|
opt_beeps=false \
|
||||||
opt_verbose=true \
|
opt_verbose=true \
|
||||||
TRACE=false \
|
TRACE=false \
|
||||||
|
build_path="$build_path" \
|
||||||
|
OUTPUT_DIR="$artifacts_dir" \
|
||||||
bash "$helper_entrypoint"
|
bash "$helper_entrypoint"
|
||||||
)
|
)
|
||||||
|
|
||||||
[[ -f "$raw_package_path" ]] || die "Expected package was not created: $raw_package_path"
|
artifact_candidates=()
|
||||||
|
while IFS= read -r candidate; do
|
||||||
|
artifact_candidates+=("$candidate")
|
||||||
|
done < <(
|
||||||
|
find "$artifacts_dir" -maxdepth 1 -type f -name '*.deb' 2>/dev/null | sort
|
||||||
|
)
|
||||||
|
|
||||||
|
if (( ${#artifact_candidates[@]} == 0 )); then
|
||||||
|
while IFS= read -r candidate; do
|
||||||
|
artifact_candidates+=("$candidate")
|
||||||
|
done < <(
|
||||||
|
find "$build_path" -maxdepth 1 -type f -name '*.deb' 2>/dev/null | sort
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
|
||||||
|
(( ${#artifact_candidates[@]} > 0 )) || die "Expected package was not created under $artifacts_dir or $build_path"
|
||||||
|
|
||||||
|
raw_package_path="${artifact_candidates[0]}"
|
||||||
|
if (( ${#artifact_candidates[@]} > 1 )); then
|
||||||
|
raw_package_path="${artifact_candidates[-1]}"
|
||||||
|
fi
|
||||||
|
|
||||||
package_name="$(dpkg-deb -f "$raw_package_path" Package)"
|
package_name="$(dpkg-deb -f "$raw_package_path" Package)"
|
||||||
package_version="$(dpkg-deb -f "$raw_package_path" Version)"
|
package_version="$(dpkg-deb -f "$raw_package_path" Version)"
|
||||||
package_arch="$(dpkg-deb -f "$raw_package_path" Architecture)"
|
package_arch="$(dpkg-deb -f "$raw_package_path" Architecture)"
|
||||||
artifact_path="$artifacts_dir/${package_name}_${package_version}_${package_arch}.deb"
|
artifact_path="$artifacts_dir/${package_name}_${package_version}_${package_arch}.deb"
|
||||||
|
package_distribution="${DEBIAN_DISTRIBUTION:-$(detect_debian_distribution)}"
|
||||||
|
|
||||||
|
if [[ "$raw_package_path" != "$artifact_path" ]]; then
|
||||||
cp "$raw_package_path" "$artifact_path"
|
cp "$raw_package_path" "$artifact_path"
|
||||||
|
fi
|
||||||
|
|
||||||
cat >"$metadata_file" <<EOF
|
cat >"$metadata_file" <<EOF
|
||||||
PACKAGE_FILE=$artifact_path
|
PACKAGE_FILE=$artifact_path
|
||||||
PACKAGE_NAME=$package_name
|
PACKAGE_NAME=$package_name
|
||||||
PACKAGE_VERSION=$package_version
|
PACKAGE_VERSION=$package_version
|
||||||
PACKAGE_ARCHITECTURE=$package_arch
|
PACKAGE_ARCHITECTURE=$package_arch
|
||||||
PACKAGE_DISTRIBUTION=${DEBIAN_DISTRIBUTION:-$DEFAULT_DEBIAN_DISTRIBUTION}
|
PACKAGE_DISTRIBUTION=$package_distribution
|
||||||
PACKAGE_COMPONENT=${DEBIAN_COMPONENT:-$DEFAULT_DEBIAN_COMPONENT}
|
PACKAGE_COMPONENT=${DEBIAN_COMPONENT:-$DEFAULT_DEBIAN_COMPONENT}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|||||||
@@ -2,13 +2,6 @@
|
|||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
readonly REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
||||||
readonly BUILD_CONFIG_FILE="${BUILD_CONFIG_FILE:-$REPO_ROOT/build.config}"
|
|
||||||
readonly DEFAULT_GITEA_BASE_URL="https://git.cyber.gent"
|
|
||||||
readonly DEFAULT_DEBIAN_DISTRIBUTION="noble"
|
|
||||||
readonly DEFAULT_DEBIAN_COMPONENT="main"
|
|
||||||
readonly DEFAULT_CI_WORK_ROOT="$REPO_ROOT/.ci-work"
|
|
||||||
|
|
||||||
log() {
|
log() {
|
||||||
printf '[%s] %s\n' "$(basename "$0")" "$*"
|
printf '[%s] %s\n' "$(basename "$0")" "$*"
|
||||||
}
|
}
|
||||||
@@ -18,6 +11,88 @@ die() {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
detect_debian_distribution_id() {
|
||||||
|
local os_release="/etc/os-release"
|
||||||
|
local distro_id=""
|
||||||
|
local lsb_id=""
|
||||||
|
|
||||||
|
if [[ -r "$os_release" ]]; then
|
||||||
|
# shellcheck disable=SC1090
|
||||||
|
. "$os_release"
|
||||||
|
distro_id="${ID:-}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "$distro_id" ]]; then
|
||||||
|
case "$distro_id" in
|
||||||
|
ubuntu|debian)
|
||||||
|
printf '%s\n' "$distro_id"
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v lsb_release >/dev/null 2>&1; then
|
||||||
|
lsb_id="$(lsb_release -is | tr '[:upper:]' '[:lower:]')"
|
||||||
|
case "$lsb_id" in
|
||||||
|
ubuntu|debian)
|
||||||
|
printf '%s\n' "$lsb_id"
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
die "Unable to determine Debian/Ubuntu distribution ID from $os_release"
|
||||||
|
}
|
||||||
|
|
||||||
|
detect_debian_distribution() {
|
||||||
|
local os_release="/etc/os-release"
|
||||||
|
local distro_id=""
|
||||||
|
local version_codename=""
|
||||||
|
local ubuntu_codename=""
|
||||||
|
|
||||||
|
if [[ -r "$os_release" ]]; then
|
||||||
|
# shellcheck disable=SC1090
|
||||||
|
. "$os_release"
|
||||||
|
distro_id="${ID:-}"
|
||||||
|
version_codename="${VERSION_CODENAME:-}"
|
||||||
|
ubuntu_codename="${UBUNTU_CODENAME:-}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$distro_id" in
|
||||||
|
ubuntu)
|
||||||
|
if [[ -n "$ubuntu_codename" ]]; then
|
||||||
|
printf '%s\n' "$ubuntu_codename"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
debian)
|
||||||
|
if [[ -n "$version_codename" ]]; then
|
||||||
|
printf '%s\n' "$version_codename"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [[ -n "$version_codename" ]]; then
|
||||||
|
printf '%s\n' "$version_codename"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v lsb_release >/dev/null 2>&1; then
|
||||||
|
lsb_release -cs
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
die "Unable to determine Debian/Ubuntu distribution codename from $os_release"
|
||||||
|
}
|
||||||
|
|
||||||
|
readonly REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
||||||
|
readonly BUILD_CONFIG_FILE="${BUILD_CONFIG_FILE:-$REPO_ROOT/build.config}"
|
||||||
|
readonly DEFAULT_GITEA_BASE_URL="https://git.cyber.gent"
|
||||||
|
readonly DEFAULT_DEBIAN_DISTRIBUTION="$(detect_debian_distribution)"
|
||||||
|
readonly DEFAULT_DEBIAN_COMPONENT="main"
|
||||||
|
readonly DEFAULT_CI_WORK_ROOT="$REPO_ROOT/.ci-work"
|
||||||
|
|
||||||
require_cmd() {
|
require_cmd() {
|
||||||
command -v "$1" >/dev/null 2>&1 || die "Required command not found: $1"
|
command -v "$1" >/dev/null 2>&1 || die "Required command not found: $1"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user