|
1 |
| -# This workflow will install Python dependencies, run tests and lint with a single version of Python |
2 |
| -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python |
3 |
| - |
4 |
| -name: Python application |
| 1 | +name: Lint and Test |
5 | 2 |
|
6 | 3 | on:
|
7 | 4 | push:
|
8 |
| - branches: [ "main" ] |
| 5 | + branches: ["main"] |
9 | 6 | pull_request:
|
10 |
| - branches: [ "main" ] |
| 7 | + branches: ["main"] |
11 | 8 |
|
12 | 9 | permissions:
|
13 | 10 | contents: read
|
14 | 11 |
|
15 | 12 | jobs:
|
16 | 13 | build:
|
17 |
| - |
18 | 14 | runs-on: ubuntu-latest
|
19 | 15 |
|
20 | 16 | steps:
|
21 |
| - - uses: actions/checkout@v4 |
22 |
| - - name: Set up Python 3.12 |
23 |
| - uses: actions/setup-python@v3 |
24 |
| - with: |
25 |
| - python-version: "3.12" |
26 |
| - - name: Install dependencies |
27 |
| - run: | |
28 |
| - python -m pip install --upgrade pip |
29 |
| - pip install flake8 pytest |
30 |
| - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi |
31 |
| - - name: Lint with flake8 |
32 |
| - run: | |
33 |
| - # stop the build if there are Python syntax errors or undefined names |
34 |
| - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
35 |
| - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
36 |
| - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
37 |
| - - name: Test with pytest |
38 |
| - run: | |
39 |
| - pytest |
| 17 | + - uses: actions/checkout@v4 |
| 18 | + - name: Set up Python 3.12 |
| 19 | + uses: actions/setup-python@v3 |
| 20 | + with: |
| 21 | + python-version: "3.12" |
| 22 | + - name: Install dependencies |
| 23 | + run: | |
| 24 | + python -m pip install --upgrade pip |
| 25 | + pip install flake8 pytest |
| 26 | + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi |
| 27 | + - name: Lint with flake8 |
| 28 | + run: | |
| 29 | + # stop the build if there are Python syntax errors or undefined names |
| 30 | + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
| 31 | + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
| 32 | + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
| 33 | + - name: Test with pytest |
| 34 | + run: | |
| 35 | + pytest |
0 commit comments