Skip to content

Commit

Permalink
Merge pull request #316 from sneakers-the-rat/actions-linkml-testing
Browse files Browse the repository at this point in the history
Add action to test with upstream linkml
  • Loading branch information
cmungall authored Apr 2, 2024
2 parents 1af93fc + ea9c1b7 commit e5d1886
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 2 deletions.
97 changes: 97 additions & 0 deletions .github/workflows/test-upstream.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Test with upstream linkml
on:
pull_request_review:
types: [ submitted ]
workflow_dispatch:

jobs:
test_upstream:
if: github.event_name == 'workflow_dispatch' || github.event.review.state == 'APPROVED'
strategy:
matrix:
os: [ ubuntu-latest, windows-latest ]
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
pydantic-version: [ "1", "2" ]
exclude:
- os: windows-latest
python-version: "3.8"
- os: windows-latest
pydantic-version: "1"
- python-version: "3.8"
pydantic-version: "1"
- python-version: "3.9"
pydantic-version: "1"
- python-version: "3.10"
pydantic-version: "1"
runs-on: ${{ matrix.os }}

steps:

- name: checkout upstream
uses: actions/checkout@v4
with:
repository: linkml/linkml
path: linkml
ref: main
fetch-depth: 0

- name: checkout linkml-runtime
uses: actions/checkout@v4
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: set up python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: install poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
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

# use correct pydantic version
- name: install pydantic
working-directory: linkml
run: poetry add pydantic@^${{ matrix.pydantic-version }}

# 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
working-directory: linkml
run: poetry install --no-interaction -E tests

- 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
working-directory: linkml
run: poetry run python -m pytest --with-slow



9 changes: 7 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ packages = [
{ include = "linkml_runtime" }
]

[tool.poetry-dynamic-versioning]
enable = true
vcs = "git"
style = "pep440"

[tool.poetry.scripts]
comparefiles = "linkml_runtime.utils.comparefiles:cli"
linkml-normalize = "linkml_runtime.processing.referencevalidator:cli"
Expand All @@ -61,5 +66,5 @@ pydantic = ">=1.10.2, <3.0.0"
coverage = "^6.2"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning"]
build-backend = "poetry_dynamic_versioning.backend"

0 comments on commit e5d1886

Please sign in to comment.