Test with upstream linkml #4
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} | |
defaults: | |
run: | |
shell: bash | |
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') }} | |
# use correct pydantic version | |
- name: install pydantic | |
working-directory: linkml | |
run: poetry add pydantic@^${{ matrix.pydantic-version }} | |
- name: remove potentially cached linkml-runtime version | |
working-directory: linkml | |
run: poetry run pip uninstall linkml-runtime -y | |
- name: get linkml-runtime short hash | |
working-directory: linkml-runtime | |
run: | | |
LINKML_RUNTIME_COMMIT=$(git rev-parse --short HEAD) | |
echo "LINKML_RUNTIME_COMMIT=$LINKML_RUNTIME_COMMIT" >> "$GITHUB_ENV" | |
# install the local version of linkml-runtime: | |
# we do this vs. pip --force-reinstall so that we keep linkml's locked deps | |
# and simulate what the lockfile will be after merging and relocking. | |
# we override the linkml-runtime version here according to poetry-dynamic-versioning: | |
# "The dynamic version is not available during poetry run or poetry shell because of a Poetry design choice that prevents the plugin from cleaning up after itself." | |
# and since linkml depends on a specific version of linkml-runtime, this would always fail | |
- name: add linkml-runtime to linkml's venv | |
working-directory: linkml | |
run: | | |
poetry self add "poetry-dynamic-versioning[plugin]" | |
POETRY_DYNAMIC_VERSIONING_OVERRIDE="linkml-runtime = 1.99.0+${{ env.LINKML_RUNTIME_COMMIT }}" 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 --no-root -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 | |