Skip to content

pg_search v0.13.1 #1417

pg_search v0.13.1

pg_search v0.13.1 #1417

Workflow file for this run

name: Build, install and publish extensions
on:
push:
branches:
- "main"
paths:
- "contrib/**"
pull_request:
branches:
- "main"
paths:
- "contrib/**"
jobs:
find_directories:
name: 🔍 Find changed extensions
runs-on: ubuntu-20.04
outputs:
directories: ${{ steps.find_directories.outputs.build_matrix }}
steps:
- name: Check out the repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Find commit to compare with
id: versions
run: |
set -xe
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
# On main branch, the diff should compare to the previous commit hash.
# On PR, the diff should compare with main branch.
if [ "${BRANCH_NAME}" == "main" ]; then
changed_relative_to_ref=$(git show --quiet HEAD^1 | grep commit | cut -d" " -f2)
else
changed_relative_to_ref="origin/${{ github.base_ref || 'not-a-branch' }}"
fi
echo "changed_relative_to_ref=${changed_relative_to_ref}" >> $GITHUB_OUTPUT
- name: Check out the coredb repo to reuse some actions
uses: actions/checkout@v4
with:
repository: tembo-io/tembo
path: ./.tembo
ref: 21a43bbd64936b6b7fe7b080c2bfbd82df31fe2c
- name: Find directories with Dockerfiles that changed
id: find_directories
uses: ./.tembo/.github/actions/find-changed-directories
with:
contains_the_file: Trunk.toml
changed_relative_to_ref: ${{ steps.versions.outputs.changed_relative_to_ref }}
ignore_dirs: ".tembo cli"
test:
name: 🧪 ${{ matrix.ext.name }} on 🐘 ${{ matrix.pg }}
runs-on:
- self-hosted
- dind
- xlarge-16x16
container:
image: quay.io/tembo/trunk-test-tembo:f3b2a28-pg15
options: --user root
needs:
- find_directories
strategy:
fail-fast: false
matrix:
ext: ${{ fromJson(needs.find_directories.outputs.directories).include }}
pg: [15]
exclude:
# pg_hint_plabn has separate extensions for each major version
- { ext: { name: pg_hint_plan14 } }
- { ext: { name: pg_hint_plan16 } }
- { ext: { name: pg_hint_plan17 } }
steps:
- uses: actions/checkout@v4
- name: Install system dependencies
run: |
set -xe
apt-get update
apt-get install -y pkg-config libssl-dev gosu
- name: Test the extension within Docker
run: cd ${{ matrix.ext.path }} && trunk build --test
build:
name: 📦 ${{ matrix.ext.name }} on 🐘 ${{ matrix.pg }}
runs-on:
- self-hosted
- dind
- xlarge-16x16
container:
image: quay.io/tembo/trunk-test-tembo:f3b2a28-pg15
options: --user root
needs:
- find_directories
strategy:
fail-fast: false
matrix:
ext: ${{ fromJson(needs.find_directories.outputs.directories).include }}
pg: [17, 16, 15, 14]
exclude:
- { pg: 17, ext: { name: adminpack } } # Removed from Postgres 17
- { pg: 17, ext: { name: old_snapshot } } # Removed from Postgres 17
- { pg: 17, ext: { name: pg_lakehouse } } # Renamed pg_analytics
- { pg: 17, ext: { name: pg_sparse } } # Removed after v0.7.0
# pg_hint_plabn has separate extensions for each major version
- { pg: 17, ext: { name: pg_hint_plan14 } }
- { pg: 17, ext: { name: pg_hint_plan15 } }
- { pg: 17, ext: { name: pg_hint_plan16 } }
- { pg: 16, ext: { name: pg_hint_plan14 } }
- { pg: 16, ext: { name: pg_hint_plan15 } }
- { pg: 16, ext: { name: pg_hint_plan17 } }
- { pg: 15, ext: { name: pg_hint_plan14 } }
- { pg: 15, ext: { name: pg_hint_plan16 } }
- { pg: 15, ext: { name: pg_hint_plan17 } }
- { pg: 14, ext: { name: pg_hint_plan15 } }
- { pg: 14, ext: { name: pg_hint_plan16 } }
- { pg: 14, ext: { name: pg_hint_plan17 } }
env:
TRUNK_API_TOKEN: ${{ secrets.TRUNK_AUTH_TOKEN }}
PGHOST: "localhost"
PGPORT: "5432"
PGDATABASE: "postgres"
PGUSER: "postgres"
PGPASSWORD: "postgres"
POSTGRES_PASSWORD: "password"
TRUNK_AMPLIFY_WEBHOOK: ${{ secrets.TRUNK_AMPLIFY_WEBHOOK }}
steps:
- uses: actions/checkout@v4
- name: Install system dependencies
run: |
set -xe
apt-get update
apt-get install -y pkg-config libssl-dev gosu
- name: Build extension
id: build
run: cd ${{ matrix.ext.path }} && trunk build --pg-version ${{ matrix.pg }}
continue-on-error: true
- name: Install the extension
if: matrix.pg == 15
run: cd ${{ matrix.ext.path }} && EXTENSION=${{ matrix.ext.name }} && trunk install -f .trunk/*.tar.gz $EXTENSION
- name: Handle shared_preload_libraries
if: matrix.pg == 15
shell: bash -e {0}
run: |
for val in pg_cron timescaledb pg_search pg_analytics citus plrust pg_net; do
if [[ "${{ matrix.ext.path }}" == *"$val"* ]]; then
echo handling shared_preload_libraries for $val
echo "shared_preload_libraries = '$val'" >> /var/lib/postgresql/data2/postgresql.conf
fi
done
- name: Enable the extension
if: matrix.pg == 15 && github.ref != 'refs/heads/main'
run: |
su postgres -c '/usr/lib/postgresql/15/bin/postgres &'
sleep 5
export EXTENSIONS=$(psql postgres://postgres:postgres@localhost:5432 -tA -c "select name from pg_available_extensions where name NOT IN ('plpgsql', 'plperlu', 'plperl', 'pltcl', 'plpython3u', 'pltclu', 'pg_stat_statements', 'pgml')";)
for EXTENSION in $EXTENSIONS; do
echo "enabling extension: $EXTENSION"
psql postgres://postgres:postgres@localhost:5432 -c "create extension if not exists \"$EXTENSION\" cascade;"
done
- name: Publish the extension
if: steps.build.outcome == 'success' && github.ref == 'refs/heads/main'
run: cd ${{ matrix.ext.path }} && trunk publish
- name: Re-build Trunk UI
if: github.ref == 'refs/heads/main'
run: |
sleep 2
curl -X POST -d '{}' \
"${{ secrets.TRUNK_AMPLIFY_WEBHOOK }}" \
-H "Content-Type:application/json"