Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RSPEED-189] Run unit tests in GitHub actions #20

Merged
merged 2 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
39 changes: 39 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Unit tests

on: [push, pull_request]

jobs:
unit_tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.12']

steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Setup PDM
uses: pdm-project/setup-pdm@v4
with:
python-version: ${{ matrix.python-version }}
cache: true

- name: Install dependencies
run: make install

- name: Run unit tests
run: pdm run unit-test

- name: Generate coverage report
run: pdm run coverage

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ unit-test: ## Unit test Command Line Assistant
@echo "Tests completed."

coverage: ## Generate coverage report from unit-tests
coverage xml
@coverage xml

help: ## Show available make commands
@echo 'Usage: make <OPTIONS> ... <TARGETS>'
Expand All @@ -37,3 +37,4 @@ clean: ## Clean project files
@find . -name '*.pyc' -exec rm -f {} +
@find . -name '*.pyo' -exec rm -f {} +
@rm -rf .pdm-build .ruff_cache .coverage .pdm-python dist
@coverage erase
113 changes: 2 additions & 111 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 11 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,19 @@ distribution = true

[tool.pdm.dev-dependencies]
dev = [
"pytest>=8.3.3",
"tox>=4.23.2",
"pytest-cov>=6.0.0",
"pytest-randomly>=3.16.0",
"coverage>=7.6.4",
"pytest-sugar>=1.0.0",
"pytest-clarity>=1.0.1",
"pytest==8.3.3",
"pytest-cov==6.0.0",
"pytest-randomly==3.16.0",
"coverage==7.6.4",
"pytest-sugar==1.0.0",
"pytest-clarity==1.0.1",
]

[tool.pdm.scripts]
unit-test = "pdm run make unit-test"
coverage = "pdm run make coverage"


[tool.pytest.init_options]
testpaths = ["tests"]
addopts = ["--cov-report=term-missing", "--cov-report=html"]
Expand Down
20 changes: 0 additions & 20 deletions tox.ini

This file was deleted.