add: code-format job

This commit is contained in:
makaveli10
2024-02-09 13:44:17 +05:30
parent 14974af951
commit b4abe95fc6
+32 -6
View File
@@ -11,12 +11,12 @@ on:
types: [opened, synchronize, reopened] types: [opened, synchronize, reopened]
jobs: jobs:
test: run-tests:
runs-on: ubuntu-latest runs-on: ubuntu-22.04
timeout-minutes: 60 timeout-minutes: 60
strategy: strategy:
matrix: matrix:
python-version: [3.8, 3.9, '3.10', '3.11'] python-version: [3.8, 3.9, '3.10', 3.11]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@@ -48,10 +48,36 @@ jobs:
run: | run: |
echo "Running tests with Python ${{ matrix.python-version }}" echo "Running tests with Python ${{ matrix.python-version }}"
python -m unittest discover -s tests 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: steps:
needs: test - uses: actions/checkout@v2
runs-on: ubuntu-latest
- 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') if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2