Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Postgres 17 #54

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
postgres: [14, 15, 16]
postgres: [14, 15, 16, 17]
runner:
- ubuntu-22.04
- buildjet-8vcpu-ubuntu-2204-arm
Expand All @@ -35,7 +35,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Install rust
uses: dtolnay/rust-toolchain@1.74.0
uses: dtolnay/rust-toolchain@1.81.0
with:
components: rustfmt, clippy
- name: Checkout
Expand All @@ -52,6 +52,6 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Install rust
uses: dtolnay/rust-toolchain@1.74.0
uses: dtolnay/rust-toolchain@1.81.0
- name: Lockfile check
run: cargo update -w --locked
61 changes: 22 additions & 39 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
strategy:
fail-fast: false
matrix:
postgres: [14, 15, 16]
postgres: [14, 15, 16, 17]
box:
- runner: ubuntu-22.04
arch: amd64
Expand All @@ -42,7 +42,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Install rust
uses: dtolnay/rust-toolchain@1.74.0
uses: dtolnay/rust-toolchain@1.81.0
- name: Install dependencies
run: |
# Add postgres package repo
Expand All @@ -60,61 +60,44 @@ jobs:
# Ensure installed pg_config is first on path
export PATH=$PATH:/usr/lib/postgresql/${{ matrix.postgres }}/bin

cargo install cargo-pgrx --version 0.11.2 --locked
cargo install cargo-pgrx --version 0.12.7 --locked
cargo pgrx init --pg${{ matrix.postgres }}=/usr/lib/postgresql/${{ matrix.postgres }}/bin/pg_config
- name: Build artifacts
run: |
# selects the pgVer from pg_config on path
# https://github.com/tcdi/pgrx/issues/288
cargo pgrx package --no-default-features --features pg${{ matrix.postgres }}

# Create installable package
mkdir archive
cp `find target/release -type f -name "${{ env.EXT_NAME }}*"` archive

# Copy files into directory structure
mkdir -p package/usr/lib/postgresql/lib
mkdir -p package/var/lib/postgresql/extension
cp archive/*.so package/usr/lib/postgresql/lib
cp archive/*.control package/var/lib/postgresql/extension
cp archive/*.sql package/var/lib/postgresql/extension

# symlinks to Copy files into directory structure
mkdir -p package/usr/lib/postgresql/${{ matrix.postgres }}/lib
cd package/usr/lib/postgresql/${{ matrix.postgres }}/lib
cp -s ../../lib/*.so .
cd ../../../../../..

mkdir -p package/usr/share/postgresql/${{ matrix.postgres }}/extension
cd package/usr/share/postgresql/${{ matrix.postgres }}/extension

cp -s ../../../../../var/lib/postgresql/extension/${{ env.EXT_NAME }}.control .
cp -s ../../../../../var/lib/postgresql/extension/${{ env.EXT_NAME }}*.sql .
cd ../../../../../..
- name: Package artifacts
run: |
package_path="target/release/${{ env.NAME }}-pg${{ matrix.postgres }}"

# Create install control file
extension_version=${{ github.ref_name }}
# strip the leading v
deb_version=${extension_version:1}
clean_version=${extension_version:1}

extension_path="${package_path}/usr/share/postgresql/${{ matrix.postgres }}/extension"
cp ${extension_path}/${{ env.NAME }}.control ${extension_path}/${{ env.EXT_NAME }}.control
cp ${extension_path}/${{ env.NAME }}--${clean_version}.sql ${extension_path}/${{ env.EXT_NAME }}--${clean_version}.sql

mkdir -p package/DEBIAN
touch package/DEBIAN/control
echo 'Package: ${{ env.PKG_NAME }}' >> package/DEBIAN/control
echo 'Version:' ${deb_version} >> package/DEBIAN/control
echo 'Architecture: ${{ matrix.box.arch }}' >> package/DEBIAN/control
echo 'Maintainer: Pavan Sunkara' >> package/DEBIAN/control
echo 'Description: A PostgreSQL extension for ULID' >> package/DEBIAN/control
mkdir -p ${package_path}/DEBIAN
touch ${package_path}/DEBIAN/control
echo 'Package: ${{ env.PKG_NAME }}' >> ${package_path}/DEBIAN/control
echo 'Version:' ${clean_version} >> ${package_path}/DEBIAN/control
echo 'Architecture: ${{ matrix.box.arch }}' >> ${package_path}/DEBIAN/control
echo 'Maintainer: Pavan Sunkara' >> ${package_path}/DEBIAN/control
echo 'Description: A PostgreSQL extension for ULID' >> ${package_path}/DEBIAN/control

# Create deb package
sudo chown -R root:root package
sudo chmod -R 00755 package
sudo dpkg-deb -Zxz --build --root-owner-group package
sudo chown -R root:root ${package_path}
sudo chmod -R 00755 ${package_path}
sudo dpkg-deb -Zxz --build --root-owner-group ${package_path}
- name: Upload artifacts
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./package.deb
asset_path: ./target/release/${{ env.NAME }}-pg${{ matrix.postgres }}.deb
asset_name: ${{ env.NAME }}-${{ github.ref_name }}-pg${{ matrix.postgres }}-${{ matrix.box.arch }}-linux-gnu.deb
asset_content_type: application/vnd.debian.binary-package
Loading