Skip to content

Merge pull request #244 from monarch-initiative/feature/mechanism-emb… #492

Merge pull request #244 from monarch-initiative/feature/mechanism-emb…

Merge pull request #244 from monarch-initiative/feature/mechanism-emb… #492

Workflow file for this run

# Built from:
# https://docs.github.com/en/actions/guides/building-and-testing-python
---
name: Build and test
on: # yamllint disable-line rule:truthy
push:
branches: [main]
pull_request:
env:
FORCE_COLOR: "1" # Make tools pretty.
permissions: {}
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.13"]
fail-fast: false
steps:
# https://github.com/actions/checkout
- name: Check out repository
uses: actions/checkout@v6
with:
persist-credentials: false
- name: Check for changes
uses: dorny/paths-filter@v3
id: changes
with:
list-files: shell
filters: |
src:
- 'src/**'
- 'tests/**'
- 'pyproject.toml'
- 'uv.lock'
kb_disorders:
- 'kb/disorders/**/*.yaml'
- '!kb/disorders/**/*.history.yaml'
kb_comorbidities:
- 'kb/comorbidities/**/*.yaml'
# https://github.com/astral-sh/setup-uv
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
cache-dependency-glob: "uv.lock"
# https://github.com/actions/setup-python
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6.2.0
with:
python-version: ${{ matrix.python-version }}
- name: Install just
run: |
uv tool install rust-just
- name: Install project
run: uv sync --dev
- name: Validate changed disorder KB files
if: steps.changes.outputs.kb_disorders == 'true'
run: |
echo "Validating changed disorder KB files..."
for f in ${{ steps.changes.outputs.kb_disorders_files }}; do
if [[ "$f" == kb/disorders/* && "$f" == *.yaml && "$f" != *.history.yaml ]]; then
echo "=== Validating disorder: $f ==="
just validate "$f"
else
echo "Skipping non-disorder file: $f"
fi
done
- name: Validate changed comorbidity KB files
if: steps.changes.outputs.kb_comorbidities == 'true'
run: |
echo "Validating changed comorbidity KB files..."
for f in ${{ steps.changes.outputs.kb_comorbidities_files }}; do
if [[ "$f" == kb/comorbidities/* && "$f" == *.yaml ]]; then
echo "=== Validating comorbidity: $f ==="
just validate-comorbidity "$f"
else
echo "Skipping non-comorbidity file: $f"
fi
done
- name: Run test suite
if: steps.changes.outputs.src == 'true'
run: just test