Skip to content

ci: bump pypa/gh-action-pypi-publish #71

ci: bump pypa/gh-action-pypi-publish

ci: bump pypa/gh-action-pypi-publish #71

name: Tests
on:
push:
paths:
- examples/**
- src/**
- tests/**
- setup.py
- pyproject.toml
- .github/workflows/*
branches-ignore:
- 'main'
- 'staging'
pull_request:
branches-ignore:
- 'main'
- 'staging'
permissions:
contents: read
jobs:
quick-test:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
api.codecov.io:443
api.github.com:443
cli.codecov.io:443
codecov.io:443
files.pythonhosted.org:443
github.com:443
pypi.org:443
storage.googleapis.com:443
uploader.codecov.io:443
- name: Check out the commit
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: '3.12'
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements.txt
python3 -m pip install gcovr==5.0
- name: Build test
run: python3 -m pip install -e .[formats,examples,tests]
- name: Get C++ coverage
run: |
export CPPFLAGS="-coverage"
python3 setup.py build_ext --inplace --force
echo '### Run tests' >> $GITHUB_STEP_SUMMARY
echo '```bash' >> $GITHUB_STEP_SUMMARY
python3 -m pytest --nbmake --disable-warnings --cov=sansmic --cov=tests --no-header --color=auto examples/ tests/ | tee -a $GITHUB_STEP_SUMMARY
find src -type f -name '*.cpp' | xargs -I{} gcov -o build/temp*/src/ext_modules/libsansmic {}
echo ' ' >> $GITHUB_STEP_SUMMARY
gcovr --txt -s -k | tee -a $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
- name: Upload coverage reports to Codecov
if: success() || failure()
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: ${{ inputs.os }}
- name: Test uninstall
if: success() || failure()
# Allow upload to codecov to fail but not fail all tests
run: python3 -m pip uninstall -y sansmic