[AJP-2] #904
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: Python application | |
on: [ push ] | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Install apt dependencies | |
run: sudo apt-get update && sudo apt-get install python3-gdal libgdal-dev proj-bin libproj-dev gdal-bin python3-setuptools | |
- uses: huaxk/postgis-action@v1 | |
with: | |
postgresql version: '10' # See https://https://hub.docker.com/r/mdillon/postgis for available versions, if it is not specified, use the default value 'latest' | |
postgresql password: ${{ secrets.DatabasePassword }} # This environment variable sets the superuser password for PostgreSQL, maybe string or secrets, the default superuser is defined by the input environment variable: postgresql user. | |
postgresql user: 'postgres' # This optional environment variable is used in conjunction with postgresql password to set a user and its password. This variable will create the specified user with superuser power and a database with the same name. If it is not specified, then the default user of 'postgres' will be used. | |
postgresql db: 'postgres_test' # This optional environment variable can be used to define a different name for the default database that is created when the image is first started. If it is not specified, then the value of postgresql user will be used. | |
- uses: actions/checkout@v2 | |
- name: Install dependencies | |
env: | |
CPLUS_INCLUDE_PATH: /usr/include/gdal/ | |
C_INCLUDE_PATH: /usr/include/gdal/ | |
run: | | |
python3 -m pip install --upgrade pip | |
pip3 install -r requirements-test.txt | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
python3 -m flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
python3 -m flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Run migrations | |
run: python3 manage.py migrate | |
- name: Generate coverage report | |
run: | | |
python3 -m pytest --cov=./ --cov-report=xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./coverage.xml | |
flags: unittests | |
name: codecov-umbrella | |
fail_ci_if_error: true |