use pg17 for benchmarking #1208
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: test | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
pull_request: | |
branches: | |
- main | |
- dev | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
type: boolean | |
description: "Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)" | |
required: false | |
default: false | |
jobs: | |
test_lantern: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-22.04, ubicloud-standard-4-arm, macos-13] | |
postgres: [12, 13, 14, 15, 16, 17] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# fetch-depth ensures all tags are present on the repo so we can run update tests successfully | |
fetch-depth: 0 | |
submodules: "recursive" | |
- name: Build without SSL | |
id: build_without_ssl | |
run: sudo sh -c "INSTALL_EXTRAS=1 USE_SSL=0 PG_VERSION=$PG_VERSION USE_SOURCE=1 GITHUB_OUTPUT=$GITHUB_OUTPUT INSTALL_CLI=1 ENABLE_FAILURE_POINTS=1 ./ci/scripts/build.sh" | |
env: | |
PG_VERSION: ${{ matrix.postgres }} | |
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
- name: Check clang formatting | |
run: "cd /tmp/lantern/lantern_hnsw/build && make format_check" | |
# Enable tmate debugging of manually-triggered workflows if the input option was provided | |
- name: Setup tmate session | |
uses: mxschmitt/action-tmate@v3 | |
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} | |
- name: Run tests linux without SSL | |
id: test-linux-without-ssl | |
run: sudo su postgres -c "PG_VERSION=$PG_VERSION ./ci/scripts/run-tests-linux.sh" | |
env: | |
PG_VERSION: ${{ matrix.postgres }} | |
if: ${{ !startsWith(matrix.os, 'mac') }} | |
- name: Run integration tests linux without SSL | |
id: integration-test-linux-without-ssl | |
run: | | |
# pytest tries to open files with full path and so 'work' home folder must be listable by postgres for it to work | |
sudo -E chmod +x $HOME && \ | |
sudo su postgres -c "LANTERN_CLI_PATH=${{ env.LANTERN_CLI_PATH }} USE_SSL=0 /tmp/lantern/lantern_hnsw/cienv/bin/python ./lantern_hnsw/scripts/integration_tests.py -k external_index" &&\ | |
echo "Done with integration tests" | |
env: | |
PG_VERSION: ${{ matrix.postgres }} | |
if: ${{ !startsWith(matrix.os, 'mac') }} | |
- name: Build | |
id: build | |
run: sudo sh -c "USE_SSL=1 PG_VERSION=$PG_VERSION USE_SOURCE=1 GITHUB_OUTPUT=$GITHUB_OUTPUT ENABLE_COVERAGE=$ENABLE_COVERAGE ENABLE_FAILURE_POINTS=1 ./ci/scripts/build.sh" | |
env: | |
PG_VERSION: ${{ matrix.postgres }} | |
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
ENABLE_COVERAGE: ${{ (startsWith(matrix.os, 'ubuntu') && matrix.postgres == 17) && '1' || '0' }} | |
- name: Run tests linux | |
id: test-linux | |
run: sudo su postgres -c "PG_VERSION=$PG_VERSION ./ci/scripts/run-tests-linux.sh" | |
env: | |
PG_VERSION: ${{ matrix.postgres }} | |
ENABLE_COVERAGE: ${{ (startsWith(matrix.os, 'ubuntu') && matrix.postgres == 17) && '1' || '0' }} | |
if: ${{ !startsWith(matrix.os, 'mac') }} | |
# integration tests | |
- name: Set LANTERN_CLI_PATH variable | |
run: echo "LANTERN_CLI_PATH=/tmp/bin/lantern-cli" >> $GITHUB_ENV | |
if: ${{ !startsWith(matrix.os, 'mac') }} | |
- name: Run integration tests linux | |
id: integration-test-linux | |
run: | | |
# pytest tries to open files with full path and so 'work' home folder must be listable by postgres for it to work | |
sudo fuser -k 8998/tcp || true 2>/dev/null # kill previously started cli | |
sudo -E chmod +x $HOME && \ | |
sudo su postgres -c "LANTERN_CLI_PATH=${{ env.LANTERN_CLI_PATH }} USE_SSL=1 /tmp/lantern/lantern_hnsw/cienv/bin/python ./lantern_hnsw/scripts/integration_tests.py" &&\ | |
echo "Done with integration tests" | |
env: | |
PG_VERSION: ${{ matrix.postgres }} | |
if: ${{ !startsWith(matrix.os, 'mac') }} | |
- name: Collect coverage files | |
id: collect-cov-files | |
run: sudo su postgres -c "cd /tmp/lantern/lantern_hnsw/build && make cover" | |
if: ${{ startsWith(matrix.os, 'ubuntu') && matrix.postgres == 17 }} | |
- name: Run update tests linux | |
id: update-test-linux | |
run: | | |
# Start postgres | |
sudo su postgres -c "PG_VERSION=$PG_VERSION RUN_TESTS=0 ./ci/scripts/run-tests-linux.sh" && \ | |
sudo su -c "cd /tmp/lantern/lantern_hnsw && PG_VERSION=$PG_VERSION ./cienv/bin/python ./scripts/test_updates.py -U postgres --builddir ./build_updates --rootdir ." &&\ | |
echo "Done with updates" | |
env: | |
PG_VERSION: ${{ matrix.postgres }} | |
if: ${{ !startsWith(matrix.os, 'mac') }} | |
- name: Run catalog update checks | |
id: catalog-update-test-linux | |
run: | | |
sudo su postgres -c "PG_VERSION=$PG_VERSION RUN_TESTS=0 ./ci/scripts/run-tests-linux.sh" && \ | |
sudo su -c "cd /tmp/lantern/lantern_hnsw && PG_VERSION=$PG_VERSION DATABASE_URL='postgresql://postgres@localhost:5432/postgres' ruby ./scripts/test_updates/main.rb test lantern" &&\ | |
echo "Done catalog update checks" | |
env: | |
PG_VERSION: ${{ matrix.postgres }} | |
if: ${{ !startsWith(matrix.os, 'mac') }} | |
- name: Run tests mac | |
id: test-mac | |
run: ./ci/scripts/run-tests-mac.sh | |
env: | |
PG_VERSION: ${{ matrix.postgres }} | |
if: ${{ startsWith(matrix.os, 'mac') }} | |
- name: Run integration tests mac | |
id: integration-test-mac | |
run: | | |
PATH="/usr/local/opt/postgresql@${PG_VERSION}/bin:$PATH" /tmp/lantern/lantern_hnsw/cienv/bin/python ./lantern_hnsw/scripts/integration_tests.py &&\ | |
echo "Done with integration tests" | |
env: | |
PG_VERSION: ${{ matrix.postgres }} | |
if: ${{ startsWith(matrix.os, 'mac') }} | |
- name: Upload Postgres logs | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: postgres-server-${{ matrix.os }}-${{ matrix.postgres }}-logs | |
path: | | |
/tmp/pg-out.log | |
/tmp/pg-error.log | |
- name: Upload lantern coverage | |
if: ${{ startsWith(matrix.os, 'ubuntu') && matrix.postgres == 17 }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: lantern-lcov.info | |
path: /tmp/lantern/lantern_hnsw/build/coverage.info | |
test_extras: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-22.04, ubicloud-standard-4-arm] | |
postgres: [15, 17] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: "recursive" | |
- name: Setup Rust | |
run: rustup toolchain install stable --profile minimal --no-self-update | |
- name: Configure sccache | |
run: | | |
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV | |
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV | |
- name: Run sccache-cache | |
uses: mozilla-actions/[email protected] | |
- name: Cache cargo deps | |
uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: | | |
lantern_cli | |
lantern_extras | |
- name: Setup test env | |
run: sudo su -c "PG_VERSION=$PG_VERSION SETUP_ENV=1 SETUP_POSTGRES=1 SETUP_TESTS=1 USE_SOURCE=1 ./ci/scripts/build-extras.sh" | |
env: | |
PG_VERSION: ${{ matrix.postgres }} | |
- name: Install extension | |
run: | | |
cargo install cargo-pgrx --version 0.12.7 | |
cargo pgrx init "--pg$PG_VERSION" /usr/bin/pg_config | |
sed -i -e "s/default = .*/default=[\"pg${PG_VERSION}\"]/" lantern_extras/Cargo.toml | |
export RUSTFLAGS='--cfg profile="ci-build" -C instrument-coverage' | |
export LLVM_PROFILE_FILE="$(pwd)/coverage-%p-%m.profraw" | |
cargo pgrx install --sudo --pg-config /usr/bin/pg_config --package lantern_extras | |
env: | |
PG_VERSION: ${{ matrix.postgres }} | |
- name: Run postgres | |
run: RUN_POSTGRES=1 ./ci/scripts/build-extras.sh | |
env: | |
PG_VERSION: ${{ matrix.postgres }} | |
- name: Setup permissions | |
run: | | |
sudo chmod 777 -R "/usr/lib/postgresql/${PG_VERSION}/lib/" | |
sudo chmod 777 -R "/usr/share/postgresql/${PG_VERSION}/extension/" | |
# make sure the rust function exposing custom dict API can change the dictionary files | |
sudo chown -R postgres:postgres /usr/share/postgresql/${PG_VERSION}/tsearch_data/ | |
sudo chmod 777 -R /usr/share/postgresql/${PG_VERSION}/tsearch_data/ | |
env: | |
PG_VERSION: ${{ matrix.postgres }} | |
- name: Run tests | |
run: | | |
export RUSTFLAGS='--cfg profile="ci-build" -C instrument-coverage' | |
export LLVM_PROFILE_FILE="$(pwd)/coverage-%p-%m.profraw" | |
cargo test | |
env: | |
OPENAI_TOKEN: ${{ secrets.OPENAI_TOKEN }} | |
COHERE_TOKEN: ${{ secrets.COHERE_TOKEN }} | |
DB_URL: "postgres://[email protected]:5432/postgres" | |
- name: Collect coverage | |
if: ${{ startsWith(matrix.os, 'ubuntu') }} | |
run: | | |
cargo install grcov | |
rustup component add llvm-tools-preview | |
grcov *.profraw -s . --binary-path target/debug -t lcov --branch -o lantern-extras-lcov.info --ignore "{target/debug/build/*,lantern_cli/tests/*,lantern_cli/src/main.rs}" | |
- name: Upload lantern_extras coverage | |
uses: actions/upload-artifact@v4 | |
if: ${{ startsWith(matrix.os, 'ubuntu') && matrix.postgres == 17}} | |
with: | |
name: lantern-extras-lcov.info | |
path: ./lantern-extras-lcov.info | |
upload_coverage: | |
runs-on: ubuntu-22.04 | |
needs: [test_lantern, test_extras] | |
strategy: | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: "recursive" | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: "*-lcov.info" | |
merge-multiple: true | |
path: /tmp/lantern-coverage | |
- uses: geekyeggo/delete-artifact@v4 | |
with: | |
name: "*-lcov.info" | |
- name: Upload coverage to Codecov | |
env: | |
codecov_token: ${{ secrets.CODECOV_TOKEN }} | |
uses: codecov/[email protected] | |
if: ${{ env.codecov_token != '' }} | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: /tmp/lantern-coverage/coverage.info,/tmp/lantern-coverage/lantern-extras-lcov.info | |
fail_ci_if_error: true | |
verbose: true |