strange #306
Workflow file for this run
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
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/[email protected] | |
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/[email protected] | |
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 |