Skip to content

Commit

Permalink
Improve test_upstream with poetry sync
Browse files Browse the repository at this point in the history
  • Loading branch information
dalito committed Jan 31, 2025
1 parent e0bf17d commit 4033a40
Showing 1 changed file with 14 additions and 28 deletions.
42 changes: 14 additions & 28 deletions .github/workflows/test-upstream.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test with upstream linkml
name: Test linkml-runtime with upstream linkml and run linkml tests
on:
pull_request_review:
types: [ submitted ]
Expand All @@ -8,6 +8,7 @@ jobs:
test_upstream:
if: github.event_name == 'workflow_dispatch' || github.event.review.state == 'APPROVED'
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest ]
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
Expand All @@ -24,7 +25,7 @@ jobs:

steps:

- name: checkout upstream
- name: checkout upstream linkml
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
repository: linkml/linkml
Expand All @@ -35,18 +36,16 @@ jobs:
- name: checkout linkml-runtime
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
# don't specify repository like this or else we won't get pull request branches correctly
# repository: linkml/linkml-runtime
path: linkml-runtime
fetch-depth: 0

- name: Ensure tags if not run from main repo
- name: Ensure linkml-runtime tags if not run from main repo
if: github.repository != 'linkml/linkml-runtime'
working-directory: linkml-runtime
run: |
git remote add upstream https://github.com/linkml/linkml-runtime
git fetch upstream --tags
- name: set up python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b
with:
Expand All @@ -69,33 +68,20 @@ jobs:
path: linkml/.venv
key: venv-${{ matrix.python-version }}-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}

# make extra sure we're removing any old version of linkml-runtime that exists
- name: uninstall potentially cached linkml-runtime
working-directory: linkml
run: poetry run pip uninstall linkml-runtime

# we are not using linkml-runtime's lockfile, but simulating what will happen
# when we merge this and update linkml's lockfile
- name: add linkml-runtime to lockfile
working-directory: linkml
run: poetry add ../linkml-runtime

# note that we run the installation step always, even if we restore a venv,
# the cache will restore the old version of linkml-runtime, but the lockfile
# will only store the directory dependency (and thus will reinstall it)
# the cache will still speedup the rest of the installation
- name: install linkml
# We are not using linkml-runtime's lockfile, but simulate what will happen
# when we merge this and update linkml's lockfile.
# By using poetry sync we remove any old stuff that exists in the cache.
- name: Refresh or install linkml & add linkml-runtime to check dependencies
working-directory: linkml
run: poetry install --no-interaction -E tests

run: |
poetry sync --extras tests
poetry add ../linkml-runtime
- name: print linkml-runtime version
working-directory: linkml
run: poetry run python -c 'import linkml_runtime; from importlib.metadata import version; print(linkml_runtime.__file__); print(version("linkml_runtime"))'

- name: run tests
- name: run linkml tests
shell: bash
working-directory: linkml
run: poetry run python -m pytest --with-slow



0 comments on commit 4033a40

Please sign in to comment.