Repository navigation
Prepare v0.2.9 release documentation through SQL name-resolution hard… #1396
This file contains hidden or 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: CI | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened, labeled] | |
| push: | |
| branches: [main] # Runs on main after merge | |
| workflow_dispatch: | |
| inputs: | |
| pg_version: | |
| description: 'PostgreSQL version(s) to test' | |
| required: false | |
| default: '17' | |
| type: choice | |
| options: | |
| - '17' | |
| - '18' | |
| - '17, 18' | |
| env: | |
| CARGO_TERM_COLOR: always | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| concurrency: | |
| group: ci-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| azure_example_smoke: | |
| name: Example Smoke Checks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Set up Python | |
| uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | |
| with: | |
| python-version: '3.12' | |
| - name: Run example smoke checks | |
| run: | | |
| for smoke_check in examples/*/scripts/smoke_check.sh; do | |
| echo "Running $smoke_check" | |
| bash "$smoke_check" | |
| done | |
| benchmark_harness: | |
| name: Benchmark Harness Checks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Set up Python | |
| uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | |
| with: | |
| python-version: '3.12' | |
| - name: Test benchmark harness | |
| run: python3 -m unittest discover -s benchmarks -p 'test_*.py' | |
| - name: Test upgrade lifecycle harness | |
| run: python3 -m unittest discover -s scripts -p test_upgrade_lifecycle.py | |
| make_install_smoke: | |
| name: Source Install Checks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Test Makefile source installation | |
| run: ./scripts/test-make-install.sh | |
| macos_source_install: | |
| name: macOS Source Install (PG17) | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Install Rust stable | |
| run: | | |
| rustup toolchain install stable --profile minimal | |
| rustup default stable | |
| - name: Install PostgreSQL and cargo-pgrx | |
| run: | | |
| brew install postgresql@17 | |
| cargo install cargo-pgrx --version 0.16.1 --locked | |
| PG_CONFIG="$(brew --prefix postgresql@17)/bin/pg_config" | |
| cargo pgrx init --pg17 "$PG_CONFIG" | |
| echo "PG_CONFIG=$PG_CONFIG" >> "$GITHUB_ENV" | |
| - name: Validate committed Cargo lockfile | |
| run: cargo metadata --locked --format-version 1 --no-default-features --features pg17 > /dev/null | |
| - name: Test source package installation | |
| run: | | |
| ./scripts/test-make-install.sh | |
| make package PG_CONFIG="$PG_CONFIG" | |
| stage_dir="$RUNNER_TEMP/pg-durable-stage" | |
| make install PG_CONFIG="$PG_CONFIG" DESTDIR="$stage_dir" | |
| pkglibdir="$($PG_CONFIG --pkglibdir)" | |
| extension_dir="$($PG_CONFIG --sharedir)/extension" | |
| test -f "$stage_dir$pkglibdir/pg_durable.dylib" | |
| test -f "$stage_dir$extension_dir/pg_durable.control" | |
| make uninstall PG_CONFIG="$PG_CONFIG" DESTDIR="$stage_dir" | |
| test ! -e "$stage_dir$pkglibdir/pg_durable.dylib" | |
| test ! -e "$stage_dir$extension_dir/pg_durable.control" | |
| test -z "$(find "$stage_dir$extension_dir" -name 'pg_durable--*.sql' -print -quit)" | |
| make install PG_CONFIG="$PG_CONFIG" | |
| bindir="$($PG_CONFIG --bindir)" | |
| data_dir="$RUNNER_TEMP/pg-durable-data" | |
| cleanup() { | |
| "$bindir/pg_ctl" -D "$data_dir" -m immediate stop >/dev/null 2>&1 || true | |
| make uninstall PG_CONFIG="$PG_CONFIG" >/dev/null 2>&1 || true | |
| } | |
| trap cleanup EXIT | |
| "$bindir/initdb" -D "$data_dir" --no-locale --encoding=UTF8 | |
| cat >> "$data_dir/postgresql.conf" <<EOF | |
| shared_preload_libraries = 'pg_durable' | |
| port = 55432 | |
| unix_socket_directories = '$RUNNER_TEMP' | |
| EOF | |
| "$bindir/pg_ctl" -D "$data_dir" -l "$RUNNER_TEMP/postgresql.log" start | |
| "$bindir/psql" -h "$RUNNER_TEMP" -p 55432 -d postgres -v ON_ERROR_STOP=1 \ | |
| -c 'CREATE EXTENSION pg_durable;' \ | |
| -c "SELECT extversion FROM pg_extension WHERE extname = 'pg_durable';" | |
| "$bindir/pg_ctl" -D "$data_dir" -m fast stop | |
| make uninstall PG_CONFIG="$PG_CONFIG" | |
| trap - EXIT | |
| test ! -e "$pkglibdir/pg_durable.dylib" | |
| test ! -e "$extension_dir/pg_durable.control" | |
| test -z "$(find "$extension_dir" -name 'pg_durable--*.sql' -print -quit)" | |
| - name: Verify Cargo lockfile is unchanged | |
| if: always() | |
| run: git diff --exit-code HEAD -- Cargo.lock | |
| format: | |
| name: Format Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Install Rust stable | |
| run: | | |
| rustup toolchain install stable --profile minimal --component rustfmt | |
| rustup default stable | |
| - name: Check formatting | |
| run: cargo fmt --package pg_durable -- --check | |
| fixed_matrix: | |
| name: Fixed DSL Matrix | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Test manifest runner | |
| run: python3 -m unittest discover -s tests/e2e/shapes -p 'test_*.py' | |
| - name: Validate fixed manifest | |
| run: python3 tests/e2e/shapes/runner.py --check | |
| prepare: | |
| name: Prepare Matrix | |
| runs-on: ubuntu-latest | |
| outputs: | |
| pg_versions: ${{ steps.set-matrix.outputs.pg_versions }} | |
| steps: | |
| - id: set-matrix | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| echo 'pg_versions=[${{ github.event.inputs.pg_version }}]' >> "$GITHUB_OUTPUT" | |
| elif [ "${{ github.event_name }}" = "pull_request" ]; then | |
| if [ "${{ contains(github.event.pull_request.labels.*.name, 'test-pg18') }}" = "true" ]; then | |
| echo 'pg_versions=[17, 18]' >> "$GITHUB_OUTPUT" | |
| else | |
| echo 'pg_versions=[17]' >> "$GITHUB_OUTPUT" | |
| fi | |
| else | |
| echo 'pg_versions=[17, 18]' >> "$GITHUB_OUTPUT" | |
| fi | |
| test: | |
| name: Clippy & Tests (PG${{ matrix.pg_version }}) | |
| runs-on: ubuntu-latest | |
| needs: [azure_example_smoke, make_install_smoke, format, fixed_matrix, prepare] | |
| permissions: | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| pg_version: ${{ fromJson(needs.prepare.outputs.pg_versions) }} | |
| # PG18 failures are non-blocking while compatibility is being established | |
| continue-on-error: ${{ matrix.pg_version == 18 }} | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| fetch-depth: 0 | |
| - name: Free disk space and show usage | |
| run: | | |
| echo "Disk usage before cleanup" | |
| df -h | |
| sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /usr/local/.ghcup | |
| docker system prune -af || true | |
| echo "Disk usage after cleanup" | |
| df -h | |
| - name: Install Rust stable | |
| run: | | |
| rustup toolchain install stable --profile minimal --component clippy | |
| rustup default stable | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| pkg-config \ | |
| libssl-dev \ | |
| libclang-dev \ | |
| clang \ | |
| bison \ | |
| flex \ | |
| libreadline-dev \ | |
| zlib1g-dev \ | |
| libxml2-dev \ | |
| libxslt1-dev \ | |
| libicu-dev | |
| - name: Cache cargo-pgrx tool | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: | | |
| ~/.cargo/.crates2.json | |
| ~/.cargo/bin/cargo-pgrx | |
| key: ${{ runner.os }}-cargo-pgrx-0.16.1-v1 | |
| - name: Cache Cargo dependency sources | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-deps-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo-deps- | |
| - name: Validate committed Cargo lockfile | |
| run: cargo metadata --locked --format-version 1 --no-default-features --features pg${{ matrix.pg_version }} > /dev/null | |
| - name: Cache PostgreSQL build | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: | | |
| ~/.pgrx/config.toml | |
| ~/.pgrx/${{ matrix.pg_version }}.* | |
| key: ${{ runner.os }}-pgrx-pg${{ matrix.pg_version }} | |
| # Always remove stale data directories to prevent flaky tests | |
| # from leftover state. The data dir is cheap to recreate (~1s). | |
| - name: Remove cached data directory | |
| run: rm -rf "$HOME/.pgrx/data-${{ matrix.pg_version }}" | |
| - name: Install cargo-pgrx | |
| run: | | |
| if ! command -v cargo-pgrx &> /dev/null || ! cargo pgrx --version | grep -q "0.16.1"; then | |
| cargo install cargo-pgrx --version 0.16.1 --locked | |
| else | |
| echo "cargo-pgrx 0.16.1 already installed, skipping" | |
| fi | |
| - name: Initialize pgrx | |
| run: | | |
| if [ ! -d "$HOME/.pgrx/${{ matrix.pg_version }}."* ]; then | |
| cargo pgrx init --pg${{ matrix.pg_version }} download | |
| else | |
| echo "PostgreSQL ${{ matrix.pg_version }} already initialized, skipping download" | |
| fi | |
| - name: Run clippy | |
| run: cargo clippy --locked --no-default-features --features pg${{ matrix.pg_version }} -- -D warnings | |
| # pgspot SQL security gate (pg17 only; the install SQL is the shipped DDL). | |
| - name: Generate extension install SQL | |
| if: matrix.pg_version == 17 | |
| run: | | |
| cargo pgrx schema pg${{ matrix.pg_version }} \ | |
| --no-default-features \ | |
| --features pg${{ matrix.pg_version }} \ | |
| -o /tmp/pg_durable-install.sql | |
| - name: Run pgspot SQL security gate | |
| if: matrix.pg_version == 17 | |
| run: scripts/pgspot-gate.sh /tmp/pg_durable-install.sql | |
| - name: Run unit tests | |
| run: cargo pgrx test pg${{ matrix.pg_version }} | |
| - name: Run E2E tests (all startup policies) | |
| id: e2e_tests | |
| run: ./scripts/test-e2e-local.sh --clean --include-shapes --pg-version ${{ matrix.pg_version }} | |
| - name: Run upgrade tests | |
| id: upgrade_tests | |
| run: ./scripts/test-upgrade.sh --pg-version ${{ matrix.pg_version }} | |
| - name: Run shutdown regression test | |
| id: shutdown_test | |
| run: ./scripts/test-shutdown.sh --pg-version ${{ matrix.pg_version }} --cycles 1 | |
| - name: Run epoch-race regression test | |
| id: epoch_race_test | |
| run: ./scripts/test-epoch-race.sh --pg-version ${{ matrix.pg_version }} | |
| - name: Upload PostgreSQL logs on E2E failure | |
| if: failure() | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: postgresql-logs-pg${{ matrix.pg_version }} | |
| path: | | |
| ~/.pgrx/${{ matrix.pg_version }}.log | |
| ~/.pgrx/data-${{ matrix.pg_version }}/log/*.log | |
| target/upgrade-lifecycle/**/build.log | |
| target/upgrade-lifecycle/**/postgres.log | |
| target/upgrade-lifecycle/**/*.json | |
| target/upgrade-lifecycle/**/error.txt | |
| if-no-files-found: warn | |
| - name: Run pg_regress tests | |
| id: pg_regress | |
| run: make test-regress PG_VERSION=pg${{ matrix.pg_version }} | |
| - name: Upload pg_regress results on failure | |
| if: steps.pg_regress.outcome == 'failure' | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: pg_regress-results-pg${{ matrix.pg_version }} | |
| path: | | |
| regression.out | |
| regression.diffs | |
| if-no-files-found: ignore | |
| - name: Stop PostgreSQL after pg_regress | |
| if: steps.pg_regress.outcome != 'skipped' | |
| run: ./scripts/pg-stop.sh --pg-version ${{ matrix.pg_version }} | |
| # cargo-pgrx 0.16.1 does not expose --locked for its build/test commands. | |
| - name: Verify Cargo lockfile is unchanged | |
| if: always() | |
| run: git diff --exit-code HEAD -- Cargo.lock |