diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 7a59c4b..2cfc2a3 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -1,36 +1,36 @@ -name: FailCheck +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions -on: [push, pull_request] +name: Python application + +on: + push: + branches: [ $default-branch ] + pull_request: + branches: [ $default-branch ] jobs: build: runs-on: ubuntu-latest - strategy: - max-parallel: 5 - matrix: - python-version: [3.10] steps: - - uses: actions/checkout@v1 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + - uses: actions/checkout@v2 + - name: Set up Python 3.10 + uses: actions/setup-python@v2 with: - python-version: ${{ matrix.python-version }} + python-version: "3.10" - name: Install dependencies run: | - sudo apt-get install libpq-dev python -m pip install --upgrade pip - pip install -r requirements.txt - pip install flake8 flake8-print flake8-quotes - - name: Check for showstoppers + pip install flake8 pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with flake8 run: | - flake8 . --count --select=E999 --show-source --statistics - shellcheck: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v1 - - name: Check for install script errors - uses: ludeeus/action-shellcheck@0.1.0 + # 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 --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + pytest