Skip to content

Merge pull request #9 from saullocastro/lp_gradients #147

Merge pull request #9 from saullocastro/lp_gradients

Merge pull request #9 from saullocastro/lp_gradients #147

name: Test and coverage
on: [push]
jobs:
build:
strategy:
matrix:
runs-on: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.8, 3.9, '3.10', '3.11', '3.12']
runs-on: ${{ matrix.runs-on }}
env:
USE_COVERAGE: ${{ matrix.runs-on == 'ubuntu-latest' && matrix.python-version == '3.11' }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r ci_requirements.txt
python3 -m pip install --upgrade -r ci_requirements.txt
- name: Install module for coverage
if: env.USE_COVERAGE == 'true'
run: |
python3 setup.py build_ext --inplace --force --define CYTHON_TRACE_NOGIL
- name: Install module
if: env.USE_COVERAGE == 'false'
run: |
python3 -m pip install .
- name: Lint with flake8
run: |
python3 -m pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest and coverage report
if: env.USE_COVERAGE == 'true'
run: |
coverage run -m pytest tests
coverage report
- name: Test with pytest
if: env.USE_COVERAGE == 'false'
run: |
pytest tests
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_UPLOAD_TOKEN }}
fail_ci_if_error: true
verbose: true