Skip to content

medcat-trainer/v3.7.0 #91

medcat-trainer/v3.7.0

medcat-trainer/v3.7.0 #91

# TODO: Fix Medcat V1 Release Actions
# Disabled waiting for designed release process
name: medcat-v1 - production
on:
push:
branches: [ "medcat-v1/production", "medcat-v1/v[0-9]+.[0-9]+.post" ]
release:
types: [ published , edited ]
defaults:
run:
working-directory: ./v1/medcat
jobs:
build-n-publish-to-pypi:
runs-on: ubuntu-24.04
concurrency: build-n-publish-to-pypi
if: |
github.repository == 'CogStack/cogstack-nlp' &&
(github.event_name != 'release' || startsWith(github.event.release.tag_name, 'medcat/v1.'))
steps:
- name: Checkout production
uses: actions/checkout@v6
with:
ref: ${{ github.event.release.target_commitish }}
fetch-depth: 0
- name: Set up Python 3.10
uses: actions/setup-python@v6
with:
python-version: "3.10"
- name: Run UATs
run: |
python -m pip install --upgrade pip
export SETUPTOOLS_SCM_PRETEND_VERSION_FOR_MEDCAT="1.16.5" # NOTE: This is where the project verison is set
pip install -r requirements-dev.txt
all_files=$(git ls-files | grep '^tests/.*\.py$' | grep -v '/__init__\.py$' | sed 's/\.py$//' | sed 's/\//./g')
num_files=$(echo "$all_files" | wc -l)
midpoint=$((num_files / 2))
first_half_nl=$(echo "$all_files" | head -n $midpoint)
second_half_nl=$(echo "$all_files" | tail -n +$(($midpoint + 1)))
timeout 25m python -m unittest ${first_half_nl[@]}
timeout 25m python -m unittest ${second_half_nl[@]}
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
SETUPTOOLS_SCM_PRETEND_VERSION_FOR_MEDCAT="1.16.5"
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Publish production distribution to PyPI
if: startsWith(github.ref, 'refs/tags') && ! github.event.release.prerelease
uses: pypa/gh-action-pypi-publish@v1.14.0
with:
# TODO CU-869a25n7e Use Trusted Platform Publisher based PyPI release
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: v1/medcat/dist