Skip to content

Commit

Permalink
Simplify and fix age, pg_analytics, clickhouse_fdw
Browse files Browse the repository at this point in the history
While at it, skip publishing if the build failed.

Also add the Postgres version to the CI test descriptions, and some fun
emoji, cause life is too short for boring.
  • Loading branch information
theory committed Dec 11, 2024
1 parent 3b89d9a commit 90377e9
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 58 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/extensions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:

jobs:
find_directories:
name: Find changed extensions
name: 🔍 Find changed extensions
runs-on: ubuntu-20.04
outputs:
directories: ${{ steps.find_directories.outputs.build_matrix }}
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
ignore_dirs: ".tembo cli"

test:
name: Test ${{ matrix.name }}
name: 🧪 ${{ matrix.ext.name }} on 🐘 ${{ matrix.pg }}
runs-on:
- self-hosted
- dind
Expand All @@ -63,7 +63,9 @@ jobs:
- find_directories
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.find_directories.outputs.directories) }}
matrix:
ext: ${{ fromJson(needs.find_directories.outputs.directories).include }}
pg: [15]
steps:
- uses: actions/checkout@v4
- name: Install system dependencies
Expand All @@ -72,10 +74,10 @@ jobs:
apt-get update
apt-get install -y pkg-config libssl-dev gosu
- name: Test the extension within Docker
run: cd ${{ matrix.path }} && trunk build --test
run: cd ${{ matrix.ext.path }} && trunk build --test

build:
name: Build ${{ matrix.ext.name }} on ${{ matrix.pg }}
name: 📦 ${{ matrix.ext.name }} on 🐘 ${{ matrix.pg }}
runs-on:
- self-hosted
- dind
Expand Down Expand Up @@ -107,6 +109,7 @@ jobs:
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
Expand All @@ -133,7 +136,7 @@ jobs:
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'
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'
Expand Down
23 changes: 6 additions & 17 deletions contrib/age/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,10 @@ RUN apt-get update && apt-get install -y \
python3-pip && \
apt-get clean && rm -rf /var/lib/apt/lists/*

# Clone repository
RUN git clone https://github.com/postgres/postgres.git

# Use argument to specify PostgreSQL release
ARG PG_RELEASE=REL_17_2

# Configure and build PostgreSQL
RUN cd postgres && \
git fetch origin ${PG_RELEASE} && \
git checkout ${PG_RELEASE} && \
./configure && \
cd contrib && \
git clone https://github.com/apache/age.git

RUN cd postgres/contrib/age && \
git checkout release/PG${PG_VERSION}/1.5.0 && \
make
ARG EXTENSION_NAME
ARG EXTENSION_VERSION

# Build the extension.
RUN git clone --depth 1 --branch PG${PG_VERSION}/v${EXTENSION_VERSION}-rc0 https://github.com/apache/${EXTENSION_NAME}.git \
&& cd ${EXTENSION_NAME} \
&& make
7 changes: 1 addition & 6 deletions contrib/age/Trunk.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,4 @@ loadable_libraries = [{ library_name = "age", requires_restart = true }]
postgres_version = "17"
platform = "linux/amd64"
dockerfile = "Dockerfile"
install_command = """
cd postgres/contrib/age && make install
set -x
mv /usr/local/pgsql/share/extension/* /usr/share/postgresql/17/extension
mv /usr/local/pgsql/lib/* /usr/lib/postgresql/17/lib
"""
install_command = "cd age && make install"
7 changes: 1 addition & 6 deletions contrib/clickhouse_fdw/Trunk.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,4 @@ apt = ["libstdc++6", "libc6", "libgcc-s1"," libuuid1", "libcurl4"]
postgres_version = "17"
platform = "linux/amd64"
dockerfile = "Dockerfile"
install_command = """
cd clickhouse_fdw/build && make install
set -x
mv /usr/local/pgsql/share/extension/* /usr/share/postgresql/17/extension
mv /usr/local/pgsql/lib/* /usr/lib/postgresql/17/lib
"""
install_command = "cd clickhouse_fdw/build && make install"
28 changes: 11 additions & 17 deletions contrib/pg_analytics/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARG PG_VERSION=17
FROM quay.io/coredb/pgrx-builder:pg${PG_VERSION}-pgrx0.12.4
USER root
FROM quay.io/coredb/pgrx-builder:pg${PG_VERSION}-pgrx0.12.7

USER root
RUN apt-get update && apt-get install -y \
build-essential \
libssl-dev \
Expand All @@ -11,20 +11,14 @@ RUN apt-get update && apt-get install -y \
libopenblas-dev \
pkg-config

# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

# Clone repository
RUN git clone https://github.com/paradedb/pg_analytics

# argument passed in during build and defined in Trunk.toml
ARG PG_VERSION
ARG EXTENSION_NAME
ARG EXTENSION_VERSION

ARG PG_VERSION=17

# Build extension
RUN cd pg_analytics && \
git fetch origin v${EXTENSION_VERSION} && \
git checkout v${EXTENSION_VERSION} && \
cargo pgrx init --pg${PG_VERSION} /usr/bin/pg_config && \
cargo pgrx package
# Install Rust and build the extension.
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
&& /root/.cargo/bin/rustup default stable \
&& git clone --depth 1 --branch v${EXTENSION_VERSION} https://github.com/paradedb/${EXTENSION_NAME}.git \
&& cd ${EXTENSION_NAME} \
&& cargo pgrx init --pg${PG_VERSION}=/usr/bin/pg_config \
&& cargo pgrx package
6 changes: 1 addition & 5 deletions contrib/pg_analytics/Trunk.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,4 @@ apt = ["libc6"]
postgres_version = "17"
platform = "linux/amd64"
dockerfile = "Dockerfile"
install_command = """
cd pg_analytics/
mv target/release/pg_analytics-pg17/usr/lib/postgresql/17/lib/* /usr/lib/postgresql/17/lib
mv target/release/pg_analytics-pg17/usr/share/postgresql/17/extension/* /usr/share/postgresql/17/extension
"""
install_command = "cd pg_analytics && cargo pgrx install --release"
2 changes: 1 addition & 1 deletion contrib/wrappers/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ ARG PG_VERSION
ARG EXTENSION_NAME
ARG EXTENSION_VERSION

# Install Rust ad build the extension.
# Install Rust and build the extension.
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
&& /root/.cargo/bin/rustup default stable \
&& git clone --depth 1 --branch v${EXTENSION_VERSION} https://github.com/supabase/${EXTENSION_NAME}.git \
Expand Down

0 comments on commit 90377e9

Please sign in to comment.