From acc35069632a3ba0f39e81080d847307579cc922 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Odd=20Str=C3=A5b=C3=B8?= Date: Sat, 26 Sep 2020 03:09:03 +0200 Subject: [PATCH] One day, our world will be sane --- .editorconfig | 2 +- .github/workflows/python-sanity.yaml | 46 ++++++++++++++++++++++++++++ tox.ini | 2 +- 3 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/python-sanity.yaml diff --git a/.editorconfig b/.editorconfig index 0e9268c0..e799a602 100644 --- a/.editorconfig +++ b/.editorconfig @@ -14,7 +14,7 @@ charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true end_of_line = lf -max_line_length = null +max_line_length = 9999 # YAML indentation [*.{yml,yaml}] diff --git a/.github/workflows/python-sanity.yaml b/.github/workflows/python-sanity.yaml new file mode 100644 index 00000000..ac124d65 --- /dev/null +++ b/.github/workflows/python-sanity.yaml @@ -0,0 +1,46 @@ +name: Python sanity + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: [2.7, 3.6, 3.7, 3.8] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements-dev.txt + + - 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. + flake8 . --exit-zero \ + | awk -F: '{ gsub(/^[ \t]+/,"",$4); print "::error file=" $1 ",line=" $2 ",col=" $3 "::" $4 }' + + - name: Run tests + run: | + coverage run + coverage report + + - name: Upload coverage report to Codecov + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + run: | + coverage xml + bash <(curl -s https://codecov.io/bash) \ + || echo "::warning ::Codecov upload failed" + diff --git a/tox.ini b/tox.ini index ae876e22..48bcf2c7 100644 --- a/tox.ini +++ b/tox.ini @@ -21,4 +21,4 @@ source = service.py .config/generate_xml.py omit = tests/* -command_line = -m pytest +command_line = -m pytest --verbose