Skip to content

3rd commit

3rd commit #1

Workflow file for this run

name: PR Coverage Diff - CI
on:
pull_request:
jobs:
run-tests:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-versions:
- "3.11"
name: Test Job
runs-on: ${{matrix.os}}
steps:
# - name: Checkout target branch to get old lcov file
# uses: actions/checkout@v2
# with:
# ref: ${{ github.event.pull_request.base.ref }}
# - name: Get old lcov file
# run: mv old-lcov/old-lcov.lcov old-lcov.lcov
# - name: Upload old lcov file
# uses: actions/upload-artifact@v3
# with:
# name: old-lcov
# path: old-lcov.lcov
- name: Checkout PR branch
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
# - name: Download old lcov file
# uses: actions/download-artifact@v3
# with:
# name: old-lcov
# path: .
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: ${{matrix.python-versions}}
- name: Install Dependencies
run: python -m pip install pytest pytest-cov coverage-lcov pytest-json-report
- name: Run tests
run: pytest -o junit_family=xunit2 --junitxml result.xml -v --ff --cov=main --cov=additional_func --cov-report=xml --cov-report=term
- name: Coverage Report
if: always()
uses: aGallea/[email protected]
with:
min-coverage-percentage: '10'
fail-under-coverage-percentage: 'true'
cobertura-path: ./coverage.xml
junit-path: ./result.xml
# - name: Convert schema
# run: coverage xml -o coverage_cobertura.xml
# #test comment, trigger change
# - name: Make lcov file
# run: coverage lcov -o current-lcov.lcov
# - name: Make coverage summary file
# run: pytest --json-report --json-report-summary
# - name: Rename and relocate it
# run: mkdir coverage && mv .report.json coverage/coverage-summary.json
# - name: Code Coverage Report
# uses: irongut/[email protected]
# with:
# filename: coverage_cobertura.xml
# badge: true
# fail_below_min: true
# format: markdown
# hide_branch_rate: false
# hide_complexity: true
# indicators: true
# output: both
# thresholds: '30 80'
# - name: Add Coverage PR Comment
# uses: marocchino/sticky-pull-request-comment@v2
# if: github.event_name == 'pull_request'
# with:
# recreate: true
# path: code-coverage-results.md
# - name: Generate Code Coverage report
# id: code-coverage
# uses: barecheck/code-coverage-action@v1
# with:
# barecheck-github-app-token: ${{ secrets.BARECHECK_GITHUB_APP_TOKEN }}
# lcov-file: "current-lcov.lcov"
# base-lcov-file: "old-lcov.lcov"
# #minimum-ratio: 0 # Fails Github action once code coverage is decreasing
# send-summary-comment: true
# show-annotations: "warning" # Possible options warning|error
# - name: Coverage Diff
# uses: greatwizard/coverage-diff-action@v1
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# - name: Upload current lcov file
# uses: actions/upload-artifact@v3
# with:
# name: current-lcov
# path: current-lcov.lcov
# - name: Checkout target branch again
# uses: actions/checkout@v2
# with:
# ref: ${{ github.event.pull_request.base.ref }}
# fetch-depth: 0
# - name: Download current lcov file
# uses: actions/download-artifact@v3
# with:
# name: current-lcov
# path: .
# - name: Copy new lcov file to target branch
# run: mv current-lcov.lcov old-lcov/old-lcov.lcov
# - name: Commit and push changes
# run: |
# git config --global user.name 'github-actions[bot]'
# git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
# git add .
# git commit -m 'Update lcov file with new coverage data'
# git push
# env:
# GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }}