Skip to content

Fix coverage path and use pipefail #311

Fix coverage path and use pipefail

Fix coverage path and use pipefail #311

Workflow file for this run

name: Run code tests on push and pull requests
on:
pull_request:
push:
branches:
- master
workflow_dispatch:
permissions:
contents: read
pull-requests: write
jobs:
tests:
name: Code tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
include-sigpy: [true, false]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Cache pip dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install PyPulseq and dependencies
run: |
pip install --upgrade --upgrade-strategy eager .[test]
if [ ${{ matrix.include-sigpy }} == "true" ]; then
pip install sigpy
fi
- name: Install PyTest GitHub Annotation Plugin
run: pip install pytest-github-actions-annotate-failures
- name: Run PyTest and Generate Coverage Report
shell: bash
run: |
if [ ${{ matrix.include-sigpy }} == "true" ]; then
pytest --junitxml=pytest.xml \
--cov-report=term-missing:skip-covered --cov=pypulseq | tee pytest-coverage.txt
else
pytest -m "not sigpy" --junitxml=pytest.xml \
--cov-report=term-missing:skip-covered --cov=pypulseq | tee pytest-coverage.txt
fi
- name: Post PyTest Coverage Comment
if: always()
id: coverageComment
uses: MishaKav/[email protected]
with:
issue-number: ${{ github.event.workflow_run.event.pull_request.number }}
pytest-coverage-path: pytest-coverage.txt
junitxml-path: pytest.xml
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
# Cancel in-progress runs when a new workflow with the same group name is triggered
cancel-in-progress: true