Skip to content

Commit

Permalink
ci: properly install sqlalchemy2 deps; avoid relocking as a dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud authored and gforsyth committed Jan 18, 2024
1 parent 1302872 commit 08aca7e
Showing 1 changed file with 9 additions and 65 deletions.
74 changes: 9 additions & 65 deletions .github/workflows/ibis-backends.yml
Original file line number Diff line number Diff line change
Expand Up @@ -585,51 +585,9 @@ jobs:
with:
flags: backend,pyspark,${{ runner.os }},python-${{ steps.install_python.outputs.python-version }}

gen_lockfile_sqlalchemy2:
name: Generate Poetry Lockfile for SQLAlchemy 2
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4

- name: install python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- run: python -m pip install --upgrade pip 'poetry==1.7.1'

- name: remove deps that are not compatible with sqlalchemy 2
run: poetry remove snowflake-sqlalchemy sqlalchemy-exasol

- name: add sqlalchemy 2
run: poetry add --lock --optional 'sqlalchemy>=2,<3'

- name: checkout the lock file
run: git checkout poetry.lock

- name: lock with no updates
# poetry add is aggressive and will update other dependencies like
# numpy and pandas so we keep the pyproject.toml edits and then relock
# without updating anything except the requested versions
run: poetry lock --no-update

- name: check the sqlalchemy version
run: poetry show sqlalchemy --no-ansi | grep version | cut -d ':' -f2- | sed 's/ //g' | grep -P '^2\.'

- name: upload deps file
uses: actions/upload-artifact@v3
with:
name: deps
path: |
pyproject.toml
poetry.lock
test_backends_sqlalchemy2:
name: SQLAlchemy 2 ${{ matrix.backend.title }} ${{ matrix.os }} python-${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
needs:
- gen_lockfile_sqlalchemy2
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -708,37 +666,23 @@ jobs:
if: matrix.backend.services != null
run: docker compose up --wait ${{ join(matrix.backend.services, ' ') }}

- name: install poetry
run: pipx install 'poetry==1.7.1'

- name: install python
uses: actions/setup-python@v5
id: install_python
with:
python-version: ${{ matrix.python-version }}

- name: download poetry lockfile
uses: actions/download-artifact@v3
with:
name: deps
path: deps

- name: pull out lockfile
run: |
set -euo pipefail
mv -f deps/* .
rm -r deps
- uses: syphar/restore-virtualenv@v1
with:
requirement_files: poetry.lock
custom_cache_key_element: ${{ matrix.backend.name }}-${{ steps.install_python.outputs.python-version }}
- name: remove deps that are not compatible with sqlalchemy 2
run: poetry remove snowflake-sqlalchemy sqlalchemy-exasol

- uses: syphar/restore-pip-download-cache@v1
with:
requirement_files: poetry.lock
custom_cache_key_element: ${{ steps.install_python.outputs.python-version }}
- name: add sqlalchemy 2
run: poetry update sqlalchemy

- name: install poetry
run: python -m pip install --upgrade pip 'poetry==1.7.1'
- name: check sqlalchemy is version 2
run: poetry run python -c 'import sqlalchemy as sa; assert sa.__version__[0] == "2", sa.__version__'

- name: install ibis
run: poetry install --without dev --without docs --extras "${{ join(matrix.backend.extras, ' ') }}"
Expand Down

0 comments on commit 08aca7e

Please sign in to comment.