-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* use `python-coverage-comment` to run github actions/checks --------- Co-authored-by: Aldrian Harjati <[email protected]>
- Loading branch information
Showing
10 changed files
with
131 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
kedro==0.18.7 | ||
black==23.3.0 | ||
ruff==0.0.259 | ||
pandas==1.5.3 | ||
pandera==0.14.5 | ||
ipykernel | ||
openpyxl | ||
pytest | ||
pytest==7.4.0 | ||
pytest-cov==4.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Coverage | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["Tests"] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
coverage: | ||
name: Run tests & display coverage | ||
runs-on: ubuntu-latest | ||
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' | ||
permissions: | ||
# Gives the action the necessary permissions for publishing new | ||
# comments in pull requests. | ||
pull-requests: write | ||
# Gives the action the necessary permissions for editing existing | ||
# comments (to avoid publishing multiple comments in the same PR) | ||
contents: write | ||
# Gives the action the necessary permissions for looking up the | ||
# workflow that launched this workflow, and download the related | ||
# artifact that contains the comment to be published | ||
actions: read | ||
steps: | ||
- name: Post comment | ||
uses: py-cov-action/python-coverage-comment-action@v3 | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GITHUB_PR_RUN_ID: ${{ github.event.workflow_run.id }} | ||
verbose: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Linters | ||
|
||
on: [push] | ||
|
||
jobs: | ||
black: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: psf/black@stable | ||
ruff: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: chartboost/ruff-action@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Tests | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- "main" | ||
|
||
jobs: | ||
unit-tests: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
# Gives the action the necessary permissions for publishing new | ||
# comments in pull requests. | ||
pull-requests: write | ||
# Gives the action the necessary permissions for pushing data to the | ||
# python-coverage-comment-action branch, and for editing existing | ||
# comments (to avoid publishing multiple comments in the same PR) | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python 3.11 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.11 | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
if [ -f .devcontainer/requirements.txt ]; then pip install -r .devcontainer/requirements.txt; fi | ||
- name: Launch tests & generate report | ||
run: pytest | ||
- name: Coverage comment | ||
id: coverage_comment | ||
uses: py-cov-action/python-coverage-comment-action@v3 | ||
with: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
verbose: true | ||
- name: Store Pull Request comment to be posted | ||
uses: actions/upload-artifact@v3 | ||
if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true' | ||
with: | ||
# If you use a different name, update COMMENT_ARTIFACT_NAME accordingly | ||
name: python-coverage-comment-action | ||
# If you use a different name, update COMMENT_FILENAME accordingly | ||
path: python-coverage-comment-action.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[tool:pytest] | ||
addopts = | ||
--cov-report term-missing --cov-branch --cov-report xml --cov-report term | ||
--cov=src -vv --strict-markers -rfE | ||
|
||
testpaths = | ||
src/tests | ||
|
||
[coverage:run] | ||
relative_files = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import os | ||
import re | ||
import sys | ||
|
||
import pandas as pd | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters