-
Notifications
You must be signed in to change notification settings - Fork 24
96 lines (79 loc) · 3.18 KB
/
test-upstream.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
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", "3.12" ]
exclude:
- os: windows-latest
python-version: "3.9"
- os: windows-latest
python-version: "3.10"
- os: windows-latest
python-version: "3.11"
runs-on: ${{ matrix.os }}
env:
POETRY_VIRTUALENVS_IN_PROJECT: true
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: Ensure 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@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install poetry
run: pipx install poetry
- name: Install dynamic versioning plugin
run: poetry self add "poetry-dynamic-versioning[plugin]"
- 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
# 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