Skip to content

Set http caching for tests #159

Set http caching for tests

Set http caching for tests #159

name: pynsee package tests
on:
pull_request_target:
branches:
- 'master'
jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
python-version: ["3.8", "3.12"]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
#sudo apt-get install libgeos-dev
python -m pip install --upgrade pip
pip install flake8 pytest pytest-cov geopandas nbconvert matplotlib descartes
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f requirements-extra.txt ]; then pip install -r requirements-extra.txt; fi
- name: Lint with flake8
run: |
# 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 --ignore=E722,C901 --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test examples
env:
insee_key: ${{ secrets.INSEE_KEY }}
insee_secret: ${{ secrets.INSEE_SECRET }}
run: |
pip install jupytext
pip install -r requirements.txt
pip install .[full]
pip install -r requirements-extra.txt
# test all notebooks
cd docs/examples
jupytext --to py *.md
# run all py files
# for f in *.py; do python "$f"; done
cd ../..
- name: Add requests-cache - s3fs - py7zr
run: pip install requests-cache s3fs py7zr # Used to monkeypatch requests and store artifacts
- name: Test with pytest
env:
insee_key: ${{ secrets.INSEE_KEY }}
insee_secret: ${{ secrets.INSEE_SECRET }}
s3_token: ${{ secrets.S3_TOKEN }}
s3_secret: ${{ secrets.S3_SECRET }}
s3_key: ${{ secrets.S3_KEY }}
run: |
pytest -v --cov
- name: "Upload coverage to Codecov"
uses: codecov/codecov-action@v1
if: github.ref == 'refs/heads/master'
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true