chore: Comment out upgrade test (#1677) #2
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
# workflows/test-pg_search.yml | |
# | |
# Test pg_search | |
# Run unit and integration tests for the pg_search extension. | |
name: Test pg_search | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened, ready_for_review] | |
branches: | |
- dev | |
- main | |
paths: | |
- ".github/workflows/test-pg_search.yml" | |
- "pg_search/**" | |
- "!pg_search/README.md" | |
- "tokenizers/**" | |
- "shared/**" | |
push: | |
branches: | |
- dev # Run CI on dev. This is important to fill the GitHub Actions cache in a way that pull requests can see it | |
workflow_dispatch: | |
inputs: | |
test_upgrade_version: | |
description: "Upcoming pg_search version to test upgrading against" | |
required: false | |
default: "" | |
concurrency: | |
group: test-pg_search-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
test-pg_search-postgres: | |
name: Test pg_search on PostgreSQL ${{ matrix.pg_version }} for ${{ matrix.arch }} | |
runs-on: ${{ matrix.runner }} | |
if: github.event.pull_request.draft == false | |
strategy: | |
matrix: | |
include: | |
- runner: depot-ubuntu-latest-8 | |
pg_version: 12 | |
arch: amd64 | |
- runner: depot-ubuntu-latest-8 | |
pg_version: 13 | |
arch: amd64 | |
- runner: depot-ubuntu-latest-8 | |
pg_version: 14 | |
arch: amd64 | |
- runner: depot-ubuntu-latest-8 | |
pg_version: 15 | |
arch: amd64 | |
- runner: depot-ubuntu-latest-8 | |
pg_version: 16 | |
arch: amd64 | |
env: | |
default_pg_version: 16 | |
steps: | |
# For the Rust cache to get filled, we need to run the CI on the dev branch after every merge. This only | |
# needs to happen once, so we skip the workflow for all but one of the matrix jobs in that case. | |
- name: Check if Skipping | |
id: check_skip | |
run: | | |
if [[ "${{ github.event_name }}" == "push" && "${{ matrix.pg_version }}" != "${{ env.default_pg_version }}" ]]; then | |
echo "This is a push event to fill Rust cache. Skipping this job." | |
echo "skip_remaining_steps=true" >> $GITHUB_OUTPUT | |
fi | |
- name: Checkout Git Repository | |
if: steps.check_skip.outputs.skip_remaining_steps != 'true' | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
if: steps.check_skip.outputs.skip_remaining_steps != 'true' | |
uses: dtolnay/rust-toolchain@stable | |
# This checks that the version in Cargo.toml is incremented to the next release. We only run it | |
# on PRs to main, which are our release promotion PRs. | |
- name: Check version in Cargo.toml | |
if: steps.check_skip.outputs.skip_remaining_steps != 'true' && github.base_ref == 'main' | |
working-directory: pg_search/ | |
run: | | |
CARGO_VERSION=$(grep "^version" Cargo.toml | head -1 | awk -F '"' '{print $2}') | |
RELEASE_VERSION="${{ vars.VERSION_MAJOR }}.${{ vars.VERSION_MINOR }}.${{ vars.VERSION_PATCH }}" | |
if [ "$CARGO_VERSION" != "$RELEASE_VERSION" ]; then | |
echo "Version in Cargo.toml ($CARGO_VERSION) does not match upcoming release version ($RELEASE_VERSION), did you forget to increment it?" | |
exit 1 | |
fi | |
echo "Version check passed!" | |
# Caches from base branches are available to PRs, but not across unrelated branches, so we only | |
# save the cache on the 'dev' branch, but load it on all branches. | |
- name: Install Rust Cache | |
if: steps.check_skip.outputs.skip_remaining_steps != 'true' | |
uses: Swatinem/rust-cache@v2 | |
with: | |
prefix-key: "v1" | |
shared-key: ${{ runner.os }}-rust-cache-pg_search-${{ HashFiles('Cargo.lock') }} | |
cache-targets: true | |
cache-on-failure: true | |
cache-all-crates: true | |
save-if: ${{ github.ref == 'refs/heads/dev' }} | |
- name: Install & Configure Supported PostgreSQL Version | |
if: steps.check_skip.outputs.skip_remaining_steps != 'true' | |
run: | | |
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - | |
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' | |
sudo apt-get update && sudo apt-get install -y postgresql-${{ matrix.pg_version }} postgresql-server-dev-${{ matrix.pg_version }} | |
sudo chown -R $(whoami) /usr/share/postgresql/${{ matrix.pg_version }}/ /usr/lib/postgresql/${{ matrix.pg_version }}/ /var/lib/postgresql/${{ matrix.pg_version }}/ | |
echo "/usr/lib/postgresql/${{ matrix.pg_version }}/bin" >> $GITHUB_PATH | |
# Needed for hybrid search unit tests | |
- name: Install pgvector | |
if: steps.check_skip.outputs.skip_remaining_steps != 'true' | |
run: | | |
git clone --branch v0.7.4 https://github.com/pgvector/pgvector.git | |
cd pgvector/ | |
sudo PG_CONFIG=/usr/lib/postgresql/${{ matrix.pg_version }}/bin/pg_config make -j | |
sudo PG_CONFIG=/usr/lib/postgresql/${{ matrix.pg_version }}/bin/pg_config make install -j | |
- name: Extract pgrx version | |
if: steps.check_skip.outputs.skip_remaining_steps != 'true' | |
working-directory: pg_search/ | |
run: echo "PGRX_VERSION=$(cargo tree --depth 1 -i pgrx -p pg_search | head -n 1 | cut -f2 -dv)" >> $GITHUB_ENV | |
- name: Install pgrx & llvm-tools-preview | |
if: steps.check_skip.outputs.skip_remaining_steps != 'true' | |
run: | | |
cargo install -j $(nproc) --locked cargo-pgrx --version ${{ env.PGRX_VERSION }} | |
rustup component add llvm-tools-preview | |
cargo pgrx init "--pg${{ matrix.pg_version }}=/usr/lib/postgresql/${{ matrix.pg_version }}/bin/pg_config" | |
- name: Add pg_search to shared_preload_libraries | |
if: steps.check_skip.outputs.skip_remaining_steps != 'true' | |
working-directory: /home/runner/.pgrx/data-${{ matrix.pg_version }}/ | |
run: sed -i "s/^#shared_preload_libraries = .*/shared_preload_libraries = 'pg_search'/" postgresql.conf | |
# TODO: Uncomment the upgrade test after we release 0.10.0 | |
# The integration tests also test upgrading the extension when passed the '-u' flag (only on promotion PRs) | |
- name: Run pg_search Cargo Test Suite | |
if: steps.check_skip.outputs.skip_remaining_steps != 'true' | |
working-directory: pg_search/ | |
run: | | |
# Variables (we disable telemetry to avoid skewing the user metrics with CI runs) | |
BASE_RELEASE="0.10.0" | |
PARADEDB_TELEMETRY=false | |
# echo "" | |
# echo "Enabling code coverage..." | |
# echo -e "\n# Enable code coverage on Linux only, for CI builds\n[target.'cfg(target_os=\"linux\")']\nrustflags = [\"-Cinstrument-coverage\"]" >> ../.cargo/config.toml | |
# mkdir -p ../target/coverage ../target/coverage-report | |
# # If this is a promotion PR, we test upgrading the extension by pulling the earliest version of the extension compatible with our current default Postgres version | |
# if [[ "${{ github.base_ref }}" == "main" && "${{ matrix.pg_version }}" == "${{ env.default_pg_version }}" ]]; then | |
# echo "" | |
# echo "Promotion PR detected! Running extension upgrade test..." | |
# if [[ "${{ github.event.inputs.test_upgrade_version }}" == "" ]]; then | |
# echo "Using the GitHub Variables version..." | |
# NEW_VERSION=${{ vars.VERSION_MAJOR }}.${{ vars.VERSION_MINOR }}.${{ vars.VERSION_PATCH }} | |
# else | |
# echo "Using the workflow_dispatch version..." | |
# NEW_VERSION="${{ github.event.inputs.test_upgrade_version }}" | |
# fi | |
# echo "Running extension upgrade test from v$BASE_RELEASE to v$NEW_VERSION..." | |
# echo "" | |
# echo "Downloading pg_search v$BASE_RELEASE..." | |
# curl -LOJ "https://github.com/paradedb/paradedb/releases/download/v$BASE_RELEASE/pg_search-v$BASE_RELEASE-pg${{ matrix.pg_version }}-${{ matrix.arch }}-ubuntu2204.deb" | |
# sudo dpkg -i "pg_search-v$BASE_RELEASE-pg${{ matrix.pg_version }}-${{ matrix.arch }}-ubuntu2204.deb" | |
# echo "" | |
# echo "Starting Postgres..." | |
# cargo pgrx start pg${{ matrix.pg_version }} | |
# echo "" | |
# echo "Loading pg_search v$BASE_RELEASE..." | |
# psql -h localhost -d postgres -p 288${{ matrix.pg_version }} -c "CREATE EXTENSION pg_search VERSION '$BASE_RELEASE';" | |
# echo "" | |
# echo "Verifying current pg_search installed version..." | |
# psql -h localhost -d postgres -p 288${{ matrix.pg_version }} -c "SELECT extname, extversion FROM pg_extension WHERE extname = 'pg_search';" | |
# echo "" | |
# echo "Building pg_search v$NEW_VERSION..." | |
# sudo chown -R "$(whoami)" "/usr/share/postgresql/${{ matrix.pg_version }}/extension/" "/usr/lib/postgresql/${{ matrix.pg_version }}/lib/" | |
# cargo pgrx install --features icu --pg-config="/usr/lib/postgresql/${{ matrix.pg_version }}/bin/pg_config" --release | |
# echo "" | |
# echo "Upgrading pg_search to v$NEW_VERSION..." | |
# psql -h localhost -d postgres -p 288${{ matrix.pg_version }} -c "ALTER EXTENSION pg_search UPDATE TO '$NEW_VERSION';" | |
# echo "" | |
# echo "Verifying current pg_search installed version..." | |
# psql -h localhost -d postgres -p 288${{ matrix.pg_version }} -c "SELECT extname, extversion FROM pg_extension WHERE extname = 'pg_search';" | |
# echo "" | |
# echo "Extension successfully upgraded from v$BASE_RELEASE to v$NEW_VERSION!" | |
# echo "" | |
# echo "Restarting Postgres..." | |
# cargo pgrx stop pg${{ matrix.pg_version }} | |
# cargo pgrx start pg${{ matrix.pg_version }} | |
# else | |
# echo "" | |
# echo "Building pg_search..." | |
# cargo pgrx install --features icu --pg-config="/usr/lib/postgresql/${{ matrix.pg_version }}/bin/pg_config" --release | |
# echo "" | |
# echo "Starting Postgres..." | |
# cargo pgrx start pg${{ matrix.pg_version }} | |
# fi | |
echo "" | |
echo "Building pg_search..." | |
cargo pgrx install --features icu --pg-config="/usr/lib/postgresql/${{ matrix.pg_version }}/bin/pg_config" --release | |
echo "" | |
echo "Starting Postgres..." | |
cargo pgrx start pg${{ matrix.pg_version }} | |
# Necessary for the ephemeral Postgres test to have proper permissions | |
sudo chown -R $(whoami) /var/run/postgresql/ | |
echo "" | |
echo "Running Rust tests..." | |
export DATABASE_URL=postgresql://localhost:288${{ matrix.pg_version }}/postgres | |
export PG_CONFIG=/usr/lib/postgresql/${{ matrix.pg_version }}/bin/pg_config | |
cargo pgrx test "pg${{ matrix.pg_version }}" --features icu | |
cat ~/.pgrx/${{ matrix.pg_version}}.log | |
- name: Print the Postgres Logs | |
if: steps.check_skip.outputs.skip_remaining_steps != 'true' && always() | |
run: cat ~/.pgrx/${{ matrix.pg_version}}.log | |
test-pg_search-pgrx-postgres: | |
name: Test pg_search on pgrx PostgreSQL ${{ matrix.pg_version }} for ${{ matrix.arch }} | |
runs-on: ${{ matrix.runner }} | |
if: github.event.pull_request.draft == false | |
strategy: | |
matrix: | |
include: | |
- runner: depot-ubuntu-latest-8 | |
pg_version: 16 | |
arch: amd64 | |
env: | |
default_pg_version: 16 | |
steps: | |
# For the Rust cache to get filled, we need to run the CI on the dev branch after every merge. This only | |
# needs to happen once, so we skip the workflow for all but one of the matrix jobs in that case. | |
- name: Check if Skipping | |
id: check_skip | |
run: | | |
if [[ "${{ github.event_name }}" == "push" && "${{ matrix.pg_version }}" != "${{ env.default_pg_version }}" ]]; then | |
echo "This is a push event to fill Rust cache. Skipping this job." | |
echo "skip_remaining_steps=true" >> $GITHUB_OUTPUT | |
fi | |
- name: Checkout Git Repository | |
if: steps.check_skip.outputs.skip_remaining_steps != 'true' | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
if: steps.check_skip.outputs.skip_remaining_steps != 'true' | |
uses: dtolnay/rust-toolchain@stable | |
# This checks that the version in Cargo.toml is incremented to the next release. We only run it | |
# on PRs to main, which are our release promotion PRs. | |
- name: Check version in Cargo.toml | |
if: steps.check_skip.outputs.skip_remaining_steps != 'true' && github.base_ref == 'main' | |
working-directory: pg_search/ | |
run: | | |
CARGO_VERSION=$(grep "^version" Cargo.toml | head -1 | awk -F '"' '{print $2}') | |
RELEASE_VERSION="${{ vars.VERSION_MAJOR }}.${{ vars.VERSION_MINOR }}.${{ vars.VERSION_PATCH }}" | |
if [ "$CARGO_VERSION" != "$RELEASE_VERSION" ]; then | |
echo "Version in Cargo.toml ($CARGO_VERSION) does not match upcoming release version ($RELEASE_VERSION), did you forget to increment it?" | |
exit 1 | |
fi | |
echo "Version check passed!" | |
# Caches from base branches are available to PRs, but not across unrelated branches, so we only | |
# save the cache on the 'dev' branch, but load it on all branches. | |
- name: Install Rust Cache | |
if: steps.check_skip.outputs.skip_remaining_steps != 'true' | |
uses: Swatinem/rust-cache@v2 | |
with: | |
prefix-key: "v1" | |
shared-key: ${{ runner.os }}-rust-cache-pg_search--enable-cassert${{ HashFiles('Cargo.lock') }} | |
cache-targets: true | |
cache-on-failure: true | |
cache-all-crates: true | |
save-if: ${{ github.ref == 'refs/heads/dev' }} | |
- name: Extract pgrx version | |
if: steps.check_skip.outputs.skip_remaining_steps != 'true' | |
working-directory: pg_search/ | |
run: echo "PGRX_VERSION=$(grep '^pgrx = ' Cargo.toml | sed -E 's/pgrx = "(.*)"/\1/')" >> $GITHUB_ENV | |
- name: Install pgrx & llvm-tools-preview | |
if: steps.check_skip.outputs.skip_remaining_steps != 'true' | |
run: | | |
cargo install -j $(nproc) --locked cargo-pgrx --version ${{ env.PGRX_VERSION }} | |
rustup component add llvm-tools-preview | |
cargo pgrx init "--pg${{ matrix.pg_version }}=download" | |
# Needed for hybrid search unit tests | |
- name: Install pgvector | |
if: steps.check_skip.outputs.skip_remaining_steps != 'true' | |
run: | | |
git clone --branch v0.7.4 https://github.com/pgvector/pgvector.git | |
cd pgvector/ | |
PG_CONFIG=~/.pgrx/16.*/pgrx-install/bin/pg_config make -j | |
PG_CONFIG=~/.pgrx/16.*/pgrx-install/bin/pg_config make install -j | |
- name: Add pg_search to shared_preload_libraries | |
if: steps.check_skip.outputs.skip_remaining_steps != 'true' | |
working-directory: /home/runner/.pgrx/data-${{ matrix.pg_version }}/ | |
run: sed -i "s/^#shared_preload_libraries = .*/shared_preload_libraries = 'pg_search'/" postgresql.conf | |
- name: Run pg_search Cargo Test Suite Against pgrx Postgres | |
if: steps.check_skip.outputs.skip_remaining_steps != 'true' | |
working-directory: pg_search/ | |
run: | | |
PARADEDB_TELEMETRY=false | |
cargo pgrx stop | |
cargo pgrx install --pg-config ~/.pgrx/${{ matrix.pg_version }}.*/pgrx-install/bin/pg_config --features=icu | |
cargo pgrx start | |
~/.pgrx/${{ matrix.pg_version }}.*/pgrx-install/bin/createdb -p 28816 -h localhost pg_search | |
DATABASE_URL=postgresql://localhost:28816/pg_search cargo test --features=pg${{ matrix.pg_version }},icu -- --skip replication --skip ephemeral | |
cat ~/.pgrx/${{ matrix.pg_version}}.log | |
- name: Print the Postgres Logs | |
if: steps.check_skip.outputs.skip_remaining_steps != 'true' && always() | |
run: cat ~/.pgrx/${{ matrix.pg_version}}.log |