Skip to content

feat(generators): add --deterministic flag with hybrid RDFC-1.0 + rdflib serialization #234

feat(generators): add --deterministic flag with hybrid RDFC-1.0 + rdflib serialization

feat(generators): add --deterministic flag with hybrid RDFC-1.0 + rdflib serialization #234

Workflow file for this run

# Built from:
# https://docs.github.com/en/actions/guides/building-and-testing-python
name: Build and test linkml
env:
UV_VERSION: "0.7.13"
on:
push:
branches:
- main
pull_request:
merge_group:
workflow_dispatch:
jobs:
quality-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v8.2.0
with:
version: ${{ env.UV_VERSION }}
- uses: actions/setup-python@v6.2.0
with:
python-version: 3.13
- name: Check pyproject.toml and uv.lock
run: uv lock --check
- name: Install tox
run: python -m pip install tox
- name: Run pre-commit checks
uses: pre-commit/action@v3.0.1
with:
extra_args: --all-files
test:
needs:
- quality-checks
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
# Test on Windows with only the oldest and newest Python versions
exclude:
- os: windows-latest
python-version: "3.10"
- os: windows-latest
python-version: "3.11"
- os: windows-latest
python-version: "3.12"
# See https://github.com/snok/install-poetry#running-on-windows
defaults:
run:
shell: bash
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Ensure tags if not run from main repo
if: github.repository != 'linkml/linkml'
run: |
git remote add upstream https://github.com/linkml/linkml
git fetch upstream --tags
- name: Install uv and setup uv caching
uses: astral-sh/setup-uv@v8.2.0
with:
version: ${{ env.UV_VERSION }}
enable-cache: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6.2.0
id: setup-python
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --all-groups
- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v2.0.2
- name: Test linkml package
# Notebook tests run their own `!uv pip install` cells that mutate the
# shared venv; they run in the isolated `test_notebooks` job instead (#3583).
run: |
uv run pytest tests/linkml/ --ignore=tests/linkml/test_notebooks --with-network -m "not kroki" -n auto --dist loadgroup --cov --cov-report xml:coverage-linkml.xml --cov-report term-missing
shell: bash
- name: Test linkml-runtime package
run: |
uv run coverage run -m pytest tests/linkml_runtime/ --with-network -m "not kroki"
uv run coverage xml -o coverage-linkml_runtime.xml
uv run coverage report -m
shell: bash
- name: Upload linkml coverage report
if: github.repository == 'linkml/linkml' && github.actor != 'dependabot[bot]'
uses: codecov/codecov-action@v7.0.0
with:
name: codecov-linkml-${{ matrix.os }}-${{ matrix.python-version }}
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage-linkml.xml
flags: linkml
fail_ci_if_error: true
- name: Upload runtime coverage report
if: github.repository == 'linkml/linkml' && github.actor != 'dependabot[bot]'
uses: codecov/codecov-action@v7.0.0
with:
name: codecov-runtime-${{ matrix.os }}-${{ matrix.python-version }}
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage-linkml_runtime.xml
flags: runtime
fail_ci_if_error: true
test_slow:
name: Slow Tests
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest ]
python-version: [ "3.10", "3.13" ]
needs:
- quality-checks
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
steps:
- name: Check out repository
uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v8.2.0
with:
version: ${{ env.UV_VERSION }}
enable-cache: true
- name: Set up Python
uses: actions/setup-python@v6.2.0
id: setup-python
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --all-groups
- name: Test linkml slow tests
# Set bash shell to fail correctly on Windows https://github.com/actions/runner-images/issues/6668
shell: bash
run: |
uv run coverage run -m pytest tests/linkml/ --with-slow --with-biolink -m "slow and not kroki" -n auto
uv run coverage xml -o coverage-linkml-slow.xml
uv run coverage report -m
- name: Upload linkml slow test coverage
if: github.repository == 'linkml/linkml' && github.actor != 'dependabot[bot]'
uses: codecov/codecov-action@v7.0.0
with:
name: codecov-linkml-slow-${{ matrix.os }}-${{ matrix.python-version }}
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage-linkml-slow.xml
flags: linkml
fail_ci_if_error: true
test_notebooks:
name: Notebook Tests
# Notebooks execute `!uv pip install ... --upgrade` cells that mutate the
# venv off the lock. Run them in a dedicated job with its own fresh runner
# so they cannot pollute the primary test environment (#3581, #3583).
# Linux only: notebook tests are skipped on Windows.
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
python-version: [ "3.10", "3.13" ]
needs:
- quality-checks
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
steps:
- name: Check out repository
uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v8.2.0
with:
version: ${{ env.UV_VERSION }}
enable-cache: true
- name: Set up Python
uses: actions/setup-python@v6.2.0
id: setup-python
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --all-groups
- name: Run notebook tests
# Run serially (no xdist): concurrent `!uv pip install` would race on the venv.
run: |
uv run pytest tests/linkml/test_notebooks/ --with-network -m "not kroki" --cov --cov-report xml:coverage-notebooks.xml --cov-report term-missing
- name: Upload notebook coverage
if: github.repository == 'linkml/linkml' && github.actor != 'dependabot[bot]'
uses: codecov/codecov-action@v7.0.0
with:
name: codecov-notebooks-${{ matrix.os }}-${{ matrix.python-version }}
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage-notebooks.xml
flags: linkml
fail_ci_if_error: true
test_build_package:
name: Test Build Package
needs:
- test
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v6.2.0
with:
python-version: 3.13
- name: Install uv
uses: astral-sh/setup-uv@v8.2.0
with:
version: ${{ env.UV_VERSION }}
- name: Build source and wheel archives
run: uv build --all-packages