|
| 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 | + |
0 commit comments