diff --git a/.github/workflows/ubuntu-packages-and-docker-image.yml b/.github/workflows/ubuntu-packages-and-docker-image.yml index e64b5e30b..c77ba497d 100644 --- a/.github/workflows/ubuntu-packages-and-docker-image.yml +++ b/.github/workflows/ubuntu-packages-and-docker-image.yml @@ -13,7 +13,21 @@ jobs: strategy: fail-fast: false # Let the other job finish matrix: - os: ["buildjet-4vcpu-ubuntu-2204", "buildjet-8vcpu-ubuntu-2204-arm"] + include: + # Ubuntu 24.04 LTS (Noble) + - os: "ubuntu-24.04" + ubuntu_version: "noble" + arch: "amd64" + - os: "ubuntu-24.04-arm" + ubuntu_version: "noble" + arch: "arm64" + # Ubuntu 22.04 LTS (Jammy) + - os: "ubuntu-22.04" + ubuntu_version: "jammy" + arch: "amd64" + - os: "ubuntu-22.04-arm" + ubuntu_version: "jammy" + arch: "arm64" runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 @@ -78,14 +92,16 @@ jobs: postgresql-14 \ postgresql-13 \ postgresql-12 \ + postgresql-11 \ postgresql-server-dev-17 \ postgresql-server-dev-16 \ postgresql-server-dev-15 \ postgresql-server-dev-14 \ postgresql-server-dev-13 \ postgresql-server-dev-12 \ + postgresql-server-dev-11 \ lsb-release \ - python3.10 \ + python3.11 \ python3-pip \ libpython3.10-dev \ python3.10-dev \ @@ -94,6 +110,7 @@ jobs: curl -sLO https://github.com/deb-s3/deb-s3/releases/download/0.11.4/deb-s3-0.11.4.gem sudo gem install deb-s3-0.11.4.gem + sudo dpkg --configure -a dpkg-deb --version - name: Install pgrx uses: postgresml/gh-actions-cargo@master @@ -161,9 +178,23 @@ jobs: postgresml: needs: postgresml-pgml strategy: - fail-fast: false # Let the other job finish + fail-fast: false matrix: - os: ["ubuntu-22.04"] + include: + # Ubuntu 24.04 LTS (Noble) + - os: "ubuntu-24.04" + ubuntu_version: "noble" + arch: "amd64" + - os: "ubuntu-24.04-arm" + ubuntu_version: "noble" + arch: "arm64" + # Ubuntu 22.04 LTS (Jammy) + - os: "ubuntu-22.04" + ubuntu_version: "jammy" + arch: "amd64" + - os: "ubuntu-22.04-arm" + ubuntu_version: "jammy" + arch: "arm64" runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 @@ -180,15 +211,35 @@ jobs: # postgresml-dashboard: strategy: - fail-fast: false # Let the other job finish + fail-fast: false matrix: - os: ["ubuntu-22.04", "buildjet-4vcpu-ubuntu-2204-arm"] + include: + # Ubuntu 24.04 LTS (Noble) + - os: "ubuntu-24.04" + ubuntu_version: "noble" + arch: "amd64" + - os: "ubuntu-24.04-arm" + ubuntu_version: "noble" + arch: "arm64" + # Ubuntu 22.04 LTS (Jammy) + - os: "ubuntu-22.04" + ubuntu_version: "jammy" + arch: "amd64" + - os: "ubuntu-22.04-arm" + ubuntu_version: "jammy" + arch: "arm64" runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - uses: actions-rs/toolchain@v1 with: toolchain: stable + - name: Update dependencies + run: | + curl -sLO https://github.com/deb-s3/deb-s3/releases/download/0.11.4/deb-s3-0.11.4.gem + sudo gem install deb-s3-0.11.4.gem + sudo dpkg --configure -a + dpkg-deb --version - name: Build and release package env: AWS_ACCESS_KEY_ID: ${{ vars.AWS_ACCESS_KEY_ID }} @@ -208,7 +259,9 @@ jobs: strategy: fail-fast: false # Let the other job finish matrix: - os: ["buildjet-4vcpu-ubuntu-2204"] + include: + - os: "ubuntu-24.04" + ubuntu_version: "noble" runs-on: ${{ matrix.os }} defaults: run: diff --git a/.github/workflows/ubuntu-postgresml-python-package.yaml b/.github/workflows/ubuntu-postgresml-python-package.yaml index fc5eba6fc..04bf45192 100644 --- a/.github/workflows/ubuntu-postgresml-python-package.yaml +++ b/.github/workflows/ubuntu-postgresml-python-package.yaml @@ -4,17 +4,49 @@ on: workflow_dispatch: inputs: packageVersion: - default: "2.8.4" + default: "2.10.0" jobs: postgresml-python: strategy: fail-fast: false # Let the other job finish matrix: - os: ["buildjet-4vcpu-ubuntu-2204", "buildjet-4vcpu-ubuntu-2204-arm", "ubuntu-24.04"] + include: + # Ubuntu 24.04 LTS (Noble) + - os: "ubuntu-24.04" + ubuntu_version: "noble" + arch: "amd64" + - os: "ubuntu-24.04-arm" + ubuntu_version: "noble" + arch: "arm64" + # Ubuntu 22.04 LTS (Jammy) + - os: "ubuntu-22.04" + ubuntu_version: "jammy" + arch: "amd64" + - os: "ubuntu-22.04-arm" + ubuntu_version: "jammy" + arch: "arm64" runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 + - name: Install dependencies + env: + DEBIAN_FRONTEND: noninteractive + TZ: Etc/UTC + run: | + sudo apt-get install -y software-properties-common + sudo add-apt-repository ppa:apt-fast/stable --yes + sudo add-apt-repository ppa:deadsnakes/ppa --yes + sudo apt update + + sudo apt-get install -y apt-fast + sudo apt-get update && sudo apt-fast install -y \ + python3.11 \ + python3-pip \ + libpython3.11-dev \ + python3.11-dev + + sudo dpkg --configure -a - name: Build and release package env: AWS_ACCESS_KEY_ID: ${{ vars.AWS_ACCESS_KEY_ID }} diff --git a/packages/postgresml-dashboard/build.sh b/packages/postgresml-dashboard/build.sh index 7c28999ef..50ae4d99a 100644 --- a/packages/postgresml-dashboard/build.sh +++ b/packages/postgresml-dashboard/build.sh @@ -1,14 +1,15 @@ #!/bin/bash set -e -# Parse arguments -PACKAGE_VERSION=${1:-"2.10.0"} -UBUNTU_VERSION=${2:-"22.04"} +# Parse arguments with environment variable fallbacks +PACKAGE_VERSION=${1:-${PACKAGE_VERSION:-"2.10.0"}} +UBUNTU_VERSION=${2:-${ubuntu_version:-$(lsb_release -rs)}} +ARCH=${3:-${ARCH:-$(arch | sed 's/x86_64/amd64/; s/aarch64/arm64/')}} if [[ -z "$PACKAGE_VERSION" ]]; then echo "postgresml dashboard build script" - echo "Usage: $0 [ubuntu version]" - echo "Example: $0 2.10.0 22.04" + echo "Usage: $0 [ubuntu version] [arch]" + echo "Example: $0 2.10.0 22.04 amd64" exit 1 fi @@ -19,12 +20,16 @@ source_dir="$dir/source" export PACKAGE_VERSION export UBUNTU_VERSION -export GITHUB_STARS=$(curl -s "https://api.github.com/repos/postgresml/postgresml" | grep stargazers_count | cut -d : -f 2 | tr -d " " | tr -d ",") -if [[ $(arch) == "x86_64" ]]; then - export ARCH=amd64 -else - export ARCH=arm64 -fi +export ARCH + +# Fetch GitHub stars count with error handling +GITHUB_STARS=$(curl -s "https://api.github.com/repos/postgresml/postgresml" | grep stargazers_count | cut -d : -f 2 | tr -d " " | tr -d "," || echo "0") +export GITHUB_STARS + +echo "Building dashboard package:" +echo "- Version: ${PACKAGE_VERSION}" +echo "- Ubuntu: ${UBUNTU_VERSION}" +echo "- Architecture: ${ARCH}" rm -rf "$dir" mkdir -p "$deb_dir" @@ -33,7 +38,6 @@ cp -R ${SCRIPT_DIR}/* "$deb_dir" rm "$deb_dir/build.sh" rm "$deb_dir/release.sh" - ( cd ${SCRIPT_DIR}/../../pgml-dashboard && \ cargo build --release && \ cp target/release/pgml-dashboard "$deb_dir/usr/bin/pgml-dashboard" && \ diff --git a/packages/postgresml-dashboard/release.sh b/packages/postgresml-dashboard/release.sh index 0b5abf2a8..11a66e0f0 100644 --- a/packages/postgresml-dashboard/release.sh +++ b/packages/postgresml-dashboard/release.sh @@ -10,17 +10,38 @@ if [[ -z "$package_version" ]]; then exit 1 fi -# Active LTS Ubuntu versions and their codenames -declare -A ubuntu_versions=( - ["20.04"]="focal" - ["22.04"]="jammy" - ["24.04"]="noble" -) +# Set architecture based on system unless overridden by environment +if [[ -z "${ARCH}" ]]; then + if [[ $(arch) == "x86_64" ]]; then + export ARCH=amd64 + else + export ARCH=arm64 + fi +fi + +# Get Ubuntu version from environment or try to detect it +if [[ -z "${ubuntu_version}" ]]; then + ubuntu_version=$(lsb_release -rs) + echo "No ubuntu_version specified, detected: ${ubuntu_version}" +fi -# Supported architectures -declare -a architectures=("amd64" "arm64") +# Map version number to codename +case "${ubuntu_version}" in + "20.04") + export CODENAME="focal" + ;; + "22.04") + export CODENAME="jammy" + ;; + "24.04") + export CODENAME="noble" + ;; + *) + echo "Error: Unsupported Ubuntu version: ${ubuntu_version}" + exit 1 + ;; +esac -# Install deb-s3 if not present if ! which deb-s3; then curl -sLO https://github.com/deb-s3/deb-s3/releases/download/0.11.4/deb-s3-0.11.4.gem sudo gem install deb-s3-0.11.4.gem @@ -28,37 +49,25 @@ if ! which deb-s3; then fi function package_name() { - local ubuntu_version=$1 - local arch=$2 - echo "postgresml-dashboard-${package_version}-ubuntu${ubuntu_version}-${arch}.deb" + echo "postgresml-dashboard-${package_version}-ubuntu${ubuntu_version}-${ARCH}.deb" } -# Loop through Ubuntu versions -for ubuntu_version in "${!ubuntu_versions[@]}"; do - codename=${ubuntu_versions[$ubuntu_version]} - echo "Building packages for Ubuntu ${ubuntu_version} (${codename})" +echo "Building package for Ubuntu ${ubuntu_version} (${CODENAME}) ${ARCH}" - # Loop through architectures - for arch in "${architectures[@]}"; do - echo "Building for architecture: ${arch}" - export ARCH=${arch} +# Build the package +bash ${SCRIPT_DIR}/build.sh "$package_version" "$ubuntu_version" "$ARCH" - # Build the dashboard package - bash ${SCRIPT_DIR}/build.sh "$package_version" "$ubuntu_version" - - if [[ ! -f $(package_name ${ubuntu_version} ${arch}) ]]; then - echo "File $(package_name ${ubuntu_version} ${arch}) doesn't exist" - exit 1 - fi +if [[ ! -f $(package_name) ]]; then + echo "File $(package_name) doesn't exist" + exit 1 +fi - # Upload to S3 - deb-s3 upload \ - --lock \ - --bucket apt.postgresml.org \ - $(package_name ${ubuntu_version} ${arch}) \ - --codename ${codename} +# Upload to S3 +deb-s3 upload \ + --lock \ + --bucket apt.postgresml.org \ + $(package_name) \ + --codename ${CODENAME} - # Clean up the package file - rm $(package_name ${ubuntu_version} ${arch}) - done -done +# Clean up the package file +rm $(package_name) diff --git a/packages/postgresml-python/build.sh b/packages/postgresml-python/build.sh index b7f1167ce..2d3ad2fde 100644 --- a/packages/postgresml-python/build.sh +++ b/packages/postgresml-python/build.sh @@ -4,29 +4,25 @@ set -e SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) deb_dir="/tmp/postgresml-python/deb-build" -# Parse arguments with defaults -export PACKAGE_VERSION=${1:-"2.10.0"} -export UBUNTU_VERSION=${2:-"22.04"} -export PYTHON_VERSION=${3:-"3.10"} +# Parse arguments with environment variable fallbacks +export PACKAGE_VERSION=${1:-${PACKAGE_VERSION:-"2.10.0"}} +export UBUNTU_VERSION=${2:-${ubuntu_version:-$(lsb_release -rs)}} +export PYTHON_VERSION=${3:-${PYTHON_VERSION:-"3.10"}} -# Handle architecture -if [[ $(arch) == "x86_64" ]]; then - export ARCH=amd64 -else - export ARCH=arm64 +# Set architecture from environment or detect it +if [[ -z "${ARCH}" ]]; then + if [[ $(arch) == "x86_64" ]]; then + export ARCH=amd64 + else + export ARCH=arm64 + fi fi -# Map Ubuntu versions to Python versions if needed -# For example: Ubuntu 20.04 uses Python 3.8 by default -declare -A ubuntu_python_versions=( - ["20.04"]="3.8" - ["22.04"]="3.10" - ["24.04"]="3.11" -) - -if [[ -z "$3" ]]; then - PYTHON_VERSION=${ubuntu_python_versions[$UBUNTU_VERSION]:-"3.10"} -fi +echo "Building package:" +echo "- Package Version: ${PACKAGE_VERSION}" +echo "- Ubuntu Version: ${UBUNTU_VERSION}" +echo "- Python Version: ${PYTHON_VERSION}" +echo "- Architecture: ${ARCH}" rm -rf "$deb_dir" mkdir -p "$deb_dir" @@ -35,17 +31,30 @@ cp -R ${SCRIPT_DIR}/* "$deb_dir" rm "$deb_dir/build.sh" rm "$deb_dir/release.sh" +# Process template files (cat ${SCRIPT_DIR}/DEBIAN/control | envsubst '${PACKAGE_VERSION} ${UBUNTU_VERSION} ${ARCH} ${PYTHON_VERSION}') > "$deb_dir/DEBIAN/control" (cat ${SCRIPT_DIR}/DEBIAN/postinst | envsubst '${PGVERSION} ${PYTHON_VERSION}') > "$deb_dir/DEBIAN/postinst" (cat ${SCRIPT_DIR}/DEBIAN/prerm | envsubst '${PGVERSION} ${PYTHON_VERSION}') > "$deb_dir/DEBIAN/prerm" (cat ${SCRIPT_DIR}/DEBIAN/postrm | envsubst '${PGVERSION} ${PYTHON_VERSION}') > "$deb_dir/DEBIAN/postrm" -if [[ "$ARCH" == "amd64" ]]; then - cp ${SCRIPT_DIR}/../../pgml-extension/requirements.linux.txt "$deb_dir/etc/postgresml-python/requirements.txt" +# Select requirements file based on Ubuntu version and architecture +if [[ "${UBUNTU_VERSION}" == "20.04" ]]; then + # Frozen requirements are not longer available on Ubuntu 20.04 + cp ${SCRIPT_DIR}/../../pgml-extension/requirements.txt "$deb_dir/etc/postgresml-python/requirements.txt" + echo "Recomputing requirements.txt for Ubuntu 20.04" else - cp ${SCRIPT_DIR}/../../pgml-extension/requirements.macos.txt "$deb_dir/etc/postgresml-python/requirements.txt" + # Use frozen requirements for newer Ubuntu versions + if [[ "$ARCH" == "amd64" ]]; then + cp ${SCRIPT_DIR}/../../pgml-extension/requirements.linux.txt "$deb_dir/etc/postgresml-python/requirements.txt" + echo "Using frozen Linux requirements for Ubuntu ${UBUNTU_VERSION}" + else + cp ${SCRIPT_DIR}/../../pgml-extension/requirements.macos.txt "$deb_dir/etc/postgresml-python/requirements.txt" + echo "Using frozen macOS requirements for Ubuntu ${UBUNTU_VERSION}" + fi fi +# Create and populate virtualenv +echo "Creating Python virtual environment with Python ${PYTHON_VERSION}" virtualenv --python="python${PYTHON_VERSION}" "$deb_dir/var/lib/postgresml-python/pgml-venv" source "$deb_dir/var/lib/postgresml-python/pgml-venv/bin/activate" @@ -62,4 +71,4 @@ dpkg-deb \ --build "$deb_dir" \ "postgresml-python-${PACKAGE_VERSION}-ubuntu${UBUNTU_VERSION}-${ARCH}.deb" -rm -rf "$deb_dir" +rm -rf "$deb_dir" \ No newline at end of file diff --git a/packages/postgresml-python/release.sh b/packages/postgresml-python/release.sh index 3420b2628..8ccbb9e03 100644 --- a/packages/postgresml-python/release.sh +++ b/packages/postgresml-python/release.sh @@ -10,17 +10,41 @@ if [[ -z "$package_version" ]]; then exit 1 fi -# Active LTS Ubuntu versions and their codenames -declare -A ubuntu_versions=( - ["20.04"]="focal" - ["22.04"]="jammy" - ["24.04"]="noble" -) +# Set architecture based on system unless overridden by environment +if [[ -z "${ARCH}" ]]; then + if [[ $(arch) == "x86_64" ]]; then + export ARCH=amd64 + else + export ARCH=arm64 + fi +fi + +# Get Ubuntu version from environment or try to detect it +if [[ -z "${ubuntu_version}" ]]; then + ubuntu_version=$(lsb_release -rs) + echo "No ubuntu_version specified, detected: ${ubuntu_version}" +fi -# Supported architectures -declare -a architectures=("amd64" "arm64") +# Map version number to codename +case "${ubuntu_version}" in + "20.04") + export CODENAME="focal" + export PYTHON_VERSION="3.8" + ;; + "22.04") + export CODENAME="jammy" + export PYTHON_VERSION="3.10" + ;; + "24.04") + export CODENAME="noble" + export PYTHON_VERSION="3.11" + ;; + *) + echo "Error: Unsupported Ubuntu version: ${ubuntu_version}" + exit 1 + ;; +esac -# Install deb-s3 if not present if ! which deb-s3; then curl -sLO https://github.com/deb-s3/deb-s3/releases/download/0.11.4/deb-s3-0.11.4.gem sudo gem install deb-s3-0.11.4.gem @@ -31,37 +55,26 @@ fi sudo apt install python3-pip python3 python3-virtualenv -y function package_name() { - local ubuntu_version=$1 - local arch=$2 - echo "postgresml-python-${package_version}-ubuntu${ubuntu_version}-${arch}.deb" + echo "postgresml-python-${package_version}-ubuntu${ubuntu_version}-${ARCH}.deb" } -# Loop through Ubuntu versions -for ubuntu_version in "${!ubuntu_versions[@]}"; do - codename=${ubuntu_versions[$ubuntu_version]} - echo "Building packages for Ubuntu ${ubuntu_version} (${codename})" +echo "Building package for Ubuntu ${ubuntu_version} (${CODENAME}) ${ARCH}" +echo "Using Python version: ${PYTHON_VERSION}" - # Loop through architectures - for arch in "${architectures[@]}"; do - echo "Building for architecture: ${arch}" - export ARCH=${arch} +# Build the Python package +bash ${SCRIPT_DIR}/build.sh "$package_version" "$ubuntu_version" "$PYTHON_VERSION" - # Build the Python package - bash ${SCRIPT_DIR}/build.sh "$package_version" "$ubuntu_version" - - if [[ ! -f $(package_name ${ubuntu_version} ${arch}) ]]; then - echo "File $(package_name ${ubuntu_version} ${arch}) doesn't exist" - exit 1 - fi +if [[ ! -f $(package_name) ]]; then + echo "File $(package_name) doesn't exist" + exit 1 +fi - # Upload to S3 - deb-s3 upload \ - --lock \ - --bucket apt.postgresml.org \ - $(package_name ${ubuntu_version} ${arch}) \ - --codename ${codename} +# Upload to S3 +deb-s3 upload \ + --lock \ + --bucket apt.postgresml.org \ + $(package_name) \ + --codename ${CODENAME} - # Clean up the package file - rm $(package_name ${ubuntu_version} ${arch}) - done -done +# Clean up the package file +rm $(package_name) diff --git a/packages/postgresml/build.sh b/packages/postgresml/build.sh index 4e0f224ba..92c7aa50d 100644 --- a/packages/postgresml/build.sh +++ b/packages/postgresml/build.sh @@ -3,9 +3,15 @@ set -e SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -export PACKAGE_VERSION=${1:-"2.10.0"} -export PGVERSION=${2:-"17"} -export UBUNTU_VERSION=${3:-"24.04"} +# Parse arguments with environment variable fallbacks +export PACKAGE_VERSION=${1:-${PACKAGE_VERSION:-"2.10.0"}} +export PGVERSION=${2:-${PGVERSION:-"17"}} +export UBUNTU_VERSION=${3:-${ubuntu_version:-$(lsb_release -rs)}} + +echo "Building package:" +echo "- Package Version: ${PACKAGE_VERSION}" +echo "- PostgreSQL Version: ${PGVERSION}" +echo "- Ubuntu Version: ${UBUNTU_VERSION}" deb_dir="/tmp/postgresml/deb-build" @@ -27,4 +33,4 @@ dpkg-deb \ --root-owner-group \ -z1 \ --build "$deb_dir" \ - postgresml-${PGVERSION}-${PACKAGE_VERSION}-ubuntu${UBUNTU_VERSION}-all.deb + "postgresml-${PGVERSION}-${PACKAGE_VERSION}-ubuntu${UBUNTU_VERSION}-all.deb" diff --git a/packages/postgresml/release.sh b/packages/postgresml/release.sh index 054d18d9b..0136ef1a0 100644 --- a/packages/postgresml/release.sh +++ b/packages/postgresml/release.sh @@ -10,6 +10,29 @@ if [[ -z "$package_version" ]]; then exit 1 fi +# Get Ubuntu version from environment or try to detect it +if [[ -z "${ubuntu_version}" ]]; then + ubuntu_version=$(lsb_release -rs) + echo "No ubuntu_version specified, detected: ${ubuntu_version}" +fi + +# Map version number to codename +case "${ubuntu_version}" in + "20.04") + export CODENAME="focal" + ;; + "22.04") + export CODENAME="jammy" + ;; + "24.04") + export CODENAME="noble" + ;; + *) + echo "Error: Unsupported Ubuntu version: ${ubuntu_version}" + exit 1 + ;; +esac + if ! which deb-s3; then curl -sLO https://github.com/deb-s3/deb-s3/releases/download/0.11.4/deb-s3-0.11.4.gem sudo gem install deb-s3-0.11.4.gem @@ -18,39 +41,26 @@ fi function package_name() { local pg_version=$1 - local ubuntu_version=$2 echo "postgresml-${pg_version}-${package_version}-ubuntu${ubuntu_version}-all.deb" } -# Active LTS Ubuntu versions -ubuntu_versions=("20.04" "22.04" "24.04") - -# Map Ubuntu versions to codenames -declare -A ubuntu_codenames=( - ["20.04"]="focal" - ["22.04"]="jammy" - ["24.04"]="noble" -) - -for ubuntu_version in "${ubuntu_versions[@]}"; do - codename=${ubuntu_codenames[$ubuntu_version]} - echo "Building packages for Ubuntu ${ubuntu_version} (${codename})" - - for pg in {11..17}; do - echo "Building PostgreSQL ${pg} package..." - bash ${SCRIPT_DIR}/build.sh ${package_version} ${pg} ${ubuntu_version} - - if [[ ! -f $(package_name ${pg} ${ubuntu_version}) ]]; then - echo "File $(package_name ${pg} ${ubuntu_version}) doesn't exist" - exit 1 - fi - - deb-s3 upload \ - --lock \ - --bucket apt.postgresml.org \ - $(package_name ${pg} ${ubuntu_version}) \ - --codename ${codename} - - rm $(package_name ${pg} ${ubuntu_version}) - done +echo "Building packages for Ubuntu ${ubuntu_version} (${CODENAME})" + +# Loop through PostgreSQL versions +for pg in {12..17}; do + echo "Building PostgreSQL ${pg} package..." + bash ${SCRIPT_DIR}/build.sh ${package_version} ${pg} ${ubuntu_version} + + if [[ ! -f $(package_name ${pg}) ]]; then + echo "File $(package_name ${pg}) doesn't exist" + exit 1 + fi + + deb-s3 upload \ + --lock \ + --bucket apt.postgresml.org \ + $(package_name ${pg}) \ + --codename ${CODENAME} + + rm $(package_name ${pg}) done diff --git a/packages/postgresql-pgml/release.sh b/packages/postgresql-pgml/release.sh index 28d760c92..2a13cd18d 100644 --- a/packages/postgresql-pgml/release.sh +++ b/packages/postgresql-pgml/release.sh @@ -8,19 +8,40 @@ if [[ -z "${1}" ]]; then exit 1 fi +# Set architecture based on system unless overridden by environment +if [[ -z "${ARCH}" ]]; then + if [[ $(arch) == "x86_64" ]]; then + export ARCH=amd64 + else + export ARCH=arm64 + fi +fi + export PACKAGE_VERSION=${1} -# Active LTS Ubuntu versions and their codenames -declare -A ubuntu_versions=( - ["20.04"]="focal" - ["22.04"]="jammy" - ["24.04"]="noble" -) +# Get Ubuntu version from environment or try to detect it +if [[ -z "${ubuntu_version}" ]]; then + ubuntu_version=$(lsb_release -rs) + echo "No ubuntu_version specified, detected: ${ubuntu_version}" +fi -# Supported architectures -declare -a architectures=("amd64" "arm64") +# Map version number to codename +case "${ubuntu_version}" in + "20.04") + export CODENAME="focal" + ;; + "22.04") + export CODENAME="jammy" + ;; + "24.04") + export CODENAME="noble" + ;; + *) + echo "Error: Unsupported Ubuntu version: ${ubuntu_version}" + exit 1 + ;; +esac -# Install deb-s3 if not present if ! which deb-s3; then curl -sLO https://github.com/deb-s3/deb-s3/releases/download/0.11.4/deb-s3-0.11.4.gem sudo gem install deb-s3-0.11.4.gem @@ -31,49 +52,37 @@ extension_dir="${SCRIPT_DIR}/../../pgml-extension" function package_name() { local pg_version=$1 - local ubuntu_version=$2 - local arch=$3 - echo "postgresql-pgml-${pg_version}_${PACKAGE_VERSION}-ubuntu${ubuntu_version}-${arch}.deb" + echo "postgresql-pgml-${pg_version}_${PACKAGE_VERSION}-ubuntu${ubuntu_version}-${ARCH}.deb" } -# Loop through Ubuntu versions -for ubuntu_version in "${!ubuntu_versions[@]}"; do - codename=${ubuntu_versions[$ubuntu_version]} - echo "Building packages for Ubuntu ${ubuntu_version} (${codename})" - - # Loop through architectures - for arch in "${architectures[@]}"; do - echo "Building for architecture: ${arch}" - export ARCH=${arch} - - # Loop through PostgreSQL versions - for pg in {11..17}; do - echo "Building PostgreSQL ${pg} package..." - - release_dir="$extension_dir/target/release/pgml-pg${pg}" - mkdir -p "$release_dir/DEBIAN" - - export PGVERSION=${pg} - # Update control file with Ubuntu version - (cat ${SCRIPT_DIR}/DEBIAN/control | - envsubst '${PGVERSION} ${PACKAGE_VERSION} ${ARCH}') > "$release_dir/DEBIAN/control" - - # Build the package - dpkg-deb \ - --root-owner-group \ - -z1 \ - --build "$release_dir" \ - $(package_name ${pg} ${ubuntu_version} ${arch}) - - # Upload to S3 - deb-s3 upload \ - --lock \ - --bucket apt.postgresml.org \ - $(package_name ${pg} ${ubuntu_version} ${arch}) \ - --codename ${codename} - - # Clean up the package file - rm $(package_name ${pg} ${ubuntu_version} ${arch}) - done - done +echo "Building packages for Ubuntu ${ubuntu_version} (${CODENAME}) ${ARCH}" + +# Loop through PostgreSQL versions +for pg in {12..17}; do + echo "Building PostgreSQL ${pg} package..." + + release_dir="$extension_dir/target/release/pgml-pg${pg}" + mkdir -p "$release_dir/DEBIAN" + + export PGVERSION=${pg} + # Update control file with Ubuntu version + (cat ${SCRIPT_DIR}/DEBIAN/control | + envsubst '${PGVERSION} ${PACKAGE_VERSION} ${ARCH}') > "$release_dir/DEBIAN/control" + + # Build the package + dpkg-deb \ + --root-owner-group \ + -z1 \ + --build "$release_dir" \ + $(package_name ${pg}) + + # Upload to S3 + deb-s3 upload \ + --lock \ + --bucket apt.postgresml.org \ + $(package_name ${pg}) \ + --codename ${CODENAME} + + # Clean up the package file + rm $(package_name ${pg}) done pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy