Skip to content

Merge pull request #477 from VectorInstitute/pre-commit-ci-update-config #2940

Merge pull request #477 from VectorInstitute/pre-commit-ci-update-config

Merge pull request #477 from VectorInstitute/pre-commit-ci-update-config #2940

Workflow file for this run

# only has to pass for python 3.10
name: PyTest Unit Tests
on:
push:
branches:
main
pull_request:
branches:
main
jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
actions: write
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Python 3.10
uses: actions/setup-python@v6
with:
python-version: "3.10"
# Display the Python version being used
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Set up cache
uses: actions/cache@v5
id: cached-poetry-dependencies
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
run: poetry install --with "dev, test"
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
- name: Run Tests
run: |
source .venv/bin/activate
pytest -m "not smoketest" -v --cov fl4health --cov-report=xml tests
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: VectorInstitute/FL4Health
fail_ci_if_error: true
verbose: true
# Deleting some temporary files and useless folders to free up space in order to have space for
# the cache file, and printing the disk space info at the beggining and end.
# Deleting poetry cache should clear ~4GB of space.
# Deleting /usr/share/dotnet should clear ~4GB of space.
# Deleting /usr/local/lib/android should clear ~12GB of space.
- name: Cleanup space (before cache save)
run: |
df -h /dev/root
poetry cache clear --all . --no-interaction
sudo rm -rf /usr/share/dotnet /usr/local/lib/android
df -h /dev/root