|
12 | 12 | permissions: |
13 | 13 | contents: read |
14 | 14 |
|
15 | | -jobs: |
16 | | - build: |
| 15 | +env: |
| 16 | + # Bunching all the dependencies together is probably friendlier |
| 17 | + TEST_DEPS: ruff mypy pytest |
17 | 18 |
|
| 19 | +jobs: |
| 20 | + ruff: |
18 | 21 | runs-on: ubuntu-latest |
19 | | - |
20 | 22 | steps: |
21 | 23 | - uses: actions/checkout@v4 |
22 | 24 | - name: Set up Python 3.12 |
23 | 25 | uses: actions/setup-python@v3 |
24 | 26 | with: |
25 | 27 | python-version: "3.12" |
| 28 | + cache: 'pip' # Will cache miss in parallel first time, but then we should save a lot of time on builds |
26 | 29 | - name: Install dependencies |
27 | 30 | run: | |
28 | 31 | python -m pip install --upgrade pip |
29 | | - pip install ruff mypy pytest |
| 32 | + pip install $TEST_DEPS |
30 | 33 | if [ -f requirements.txt ]; then pip install -r requirements.txt; fi |
31 | 34 | - name: Lint with ruff |
32 | 35 | run: | |
33 | 36 | # stop the build if there are Python syntax errors or undefined names |
34 | 37 | ruff check . --select=E9,F63,F7,F8 --statistics |
35 | 38 | # exit-zero treats all errors as warnings. |
36 | 39 | ruff check . --exit-zero |
| 40 | +
|
| 41 | + mypy: |
| 42 | + runs-on: ubuntu-latest |
| 43 | + steps: |
| 44 | + - uses: actions/checkout@v4 |
| 45 | + - name: Set up Python 3.12 |
| 46 | + uses: actions/setup-python@v3 |
| 47 | + with: |
| 48 | + python-version: "3.12" |
| 49 | + cache: 'pip' # Will cache miss in parallel first time, but then we should save a lot of time on builds |
| 50 | + - name: Install dependencies |
| 51 | + run: | |
| 52 | + python -m pip install --upgrade pip |
| 53 | + pip install $TEST_DEPS |
| 54 | + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi |
37 | 55 | - name: Lint with mypy |
38 | 56 | run: | |
39 | 57 | mypy main.py |
40 | | - #- name: Lint with flake8 |
41 | | - # run: | |
42 | | - # # stop the build if there are Python syntax errors or undefined names |
43 | | - # flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
44 | | - # # can also be more harsh :D |
45 | | - # # flake8 . --count --ignore=W503,W504 --show-source --statistics |
46 | | - # # exit-zero treats all errors as warnings. |
47 | | - # flake8 . --count --exit-zero --max-complexity=10 --statistics |
48 | | - - name: Test with pytest |
| 58 | +
|
| 59 | + pytest: |
| 60 | + runs-on: ubuntu-latest |
| 61 | + steps: |
| 62 | + - uses: actions/checkout@v4 |
| 63 | + - name: Set up Python 3.12 |
| 64 | + uses: actions/setup-python@v3 |
| 65 | + with: |
| 66 | + python-version: "3.12" |
| 67 | + cache: 'pip' # Will cache miss in parallel first time, but then we should save a lot of time on builds |
| 68 | + - name: Install dependencies |
| 69 | + run: | |
| 70 | + python -m pip install --upgrade pip |
| 71 | + pip install $TEST_DEPS |
| 72 | + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi |
| 73 | + - name: Lint with pytest |
49 | 74 | run: | |
50 | | - pytest |
| 75 | + pytest main.py |
0 commit comments