From 8ac144b1497a58516a06ba9939a2875390683e90 Mon Sep 17 00:00:00 2001 From: DanielAvdar <66269169+DanielAvdar@users.noreply.github.com> Date: Thu, 20 Mar 2025 21:31:42 +0200 Subject: [PATCH 1/3] Add Codecov CI workflow and update Makefile coverage command Introduce a GitHub Actions workflow for Codecov to track code coverage metrics, triggered on pushes, pull requests, or manually. Update the Makefile to align the coverage and mypy commands with the placeholder package name "my_pkg," with a note to replace it with the actual package name. Signed-off-by: DanielAvdar <66269169+DanielAvdar@users.noreply.github.com> --- .github/workflows/codecov.yml | 31 +++++++++++++++++++++++++++++++ Makefile | 4 ++-- 2 files changed, 33 insertions(+), 2 deletions(-) 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..dd21942 --- /dev/null +++ b/.github/workflows/codecov.yml @@ -0,0 +1,31 @@ +name: Codecov +on: + pull_request: + paths: + - 'my_pkg/**' # todo: change my_pkg to the name of the package + - 'tests/**' + - '.github/workflows/codecov.yml' + push: + branches: + - main + workflow_dispatch: +jobs: + upload-coverage-report: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: pipx install poetry + - uses: actions/setup-python@v5 + with: + python-version: '3.11' + cache: poetry + + - run: poetry install + - run: poetry run pytest --cov=pandas_pyarrow --cov-report=xml + - uses: codecov/codecov-action@v4 + with: + fail_ci_if_error: true + verbose: true + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + continue-on-error: true diff --git a/Makefile b/Makefile index a068277..b870c7a 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ check: uv run pre-commit run --all-files coverage: - uv run pytest --cov=ml_orchestrator --cov-report=xml + uv run pytest --cov=my_pkg --cov-report=xml # todo: change my_pkg to the name of the package mypy: - uv tool run mypy . --config-file pyproject.toml + uv tool run mypy my_pkg --config-file pyproject.toml # todo: change my_pkg to the name of the package From 097e728e0853721c4f8125b0c39595e93d358ebf Mon Sep 17 00:00:00 2001 From: DanielAvdar <66269169+DanielAvdar@users.noreply.github.com> Date: Thu, 20 Mar 2025 21:34:59 +0200 Subject: [PATCH 2/3] Update pytest coverage command to include JUnit XML output Added `--junitxml` flag to generate JUnit-style XML reports and configured it to use the legacy format. This enhances compatibility with tools that consume test reports in JUnit format. Signed-off-by: DanielAvdar <66269169+DanielAvdar@users.noreply.github.com> --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b870c7a..a421bf0 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,8 @@ check: uv run pre-commit run --all-files coverage: - uv run pytest --cov=my_pkg --cov-report=xml # todo: change my_pkg to the name of the package + uv run pytest --cov=my_pkg --cov-report=xml --junitxml=junit.xml -o junit_family=legacy + # todo: change my_pkg to the name of the package mypy: uv tool run mypy my_pkg --config-file pyproject.toml # todo: change my_pkg to the name of the package From ef3d0771f54eba523f0b702ba0d0d18ccc9612ff Mon Sep 17 00:00:00 2001 From: DanielAvdar <66269169+DanielAvdar@users.noreply.github.com> Date: Thu, 20 Mar 2025 21:43:46 +0200 Subject: [PATCH 3/3] Remove uv-pre-commit hook from configuration The uv-pre-commit hook and its related configuration were deleted from the .pre-commit-config.yaml file. This change simplifies the setup by eliminating an unused or unnecessary hook. Signed-off-by: DanielAvdar <66269169+DanielAvdar@users.noreply.github.com> --- .pre-commit-config.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index dd7b7df..d02b708 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,8 +13,3 @@ repos: args: [ --preview, --config=pyproject.toml ] - id: ruff args: [ --preview, --fix,--unsafe-fixes, --config=pyproject.toml ] - - - repo: https://github.com/astral-sh/uv-pre-commit - rev: 0.5.13 - hooks: - - id: uv-lock