From 4918b68ea9e5c60def8b1d7d82358f2d05172587 Mon Sep 17 00:00:00 2001 From: Egor Kostan Date: Wed, 24 Sep 2025 22:14:20 -0700 Subject: [PATCH 1/6] Create codecov.yml --- .github/workflows/codecov.yml | 43 +++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/codecov.yml diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml new file mode 100644 index 0000000..39f4d85 --- /dev/null +++ b/.github/workflows/codecov.yml @@ -0,0 +1,43 @@ +--- +name: Codecov Coverage Report + +on: # yamllint disable-line rule:truthy + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + run: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + python-version: ["3.12"] + steps: + - uses: actions/checkout@main + - name: Setup Python + uses: actions/setup-python@main + with: + python-version: ${{ matrix.python-version }} + - name: Install prerequisites + run: | + python -m pip install --upgrade pip setuptools wheel + pip install -r requirements.txt + - name: Install pytest, pytest-cov + run: | + pip install pytest + pip install pytest-cov + - name: Generate coverage report + # yamllint disable rule:line-length + run: | + python -c "import os; print(os.getcwd())" + python -m pytest tests/ -v --cov-report term-missing --cov=lessons --cov-report=xml + # yamllint enable rule:line-length + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v5.5.0 + with: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + files: coverage.xml + fail_ci_if_error: true # optional (default = false) + verbose: true # optional (default = false)cd \ No newline at end of file From 6504d60592830aa937a8046d41fcc404cd82fc4b Mon Sep 17 00:00:00 2001 From: Egor Kostan Date: Wed, 24 Sep 2025 22:17:29 -0700 Subject: [PATCH 2/6] Pytest --- .github/workflows/codecov.yml | 2 +- pytest.ini | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 pytest.ini diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 39f4d85..ccb3a49 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -32,7 +32,7 @@ jobs: # yamllint disable rule:line-length run: | python -c "import os; print(os.getcwd())" - python -m pytest tests/ -v --cov-report term-missing --cov=lessons --cov-report=xml + python -m pytest . -v --cov-report term-missing --cov=lessons --cov-report=xml # yamllint enable rule:line-length - name: Upload coverage to Codecov uses: codecov/codecov-action@v5.5.0 diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..1096048 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,4 @@ +[pytest] +pythonpath = . +junit_duration_report = call +python_files = *.py \ No newline at end of file From f4cd22f814bece5c35212b3aeb07a0eca90bf51e Mon Sep 17 00:00:00 2001 From: Egor Kostan Date: Wed, 24 Sep 2025 22:19:12 -0700 Subject: [PATCH 3/6] Create .coveragerc --- .coveragerc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .coveragerc diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..3c420d5 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,21 @@ +[run] +# include = */src/* +# omit anything in a virtualenv directory anywhere +omit = + /home/travis/virtualenv/* + *.yml + /home/travis/img/* + __init__* + *.md + docs/* + venv/* + *.gif + *.html + /tests/* + +[report] +; Regexes for lines to exclude from consideration + +exclude_also = + ; Don't complain if non-runnable code isn't run: + if __name__ == .__main__.: \ No newline at end of file From 5e99996160616a1a5c6aaf8bd16ee89e84206b8e Mon Sep 17 00:00:00 2001 From: Egor Kostan Date: Wed, 24 Sep 2025 22:25:00 -0700 Subject: [PATCH 4/6] Update codecov.yml --- .github/workflows/codecov.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index ccb3a49..307f001 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -32,7 +32,7 @@ jobs: # yamllint disable rule:line-length run: | python -c "import os; print(os.getcwd())" - python -m pytest . -v --cov-report term-missing --cov=lessons --cov-report=xml + python -m pytest . --ignore=solutions --log-cli-level=INFO -v --cov-report term-missing --cov=lessons --cov-report=xml # yamllint enable rule:line-length - name: Upload coverage to Codecov uses: codecov/codecov-action@v5.5.0 From e5c46ee694fe2d72bec387ba7bd26790e246ffdc Mon Sep 17 00:00:00 2001 From: Egor Kostan Date: Wed, 24 Sep 2025 22:28:59 -0700 Subject: [PATCH 5/6] Update codecov.yml --- .github/workflows/codecov.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 307f001..14d96d7 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -32,7 +32,7 @@ jobs: # yamllint disable rule:line-length run: | python -c "import os; print(os.getcwd())" - python -m pytest . --ignore=solutions --log-cli-level=INFO -v --cov-report term-missing --cov=lessons --cov-report=xml + python -m pytest . --ignore=solutions --log-cli-level=INFO -v --cov-report term-missing --cov --cov-branch --cov-report=xml # yamllint enable rule:line-length - name: Upload coverage to Codecov uses: codecov/codecov-action@v5.5.0 From b3aa6847cddbdccdf172de78f7006b0baf0784c7 Mon Sep 17 00:00:00 2001 From: Egor Kostan Date: Wed, 24 Sep 2025 22:34:13 -0700 Subject: [PATCH 6/6] Update codecov.yml --- .github/workflows/codecov.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 14d96d7..075ac9d 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -33,11 +33,14 @@ jobs: run: | python -c "import os; print(os.getcwd())" python -m pytest . --ignore=solutions --log-cli-level=INFO -v --cov-report term-missing --cov --cov-branch --cov-report=xml + - name: List test files + run: | + ls *.xml # yamllint enable rule:line-length - name: Upload coverage to Codecov uses: codecov/codecov-action@v5.5.0 with: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + token: ${{ secrets.CODECOV_TOKEN }} files: coverage.xml fail_ci_if_error: true # optional (default = false) verbose: true # optional (default = false)cd \ No newline at end of file