Add autoinc guide #679
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v3 | |
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@v3 | |
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" | |
build: | |
name: Build extensions | |
runs-on: | |
- self-hosted | |
- dind | |
- large-8x8 | |
container: | |
image: quay.io/tembo/trunk-test-tembo:0.0.25 | |
options: --user root | |
needs: | |
- find_directories | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.find_directories.outputs.directories) }} | |
env: | |
TRUNK_API_TOKEN: ${{ secrets.TRUNK_AUTH_TOKEN }} | |
PGHOST: "localhost" | |
PGPORT: "5432" | |
PGDATABASE: "postgres" | |
PGUSER: "postgres" | |
PGPASSWORD: "postgres" | |
POSTGRES_PASSWORD: "password" | |
steps: | |
- uses: actions/[email protected] | |
- name: Install system dependencies | |
run: | | |
set -xe | |
apt-get update | |
apt-get install -y pkg-config libssl-dev gosu | |
- name: Build the extension | |
run: cd ${{ matrix.path }} && trunk build | |
- name: Install the extension | |
run: cd ${{ matrix.path }} && EXTENSION=$(basename ${{ matrix.path }}) && trunk install -f .trunk/*.tar.gz $EXTENSION | |
- name: Enable the extension | |
if: ${{ 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')";) | |
for EXTENSION in $EXTENSIONS; do | |
psql postgres://postgres:postgres@localhost:5432 -c "create extension if not exists \"$EXTENSION\" cascade;" | |
done | |
- name: Publish the extension | |
if: ${{ github.ref == 'refs/heads/main' }} | |
run: cd ${{ matrix.path }} && trunk publish |