diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d6a2bb..156d296 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,12 +11,12 @@ on: types: [opened, synchronize, reopened] jobs: - test: - runs-on: ubuntu-latest + run-tests: + runs-on: ubuntu-22.04 timeout-minutes: 60 strategy: matrix: - python-version: [3.8, 3.9, '3.10', '3.11'] + python-version: [3.8, 3.9, '3.10', 3.11] steps: - uses: actions/checkout@v2 @@ -48,10 +48,36 @@ jobs: run: | echo "Running tests with Python ${{ matrix.python-version }}" python -m unittest discover -s tests + + check-code-format: + runs-on: ubuntu-22.04 + strategy: + matrix: + python-version: [3.8, 3.9, '3.10', 3.11] - build-and-push: - needs: test - runs-on: ubuntu-latest + 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 + python -m pip install flake8 + + - 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 --exit-zero --max-complexity=10 --max-line-length=127 --statistics + + publish-to-pypi: + needs: [run-tests, check-code-format] + runs-on: ubuntu-22.04 if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') steps: - uses: actions/checkout@v2