Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/test-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ jobs:
with:
python-version: '3.9'

- name: Install uv and create virtual environment
run: |
make uv
make uv-venv

- name: Verify
run: make verify

- name: Run Tests
run: |
make test-python xml=true

- name: Upload coverage to Coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
coveralls --verbose || echo "Coveralls report failed"
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ __debug_bin
# Python cache files
__pycache__/
*.egg-info/
bin

.coverage
bin
20 changes: 15 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,24 @@ uv: ## Install UV
ruff: ## Install Ruff
@uvx ruff --help &> /dev/null || uv tool install ruff


.PHONY: verify
verify: uv ruff ## install all required tools
@cd $(PY_DIR) && uv lock --check
@cd $(PY_DIR) && uvx ruff check --show-fixes

.PHONY: test-python
test-python: ## Run Python unit test.
uv install --dev
PYTHONPATH=$(PROJECT_DIR) pytest ./python/kubeflow
.PHONY: uv-venv
uv-venv:
uv venv
source .venv/bin/activate

# make test-unit will produce html coverage by default. Run with `make test-unit report=xml` to produce xml report.
.PHONY: test-python
test-python:
uv pip install "./python[test]"
coverage run --source=kubeflow.trainer.api.trainer_client,kubeflow.trainer.utils.utils -m pytest ./python/kubeflow/trainer/api/trainer_client_test.py
coverage report -m kubeflow/trainer/api/trainer_client.py kubeflow/trainer/utils/utils.py
ifeq ($(report),xml)
coverage xml
else
coverage html
endif
Loading
Loading