Skip to content

Commit

Permalink
fix update script for new version
Browse files Browse the repository at this point in the history
  • Loading branch information
var77 committed Oct 8, 2024
1 parent 7ed591a commit 3667642
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:
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 && PG_VERSION=$PG_VERSION ./lantern_hnsw/cienv/bin/python ./lantern_hnsw/scripts/test_updates.py -U postgres --builddir ./lantern_hnsw/build_updates --rootdir ./lantern_hnsw" &&\
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 }}
Expand Down
18 changes: 10 additions & 8 deletions lantern_hnsw/scripts/test_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ def update_from_tag(from_version: str, to_version: str, starting_point = None):
if not "error: cannot run ssh" in str(e):
raise Exception(f"unknown fetch error: {e}")

rootdir = args.rootdir
if Version(from_version) < Version("0.3.5"):
rootdir = ".."

sha_after = repo.head.object.hexsha
print(f"Updating from tag {from_tag}(sha: {sha_after}) to {to_version}")
Expand All @@ -100,8 +103,13 @@ def update_from_tag(from_version: str, to_version: str, starting_point = None):
# checkout to latest to make sure we always run the latest version of all scripts
repo.git.checkout(from_tag)
# run "mkdir build && cd build && cmake .. && make -j4 && make install"
res = shell(f"mkdir -p {args.builddir} ; git submodule update --init --recursive && cmake -DRELEASE_ID={from_version} -S {args.rootdir} -B {args.builddir} && make -j install")
res = shell(f"rm -rf {args.builddir} || true")
res = shell(f"mkdir -p {args.builddir} ; git submodule update --init --recursive && cmake -DRELEASE_ID={from_version} -S {rootdir} -B {args.builddir} && cd {args.builddir} && make -j install")
repo.git.checkout(starting_sha)
# We are just compilinig again (not installing)
# Because file structure was changed afte 0.3.5 version
# And cmake complains that CMakeFiles does not exist
res = shell(f"rm -rf {args.builddir} third_party && mkdir -p {args.builddir} && git submodule update --init --recursive && cmake -DRELEASE_ID={from_version} -S {args.rootdir} -B {args.builddir} && cd {args.builddir} && make -j")


res = shell(f"psql postgres -U {args.user} -c 'DROP DATABASE IF EXISTS {args.db};'")
Expand All @@ -121,7 +129,7 @@ def update_from_tag(from_version: str, to_version: str, starting_point = None):
res = shell(f"cd {args.builddir} ; UPDATE_EXTENSION=1 UPDATE_FROM={from_version} UPDATE_TO={from_version} make test-misc FILTER=begin")

repo.git.checkout(to_sha)
res = shell(f"git submodule update --init --recursive && cmake -DRELEASE_ID={to_version} -S {args.rootdir} -B {args.builddir} && cd {args.builddir} && make -j install")
res = shell(f"rm -rf {args.builddir} third_party && rm -rf third_party && mkdir -p {args.builddir} && git submodule update --init --recursive && cmake -DRELEASE_ID={to_version} -S {args.rootdir} -B {args.builddir} && cd {args.builddir} && make -j install")
repo.git.checkout(starting_sha)

res = shell(f"cd {args.builddir} ; UPDATE_EXTENSION=1 UPDATE_FROM={from_version} UPDATE_TO={from_version} make test-misc FILTER=version_mismatch")
Expand Down Expand Up @@ -215,9 +223,3 @@ def incompatible_version(pg_version, version_tag):
if incompatible_version(pg_version, from_tag):
continue
try_update_from_tag(str(from_tag), str(latest_version))






0 comments on commit 3667642

Please sign in to comment.