Skip to content

issue(medcat-tutorials): CU-869c87xpy Make sure all the tests run aga… #17

issue(medcat-tutorials): CU-869c87xpy Make sure all the tests run aga…

issue(medcat-tutorials): CU-869c87xpy Make sure all the tests run aga… #17

name: medcat-embedding-linker - CI (test | publish)
on:
push:
branches: [ main ]
tags:
- 'medcat-embedding-linker/v*.*.*'
pull_request:
paths:
- 'medcat-embedding-linker/**'
- '.github/workflows/medcat-embedding-linker**'
permissions:
id-token: write
defaults:
run:
working-directory: ./medcat-plugins/embedding-linker
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.10', '3.11', '3.12' ]
max-parallel: 4
steps:
- uses: actions/checkout@v6
- name: Install uv for Python ${{ matrix.python-version }}
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
- name: Install the project
run: |
uv sync --all-extras --dev
uv run python -m ensurepip
uv run python -m pip install --upgrade pip
- name: Check types
run: |
uv run python -m mypy --follow-imports=normal src/medcat_embedding_linker
- name: Ruff linting
run: |
uv run ruff check src/medcat_embedding_linker --preview
- name: Test
run: |
uv run python -m unittest discover
publish-to-test-PyPI:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout main
uses: actions/checkout@v6
with:
fetch-depth: 0 # fetch all history
fetch-tags: true # fetch tags explicitly
- name: Install uv for Python 3.10
uses: astral-sh/setup-uv@v7
with:
python-version: '3.10'
enable-cache: true
- name: Install dependencies
run: |
uv run python -m ensurepip
- name: Set timestamp-based dev version
run: |
TS=$(date -u +"%Y%m%d%H%M%S")
echo "SETUPTOOLS_SCM_PRETEND_VERSION_FOR_MEDCAT_EMBEDDING_LINKER=0.2.2.dev${TS}" >> $GITHUB_ENV
- name: Build package
run: |
uv build
- name: Publish distribution to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository_url: https://test.pypi.org/legacy/
packages_dir: medcat-plugins/embedding-linker/dist
publish-to-PyPI:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs: build
steps:
- name: Checkout main
uses: actions/checkout@v6
- name: Install uv for Python 3.10
uses: astral-sh/setup-uv@v7
with:
python-version: '3.10'
enable-cache: true
- name: Install dependencies
run: |
uv run python -m ensurepip
- name: Build client package
run: |
uv build
- name: Publish production distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages_dir: medcat-plugins/embedding-linker/dist