Skip to content

Merge pull request #173 from BIH-CEI/170-change-datafield-to-work-wit… #292

Merge pull request #173 from BIH-CEI/170-change-datafield-to-work-wit…

Merge pull request #173 from BIH-CEI/170-change-datafield-to-work-wit… #292

Workflow file for this run

name: CI
on:
push:
branches: [ develop ]
pull_request:
branches: [ main, develop ]
jobs:
run-ci:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
- name: Initialize Python
uses: actions/setup-python@v4.3.1
with:
python-version: ${{ matrix.python-version }}
- name: Install package
run: |
python3 -m pip install --editable .[test,docs]
- name: Run pytest tests with coverage
run: |
pytest --cov=phenopacket_mapper --cov-report=term --cov-report=xml:coverage.xml
- name: Extract coverage percentage
id: coverage
run: |
# Extract the percentage from the XML report
coverage=$(grep -oP '(?<=line-rate=")[0-9.]+(?=")' coverage.xml)
# Multiply by 100 to get the percentage
COVERAGE=$(awk -v cov="$coverage" 'BEGIN {printf "%.2f\n", cov * 100}')
echo "COVERAGE=${COVERAGE}" >> $GITHUB_ENV
echo "Coverage percentage: $COVERAGE"
- name: Display coverage
run: |
echo "Coverage: ${{ env.COVERAGE }}%"
- name: Create Badge
uses: schneegans/dynamic-badges-action@v1.7.0
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 67304fe3700ce3d41079e75f4fe9609f
filename: phenopacket_mapper_test_cov.JSON # Use test.svg if you want to use the SVG mode.
label: Test Coverage
message: ${{ env.COVERAGE }}%
color: green