From 8b31540b21c864c4c4b5bee347a60db0dc72761f Mon Sep 17 00:00:00 2001 From: Will Jones Date: Mon, 6 Jan 2025 08:54:14 -0800 Subject: [PATCH] ci: prevent stable release with preview lance (#1995) Accidentally referenced a preview release in our stable release of LanceDB. This adds a CI check to prevent that. --- .github/workflows/make-release-commit.yml | 9 +++--- ci/validate_stable_lance.py | 34 +++++++++++++++++++++++ 2 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 ci/validate_stable_lance.py diff --git a/.github/workflows/make-release-commit.yml b/.github/workflows/make-release-commit.yml index 81b99d39a..1f66a5666 100644 --- a/.github/workflows/make-release-commit.yml +++ b/.github/workflows/make-release-commit.yml @@ -43,7 +43,7 @@ on: jobs: make-release: # Creates tag and GH release. The GH release will trigger the build and release jobs. - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 permissions: contents: write steps: @@ -57,15 +57,14 @@ jobs: # trigger any workflows watching for new tags. See: # https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow token: ${{ secrets.LANCEDB_RELEASE_TOKEN }} + - name: Validate Lance dependency is at stable version + if: ${{ inputs.type == 'stable' }} + run: python ci/validate_stable_lance.py - name: Set git configs for bumpversion shell: bash run: | git config user.name 'Lance Release' git config user.email 'lance-dev@lancedb.com' - - name: Set up Python 3.11 - uses: actions/setup-python@v5 - with: - python-version: "3.11" - name: Bump Python version if: ${{ inputs.python }} working-directory: python diff --git a/ci/validate_stable_lance.py b/ci/validate_stable_lance.py new file mode 100644 index 000000000..c7e160f52 --- /dev/null +++ b/ci/validate_stable_lance.py @@ -0,0 +1,34 @@ +import tomllib + +found_preview_lance = False + +with open("Cargo.toml", "rb") as f: + cargo_data = tomllib.load(f) + + for name, dep in cargo_data["workspace"]["dependencies"].items(): + if name == "lance" or name.startswith("lance-"): + if isinstance(dep, str): + version = dep + elif isinstance(dep, dict): + # Version doesn't have the beta tag in it, so we instead look + # at the git tag. + version = dep["tag"] + else: + raise ValueError("Unexpected type for dependency: " + str(dep)) + + if "beta" in version: + found_preview_lance = True + print(f"Dependency '{name}' is a preview version: {version}") + +with open("python/pyproject.toml", "rb") as f: + py_proj_data = tomllib.load(f) + + for dep in py_proj_data["project"]["dependencies"]: + if dep.startswith("pylance"): + if "b" in dep: + found_preview_lance = True + print(f"Dependency '{dep}' is a preview version") + break # Only one pylance dependency + +if found_preview_lance: + raise ValueError("Found preview version of Lance in dependencies")