Release 2.0 #56
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
# 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", "Development", "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 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 |