Skip to content

Commit e5d1886

Browse files
authored
Merge pull request #316 from sneakers-the-rat/actions-linkml-testing
Add action to test with upstream linkml
2 parents 1af93fc + ea9c1b7 commit e5d1886

File tree

2 files changed

+104
-2
lines changed

2 files changed

+104
-2
lines changed
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Test with upstream linkml
2+
on:
3+
pull_request_review:
4+
types: [ submitted ]
5+
workflow_dispatch:
6+
7+
jobs:
8+
test_upstream:
9+
if: github.event_name == 'workflow_dispatch' || github.event.review.state == 'APPROVED'
10+
strategy:
11+
matrix:
12+
os: [ ubuntu-latest, windows-latest ]
13+
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
14+
pydantic-version: [ "1", "2" ]
15+
exclude:
16+
- os: windows-latest
17+
python-version: "3.8"
18+
- os: windows-latest
19+
pydantic-version: "1"
20+
- python-version: "3.8"
21+
pydantic-version: "1"
22+
- python-version: "3.9"
23+
pydantic-version: "1"
24+
- python-version: "3.10"
25+
pydantic-version: "1"
26+
runs-on: ${{ matrix.os }}
27+
28+
steps:
29+
30+
- name: checkout upstream
31+
uses: actions/checkout@v4
32+
with:
33+
repository: linkml/linkml
34+
path: linkml
35+
ref: main
36+
fetch-depth: 0
37+
38+
- name: checkout linkml-runtime
39+
uses: actions/checkout@v4
40+
with:
41+
# don't specify repository like this or else we won't get pull request branches correctly
42+
# repository: linkml/linkml-runtime
43+
path: linkml-runtime
44+
fetch-depth: 0
45+
46+
- name: set up python
47+
uses: actions/setup-python@v5
48+
with:
49+
python-version: ${{ matrix.python-version }}
50+
51+
- name: install poetry
52+
uses: snok/install-poetry@v1
53+
with:
54+
virtualenvs-create: true
55+
virtualenvs-in-project: true
56+
57+
- name: Load cached venv
58+
id: cached-poetry-dependencies
59+
uses: actions/cache@v3
60+
with:
61+
path: linkml/.venv
62+
key: venv-${{ matrix.python-version }}-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
63+
64+
# make extra sure we're removing any old version of linkml-runtime that exists
65+
- name: uninstall potentially cached linkml-runtime
66+
working-directory: linkml
67+
run: poetry run pip uninstall linkml-runtime
68+
69+
# we are not using linkml-runtime's lockfile, but simulating what will happen
70+
# when we merge this and update linkml's lockfile
71+
- name: add linkml-runtime to lockfile
72+
working-directory: linkml
73+
run: poetry add ../linkml-runtime
74+
75+
# use correct pydantic version
76+
- name: install pydantic
77+
working-directory: linkml
78+
run: poetry add pydantic@^${{ matrix.pydantic-version }}
79+
80+
# note that we run the installation step always, even if we restore a venv,
81+
# the cache will restore the old version of linkml-runtime, but the lockfile
82+
# will only store the directory dependency (and thus will reinstall it)
83+
# the cache will still speedup the rest of the installation
84+
- name: install linkml
85+
working-directory: linkml
86+
run: poetry install --no-interaction -E tests
87+
88+
- name: print linkml-runtime version
89+
working-directory: linkml
90+
run: poetry run python -c 'import linkml_runtime; from importlib.metadata import version; print(linkml_runtime.__file__); print(version("linkml_runtime"))'
91+
92+
- name: run tests
93+
working-directory: linkml
94+
run: poetry run python -m pytest --with-slow
95+
96+
97+

pyproject.toml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ packages = [
3737
{ include = "linkml_runtime" }
3838
]
3939

40+
[tool.poetry-dynamic-versioning]
41+
enable = true
42+
vcs = "git"
43+
style = "pep440"
44+
4045
[tool.poetry.scripts]
4146
comparefiles = "linkml_runtime.utils.comparefiles:cli"
4247
linkml-normalize = "linkml_runtime.processing.referencevalidator:cli"
@@ -61,5 +66,5 @@ pydantic = ">=1.10.2, <3.0.0"
6166
coverage = "^6.2"
6267

6368
[build-system]
64-
requires = ["poetry-core>=1.0.0"]
65-
build-backend = "poetry.core.masonry.api"
69+
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning"]
70+
build-backend = "poetry_dynamic_versioning.backend"

0 commit comments

Comments
 (0)