Skip to content

merge: sync development with master #121

merge: sync development with master

merge: sync development with master #121

Workflow file for this run

# This workflow will update the installation cache and install Python
# dependencies, run tests with coverage, and lint with Python matrix.
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Pytest
on:
push:
branches: ["master", "release-**"]
pull_request:
branches: ["master", "development", "release-**"]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
# no need to run tests for documentation
if: ${{ !contains(github.event.head_commit.message, 'docs(') &&
!contains(github.event.head_commit.message, 'docs:') }}
strategy:
fail-fast: true
matrix:
python-version: ["3.9", "3.10" , "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Get pip cache dir
id: pip-cache
run: |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: pip cache # cache dependencies to speed up tests
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/dev_requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies # gdal cannot install with eager upgrade
run: |
sudo apt-get update
sudo apt-get install gdal-bin libgdal-dev
python -m pip install --upgrade pip
pip install --upgrade flake8 gdal==`gdal-config --version` pybind11
pip install --upgrade -e .[dev]
- name: Lint with flake8
run: |
# stop if Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings
# This ignores a bunch of linting errors
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=80 --statistics --ignore=E226,E231,E265,E501,E265,W291,W293
- name: Test with pytest and get coverage
run: |
coverage run --rcfile .coveragerc -m pytest && coverage report