diff --git a/.flake8 b/.flake8 new file mode 100644 index 00000000..7b4789c0 --- /dev/null +++ b/.flake8 @@ -0,0 +1,22 @@ +[flake8] +exclude = */docs/*,*/.tox/*,*/.venv/*,*/.pycharm_helpers/*,*/migrations/*,docs/*,*/__init__.py, + */manage.py,*/wsgi.py, + # we don't check this for now, until it's been fixed. otherwise it will throw lot of errors + qgis-app/plugins/*, + qgis-app/userexport/*, + qgis-app/lib/templatetags/*, + vagrant_assets/*, + qgis-app/users/*, + qgis-app/settings*, + qgis-app/qgis_context_processor.py, + qgis-app/search_sites.py, + qgis-app/urls.py, + qgis-app/custom_haystack_urls.py, + qgis-app/middleware.py, + qgis-app/homepage.py +max-line-length = 79 + +# E12x continuation line indentation +# E251 no spaces around keyword / parameter equals +# E303 too many blank lines (3) +ignore = E121,E122,E123,E124,E125,E126,E127,E128,E251,E303,W503,W504,W60,F405 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 00000000..712a1b81 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,54 @@ +name: pr-test +on: + pull_request: + branches: + - master + push: + branches: + - master +jobs: + lint: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: + - 3.7 + steps: + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + + - name: Test installing development dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 + + - name: Run Flake8 test + run: flake8 . + test: + runs-on: ubuntu-latest + needs: + - lint + steps: + - uses: actions/checkout@v2 + - name: Run docker-compose build + working-directory: dockerize + run: docker-compose build + - name: Run the containers + working-directory: dockerize + run: docker-compose up -d db devweb + - name: Run Coverage test + working-directory: dockerize + run: | + cat << EOF | docker-compose exec -T devweb bash + pip install coverage + python manage.py makemigrations + python manage.py migrate + coverage run manage.py test + coverage xml + EOF + - name: Upload coverage to codecov + uses: codecov/codecov-action@v2 + with: + token: ${{ secrets.CODECOV_TOKEN }}