MedCAT-nightly-stability-check #80
This file contains hidden or 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: MedCAT-nightly-stability-check | |
| permissions: | |
| contents: read | |
| on: | |
| schedule: | |
| - cron: "0 3 * * *" # every day at 3am UTC | |
| workflow_dispatch: # allow manual runs | |
| pull_request: | |
| paths: | |
| - ".github/workflows/medcat-v2-lib-stability.yml" | |
| defaults: | |
| run: | |
| working-directory: ./medcat-v2 | |
| jobs: | |
| warm_hf_cache: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: astral-sh/setup-uv@v7 | |
| with: | |
| # start at lowest possible | |
| python-version: "3.10" | |
| - name: Install with latest deps | |
| shell: bash | |
| run: | | |
| uv run python -m ensurepip | |
| uv run python -m pip install --upgrade pip | |
| uv run python -m pip install ".[spacy,deid,meta-cat,rel-cat,dict-ner,dev]" | |
| - name: Pre-download models | |
| run: | | |
| df -h | |
| uv run python tests/other/download_all_transformers_models.py | |
| df -h | |
| - name: Upload HF cache | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: hf-cache | |
| path: ~/.cache/huggingface | |
| test: | |
| needs: warm_hf_cache | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| python-version: [ "3.10", "3.11", "3.12", "3.13"] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/download-artifact@v7 | |
| with: | |
| name: hf-cache | |
| path: ~/.cache/huggingface | |
| - uses: astral-sh/setup-uv@v7 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: 🧹 Free up disk space (Linux only) | |
| if: runner.os == 'Linux' | |
| run: | | |
| df -h # Optional: Check space before build | |
| # Remove large, unnecessary packages/tools | |
| sudo rm -rf /usr/share/dotnet | |
| sudo rm -rf /usr/local/lib/android | |
| sudo rm -rf /usr/share/swift | |
| sudo rm -rf /usr/share/rust | |
| sudo rm -rf /usr/share/powershell | |
| # Remove cached tools and files | |
| sudo apt-get clean | |
| df -h # Optional: Check space before build | |
| - name: Install with latest deps | |
| shell: bash | |
| run: | | |
| uv run --python ${{ matrix.python-version }} python -m ensurepip | |
| uv run --python ${{ matrix.python-version }} python -m pip install --upgrade pip | |
| # install cpu-only torch for MacOS | |
| if [[ "$RUNNER_OS" == "macOS" ]]; then | |
| uv run --python ${{ matrix.python-version }} python -m pip install torch --index-url https://download.pytorch.org/whl/cpu | |
| fi | |
| uv run --python ${{ matrix.python-version }} python -m pip install ".[spacy,deid,meta-cat,rel-cat,dict-ner,dev]" | |
| - name: Check types | |
| run: | | |
| uv run --python ${{ matrix.python-version }} python -m mypy --follow-imports=normal medcat | |
| - name: Ruff linting | |
| run: | | |
| uv run --python ${{ matrix.python-version }} python -m ruff check medcat --preview | |
| - name: Test | |
| run: | | |
| uv run --python ${{ matrix.python-version }} python -m unittest discover -v | |
| timeout-minutes: 45 | |
| - name: Model regression | |
| run: | | |
| uv run --python ${{ matrix.python-version }} bash tests/backwards_compatibility/run_current.sh |