Skip to content

Commit

Permalink
feat: add codecov to track test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
fschuch committed Feb 8, 2024
1 parent 374204a commit fab23de
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 24 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/test_on_push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ jobs:
poetry env use "3.8"
make qa
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
working-directory: jobbergate-core
flags: core
env_vars: OS,PYTHON
token: ${{ secrets.CODECOV_TOKEN }}
file: tests/coverage.xml
disable_search: true
fail_ci_if_error: true

api-tests:
name: "jobbergate-api tests"
runs-on: "ubuntu-20.04"
Expand All @@ -41,6 +52,17 @@ jobs:
working-directory: ./jobbergate-composed
run: docker-compose build jobbergate-api-qa && docker-compose run --rm jobbergate-api-qa

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
working-directory: jobbergate-api
flags: api
env_vars: OS,PYTHON
token: ${{ secrets.CODECOV_TOKEN }}
file: tests/coverage.xml
disable_search: true
fail_ci_if_error: true

cli-tests:
name: "jobbergate-cli tests"
runs-on: "ubuntu-20.04"
Expand All @@ -64,6 +86,17 @@ jobs:
poetry env use "3.8"
make qa
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
working-directory: jobbergate-cli
flags: cli
env_vars: OS,PYTHON
token: ${{ secrets.CODECOV_TOKEN }}
file: tests/coverage.xml
disable_search: true
fail_ci_if_error: true

agent-tests:
name: "jobbergate-agent tests"
runs-on: "ubuntu-20.04"
Expand All @@ -86,3 +119,14 @@ jobs:
run: |
poetry env use "3.8"
make qa
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
working-directory: jobbergate-agent
flags: agent
env_vars: OS,PYTHON
token: ${{ secrets.CODECOV_TOKEN }}
file: tests/coverage.xml
disable_search: true
fail_ci_if_error: true
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
![Build Status](https://img.shields.io/github/actions/workflow/status/omnivector-solutions/jobbergate/test_on_push.yaml?branch=main&label=main-build&logo=github&style=plastic)
[![codecov](https://codecov.io/gh/omnivector-solutions/jobbergate/graph/badge.svg?token=Z0DGK5562T)](https://codecov.io/gh/omnivector-solutions/jobbergate)
![GitHub Issues](https://img.shields.io/github/issues/omnivector-solutions/jobbergate?label=issues&logo=github&style=plastic)
![Pull Requests](https://img.shields.io/github/issues-pr/omnivector-solutions/jobbergate?label=pull-requests&logo=github&style=plastic)
![GitHub Contributors](https://img.shields.io/github/contributors/omnivector-solutions/jobbergate?logo=github&style=plastic)


> An [Omnivector](https://www.omnivector.io/) initiative
>
> [![omnivector-logo](https://omnivector-public-assets.s3.us-west-2.amazonaws.com/branding/omnivector-logo-text-black-horz.png)](https://www.omnivector.io/)
# Jobbergate


Jobbergate is a job templating and submission system that integrates with Slurm to
enable the re-use and remote submission of job scripts to a Slurm cluster.

Expand All @@ -20,6 +19,5 @@ repository:
* [jobbergate-api](https://github.com/omnivector-solutions/jobbergate/jobbergate-api)
* [jobbergate-cli](https://github.com/omnivector-solutions/jobbergate/jobbergate-cli)


The complete documentation for Jobbergate can be viewed at the
[Jobbergate Documentation](https://omnivector-solutions.github.io/jobbergate/) site.
9 changes: 9 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
flag_management:
default_rules: # the rules that will be followed for any flag added, generally
carryforward: true
statuses:
- type: project
target: auto
threshold: 1%
- type: patch
target: 90%
12 changes: 6 additions & 6 deletions jobbergate-agent/poetry.lock

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

9 changes: 6 additions & 3 deletions jobbergate-agent/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ freezegun = "^1.2.2"
isort = "^5.9.3"
mypy = "^0.931"
pytest-asyncio = "^0.18.2"
pytest-cov = "^3.0.0"
pytest-cov = "^4.0.0"
pytest-env = "^0.6.2"
pytest-mock = "^3.7.0"
pytest-random-order = "^1.0.4"
Expand All @@ -75,8 +75,7 @@ asyncio_mode = "auto"
addopts = [
"--random-order",
"--cov=jobbergate_agent",
"--cov-report=term-missing",
"--cov-fail-under=90",
"--cov-report=xml:tests/coverage.xml",
]
env = [
"JOBBERGATE_AGENT_OIDC_DOMAIN = auth.com",
Expand All @@ -85,6 +84,10 @@ env = [
"JOBBERGATE_AGENT_SLURMRESTD_JWT_KEY_STRING = DUMMY-JWT-SECRET",
]

[tool.coverage.report]
fail_under = 90
show_missing = true

[tool.black]
line-length = 120

Expand Down
2 changes: 1 addition & 1 deletion jobbergate-api/poetry.lock

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

12 changes: 6 additions & 6 deletions jobbergate-api/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ auto-name-enum = "^2.0.0"
[tool.poetry.group.dev.dependencies]
asgi-lifespan = "^1.0.1"
black = "^23"
coverage = { extras = ["toml"], version = "^7.2.7" }
flake8-docstrings = "^1.6.0"
ipython = "^7.31.1"
isort = "^5.9.3"
Expand Down Expand Up @@ -93,8 +92,12 @@ ignore = "W503,D200,D106,D402"


[tool.pytest.ini_options]
minversion = "6.0"
addopts = ["--random-order", "--cov=jobbergate_api"]
minversion = "7.0"
addopts = [
"--random-order",
"--cov=jobbergate_api",
"--cov-report=xml:tests/coverage.xml",
]
testpaths = ["tests"]
asyncio_mode = "auto"
env = [
Expand All @@ -115,9 +118,6 @@ concurrency = ["greenlet", "thread"]
fail_under = 90
show_missing = true

[tool.coverage.html]
show_contexts = true

[tool.mypy]
plugins = ["pydantic.mypy", "sqlalchemy.ext.mypy.plugin"]
follow_imports = "silent"
Expand Down
9 changes: 6 additions & 3 deletions jobbergate-cli/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ minversion = "7.0"
addopts = [
"--random-order",
"--cov=jobbergate_cli",
"--cov-report=term-missing",
"--cov-fail-under=85",
"--cov-report=xml:tests/coverage.xml",
]
env = [
"ARMADA_API_BASE = https://some-pretend-armada-url.com",
Expand All @@ -70,9 +69,13 @@ env = [
"OIDC_DOMAIN = dummy_auth_domain.com",
"OIDC_AUDIENCE = https://dummy_auth_audience.com",
"OIDC_CLIENT_ID = dummy_client_id",
"MULTI_TENANCY_ENABLED = false"
"MULTI_TENANCY_ENABLED = false",
]

[tool.coverage.report]
fail_under = 85
show_missing = true

[tool.black]
line-length = 120

Expand Down
7 changes: 5 additions & 2 deletions jobbergate-core/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,13 @@ minversion = "6.0"
addopts = [
"--random-order",
"--cov=jobbergate_core",
"--cov-report=term-missing",
"--cov-fail-under=85",
"--cov-report=xml:tests/coverage.xml",
]

[tool.coverage.report]
fail_under = 85
show_missing = true

[tool.black]
line-length = 120

Expand Down

0 comments on commit fab23de

Please sign in to comment.