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

Feature/issue 102 add code coverage #111

Merged
merged 5 commits into from
Apr 22, 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
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ env:
jobs:
run_tests:
uses: ./.github/workflows/run_tests.yml
secrets:
codecov_token: ${{ secrets.CODECOV_TOKEN }}

bump_version:
needs: run_tests
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@ name: Receive PR
on:
pull_request:
# Sequence of patterns matched against refs/heads
branches: [ feature/**, issue/**, issues/** ]
branches:
- feature/**
- issue/**
- issues/**

jobs:
build_and_test:
uses: ./.github/workflows/run_tests.yml
secrets:
codecov_token: ${{ secrets.CODECOV_TOKEN }}
34 changes: 15 additions & 19 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,32 @@ name: A reusable workflow to build and run the unit test suite

on:
workflow_call:
secrets:
codecov_token:
required: true
workflow_dispatch:

env:
POETRY_VERSION: "1.3.2"
PYTHON_VERSION: "3.10"

jobs:
build_and_test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.10' ]

name: Python ${{ matrix.python-version }} tests
steps:
- uses: actions/checkout@v4
- name: Retrieve repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
python-version: ${{ env.PYTHON_VERSION }}

- name: Set up Poetry
uses: abatilo/actions-poetry@v3.0.0
with:
poetry-version: 1.3.2
poetry-version: ${{ env.POETRY_VERSION }}

- name: Install package
run: poetry install
Expand All @@ -41,16 +45,8 @@ jobs:
run: |
poetry run pytest --cov=batcher --cov-report=xml:build/reports/coverage.xml --cov-report=html:build/reports/coverage.html tests/

- name: Archive code coverage report (xml)
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: code coverage report (xml)
path: build/reports/coverage.xml

- name: Archive code coverage report (HTML)
if: ${{ always() }}
uses: actions/upload-artifact@v4
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
name: code coverage report (HTML)
path: build/reports/coverage.html
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ repos:

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: 'v0.3.5'
rev: 'v0.4.1'
hooks:
- id: ruff
args: [ "--fix" ]

# https://github.com/python/black#version-control-integration
- repo: https://github.com/psf/black
rev: 24.3.0
rev: 24.4.0
hooks:
- id: black-jupyter

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [PR #75](https://github.com/danielfromearth/batchee/pull/75): Add Docker build steps to GitHub Actions workflow
- [PR #84](https://github.com/danielfromearth/batchee/pull/84): Add readme badges
- [PR #100](https://github.com/danielfromearth/batchee/pull/100): Add license
- [PR #111](https://github.com/nasa/batchee/pull/111): Add codecov to CI pipeline
### Changed
- [issue/11](https://github.com/danielfromearth/batchee/issues/11): Rename from concat_batcher to batchee
- [issue/21](https://github.com/danielfromearth/batchee/issues/21): Improve CICD workflows
Expand Down
28 changes: 14 additions & 14 deletions poetry.lock

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

2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ exclude = [
"_typed_ops.pyi",
]
target-version = "py310"

[tool.ruff.lint]
# E402: module level import not at top of file
# E501: line too long - let black worry about that
# E731: do not assign a lambda expression, use a def
Expand Down