Skip to content

feat: append sync mode for per-table immutable changelog #239

feat: append sync mode for per-table immutable changelog

feat: append sync mode for per-table immutable changelog #239

Workflow file for this run

name: CI
on:
push:
branches: ["main"]
tags: ["v*"]
paths-ignore:
- "**/*.md"
- "doc/**"
pull_request:
paths-ignore:
- "**/*.md"
- "doc/**"
# Cancel in-progress runs for the same branch (except main)
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ !contains(github.ref, 'main') }}
jobs:
format:
name: "Format check"
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Check Rust formatting
run: cargo fmt --all -- --check
test:
name: "Regression tests (PG${{ matrix.pg_version }})"
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
pg_version: [18]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build pg_duckpipe builder image
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
target: builder
build-args: PG_VERSION=${{ matrix.pg_version }}
load: true
tags: pg_duckpipe:builder-${{ matrix.pg_version }}
cache-from: type=gha,scope=ci-builder-pg${{ matrix.pg_version }}
cache-to: type=gha,mode=max,scope=ci-builder-pg${{ matrix.pg_version }}
- name: Run regression tests
id: run-tests
run: |
docker run --rm \
-v ${{ github.workspace }}/test:/build/pg_duckpipe/test \
-v /tmp/regression-output-${{ matrix.pg_version }}:/results \
pg_duckpipe:builder-${{ matrix.pg_version }} bash -c '
set -euo pipefail
PG_CONFIG=/usr/lib/postgresql/${{ matrix.pg_version }}/bin/pg_config
PG_LIB=$(${PG_CONFIG} --pkglibdir)
chown -R postgres:postgres /build
# pg_regress refuses to run as root — switch to the postgres user
su postgres -s /bin/bash -c "
export LD_LIBRARY_PATH=${PG_LIB}
make -C /build/pg_duckpipe/test/regression check-regression \
PG_CONFIG=${PG_CONFIG}
" || {
mkdir -p /results
cp /build/pg_duckpipe/test/regression/regression.diffs /results/ 2>/dev/null || true
cp -r /build/pg_duckpipe/test/regression/log/ /results/log/ 2>/dev/null || true
cp -r /tmp/pg_duckpipe_test_log/ /results/pg_log/ 2>/dev/null || true
chmod -R a+rX /results/ 2>/dev/null || true
exit 1
}
'
- name: Upload regression artifacts
if: failure() && steps.run-tests.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: regression-output-pg${{ matrix.pg_version }}
path: /tmp/regression-output-${{ matrix.pg_version }}/
- name: Print logs on failure
if: failure() && steps.run-tests.outcome == 'failure'
run: |
echo "=== regression.diffs ==="
cat /tmp/regression-output-${{ matrix.pg_version }}/regression.diffs || echo "(not found)"
echo ""
for f in /tmp/regression-output-${{ matrix.pg_version }}/log/*; do
[ -f "$f" ] || continue
echo "=== $(basename "$f") (last 100 lines) ==="
tail -100 "$f"
echo ""
done
echo "=== postgresql.log (last 200 lines) ==="
tail -200 /tmp/regression-output-${{ matrix.pg_version }}/pg_log/postgresql.log || echo "(not found)"
echo ""
exit 1
test-daemon:
name: "Daemon E2E tests (PG${{ matrix.pg_version }})"
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
pg_version: [18]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build pg_duckpipe builder image
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
target: builder
build-args: PG_VERSION=${{ matrix.pg_version }}
load: true
tags: pg_duckpipe:builder-${{ matrix.pg_version }}
cache-from: type=gha,scope=ci-builder-pg${{ matrix.pg_version }}
cache-to: type=gha,mode=max,scope=ci-builder-pg${{ matrix.pg_version }}
- name: Run daemon E2E tests
id: run-daemon-tests
run: |
docker run --rm \
-v ${{ github.workspace }}/test:/build/pg_duckpipe/test \
-v /tmp/daemon-output-${{ matrix.pg_version }}:/results \
pg_duckpipe:builder-${{ matrix.pg_version }} bash -c '
set -euo pipefail
PG_VERSION=${{ matrix.pg_version }}
PG_CONFIG=/usr/lib/postgresql/${PG_VERSION}/bin/pg_config
PG_LIB=$(${PG_CONFIG} --pkglibdir)
# Build daemon binary
cd /build/pg_duckpipe
DUCKDB_LIB_DIR="${PG_LIB}" \
LD_LIBRARY_PATH="${PG_LIB}" \
cargo build --release -p duckpipe-daemon
chown -R postgres:postgres /build
# Run daemon tests as postgres user
su postgres -s /bin/bash -c "
export LD_LIBRARY_PATH=${PG_LIB}
export PG_CONFIG=${PG_CONFIG}
export DUCKPIPE_BIN=/build/pg_duckpipe/target/release/duckpipe
cd /build/pg_duckpipe/test/daemon
bash run_tests.sh
" || {
mkdir -p /results
cp -r /build/pg_duckpipe/test/daemon/log/ /results/log/ 2>/dev/null || true
cp -r /tmp/pg_duckpipe_daemon_test_log/ /results/pg_log/ 2>/dev/null || true
chmod -R a+rX /results/ 2>/dev/null || true
exit 1
}
'
- name: Upload daemon test artifacts
if: failure() && steps.run-daemon-tests.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: daemon-output-pg${{ matrix.pg_version }}
path: /tmp/daemon-output-${{ matrix.pg_version }}/
- name: Print daemon logs on failure
if: failure() && steps.run-daemon-tests.outcome == 'failure'
run: |
echo "=== Daemon test logs ==="
for f in /tmp/daemon-output-${{ matrix.pg_version }}/log/*; do
[ -f "$f" ] || continue
echo "=== $(basename "$f") (last 100 lines) ==="
tail -100 "$f"
echo ""
done
echo "=== postgresql.log (last 200 lines) ==="
tail -200 /tmp/daemon-output-${{ matrix.pg_version }}/pg_log/postgresql.log || echo "(not found)"
echo ""
exit 1