Skip to content

Disiable fail on coverage #72

Disiable fail on coverage

Disiable fail on coverage #72

Workflow file for this run

name: Perform Checks
on:
pull_request:
branches:
- main
workflow_dispatch:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPOSITORY_NAME: 'action-demo'
THRESHOLD: 0.9
permissions: write-all
jobs:
standard-checks:
name: Perform Standard Checks
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Install Dependencies
run: python3 -m pip install -r requirements.txt
- name: Run Pylint
uses: dciborow/[email protected]
with:
github_token: ${{ secrets.github_token }}
# Change reviewdog reporter if you need [github-pr-check,github-check,github-pr-review].
reporter: github-pr-review
# Change reporter level if you need.
# GitHub Status Check won't become failure with warning.
level: warning
glob_pattern: "sources/**/*.py"
- name: Behave Tests
run: coverage run --source="sources" -m behave tests/qualification_tests
- name: Generate XML coverage report
run: coverage xml
- name: Get Coverage
uses: orgoro/[email protected]
with:
coverageFile: coverage.xml
token: ${{ secrets.GITHUB_TOKEN }}
thresholdAll: ${{ env.THRESHOLD }}
- name: Retrieve Total Coverage
id: coverage
if: '!cancelled()'
run: echo "TOTAL_COVERAGE=$(coverage report | grep TOTAL | awk '{ print $4 }' | sed 's/%//g')" >> "$GITHUB_ENV"
- name: Retrieve Coverage Color
if: '!cancelled()'
uses: jannekem/run-python-script-action@v1
id: coverage-color
with:
fail-on-error: false
script: |
if (int("${{ env.TOTAL_COVERAGE }}") / 100.0) < float("${{ env.THRESHOLD }}"):
print("red", end='')
else:
print("green", end='')
- name: Retrieve Release Version
id: version
if: '!cancelled()'
run: echo "VERSION=$(python3 setup.py --version)" >> "$GITHUB_ENV"
- name: Add Badges
if: '!cancelled()'
# You may pin to the exact commit or the version.
# uses: wow-actions/add-badges@43f2c1eaecfb2596b89a8136a3fbda4f18d1d188
uses: wow-actions/[email protected]
env:
repo_url: ${{ github.event.repository.html_url }}
repo_name: ${{ github.event.repository.name }}
repo_owner: ${{ github.event.repository.owner.login }}
with:
# Your GitHub token for authentication.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# The badges to add with JSON format
badges: |
[
{
"badge": "https://img.shields.io/badge/License-MIT-yellow.svg?style=for-the-badge",
"alt": "MIT License",
"link": "${{ env.repo_url }}/blob/main/LICENSE"
},
{
"badge": "https://img.shields.io/badge/Language-Python-blue?style=for-the-badge&logo=python",
"alt": "Language",
"link": "https://www.python.org/"
},
{
"badge": "https://img.shields.io/badge/PRs-Welcome-brightgreen.svg?style=for-the-badge",
"alt": "PRs Welcome",
"link": "${{ env.repo_url }}/pulls"
},
{
"badge": "https://img.shields.io/badge/testpypi-${{ env.VERSION }}-3775A9?style=for-the-badge&logo=pypi&logoColor=white&label=Test--PyPi&labelColor=3775A9"
"alt": "Test PyPi ${{ env.VERSION }}",
"link": "https://test.pypi.org/project/${{ env.REPOSITORY_NAME }}/"
},
{
"badge": "https://img.shields.io/badge/pypi-${{ env.VERSION }}-3775A9?style=for-the-badge&logo=pypi&logoColor=white&label=PyPi&labelColor=3775A9"
"alt": "PyPi ${{ env.VERSION }}",
"link": "https://pypi.org/project/${{ env.REPOSITORY_NAME }}/"
},
{
"badge": "https://img.shields.io/badge/Coverage-${{ env.TOTAL_COVERAGE }}%25-${{ steps.coverage-color.outputs.stdout }}.svg?style=for-the-badge",
"alt": "Coverage ${{ env.TOTAL_COVERAGE }}%"
}
]
# Path and file name to add badges
path: README.md
# Should center align the badges
center: false