release: pull staging into main #15
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: Test Matrix | |
on: | |
pull_request: | |
paths: | |
- '**/*.py' | |
- '**/*.cpp' | |
- '**/*.hpp' | |
- '**/*.ipynb' | |
- '**/*.c' | |
- '**/*.h' | |
- '**/*.toml' | |
- '.github/workflows/test-matrix.yml' # run if this file is changed | |
- '!docs/conf.py' | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
platforms: | |
strategy: | |
fail-fast: false | |
matrix: | |
version: ["3.9", "3.10", "3.11", "3.12"] | |
os: [windows-latest, macOS-13, macOS-latest, ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Setup | 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: Setup | Check out the commit | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Setup | Set up Python | |
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 | |
with: | |
python-version: ${{ matrix.version }} | |
- name: Setup | Install dependencies | |
run: | | |
python3 -m pip install --upgrade pip | |
- name: Action | Test installation | |
run: python3 -m pip install .[formats,examples,tests] | |
- name: Action | Test package and examples | |
run: | | |
python3 -m pytest --nbmake --disable-warnings --no-header --color=auto examples/ tests/ >> $GITHUB_STEP_SUMMARY | |
- name: Action | Test uninstall process | |
# Allow upload to codecov to fail but not fail all tests | |
run: python3 -m pip uninstall -y sansmic | |
coverage: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup | 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: Setup | Check out the commit | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Setup | Set up Python | |
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 | |
with: | |
python-version: '3.12' | |
- name: Setup | Install dependencies | |
run: | | |
python3 -m pip install --upgrade pip | |
python3 -m pip install -r requirements.txt | |
python3 -m pip install gcovr==5.0 | |
- name: Setup | Install editable build | |
run: python3 -m pip install -e .[formats,examples,tests] | |
- name: Action | Test package and examples and get coverage results | |
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: Action | Upload coverage reports to Codecov | |
if: success() || failure() | |
continue-on-error: true | |
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} |