|
8 | 8 | branches: |
9 | 9 | - main |
10 | 10 |
|
| 11 | +concurrency: |
| 12 | + group: testing-${{ github.ref }} |
| 13 | + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} |
| 14 | + |
11 | 15 | jobs: |
12 | 16 | codeql: |
13 | 17 | name: Security and Quality |
14 | 18 | runs-on: ubuntu-latest |
| 19 | + |
15 | 20 | steps: |
16 | 21 | - name: Checkout |
17 | | - uses: actions/checkout@v2 |
18 | | - - name: Set up Python 3.8 |
19 | | - uses: actions/setup-python@v1 |
| 22 | + uses: actions/checkout@v3 |
| 23 | + |
| 24 | + - name: Set up Python |
| 25 | + uses: actions/setup-python@v4 |
20 | 26 | with: |
21 | 27 | python-version: 3.8 |
| 28 | + |
22 | 29 | - name: Install dependencies |
23 | 30 | run: python -m pip install -e . |
| 31 | + |
24 | 32 | - name: Initialize CodeQL |
25 | | - uses: github/codeql-action/init@v1 |
| 33 | + uses: github/codeql-action/init@v2 |
26 | 34 | with: |
27 | 35 | languages: python |
28 | 36 | queries: security-and-quality |
| 37 | + source-root: . |
| 38 | + |
29 | 39 | - name: Perform CodeQL Analysis |
30 | | - uses: github/codeql-action/analyze@v1 |
| 40 | + uses: github/codeql-action/analyze@v2 |
31 | 41 |
|
32 | 42 | flake8: |
33 | 43 | name: Flake8 |
34 | | - runs-on: ubuntu-latest |
35 | | - steps: |
36 | | - - name: Checkout |
37 | | - uses: actions/checkout@v2 |
38 | | - - name: Flake8 |
39 | | - uses: TrueBrain/actions-flake8@v2 |
40 | | - with: |
41 | | - path: openttd_protocol |
| 44 | + uses: OpenTTD/actions/.github/workflows/rw-py-flake8.yml@v4 |
| 45 | + with: |
| 46 | + python-path: openttd_protocol |
42 | 47 |
|
43 | 48 | black: |
44 | 49 | name: Black |
45 | | - runs-on: ubuntu-latest |
46 | | - steps: |
47 | | - - name: Checkout |
48 | | - uses: actions/checkout@v2 |
49 | | - - name: Set up Python 3.8 |
50 | | - uses: actions/setup-python@v1 |
51 | | - with: |
52 | | - python-version: 3.8 |
53 | | - - name: Set up packages |
54 | | - run: | |
55 | | - python -m pip install --upgrade pip |
56 | | - pip install black |
57 | | - - name: Black |
58 | | - run: | |
59 | | - black -l 120 --check openttd_protocol |
| 50 | + uses: OpenTTD/actions/.github/workflows/rw-py-black.yml@v4 |
| 51 | + with: |
| 52 | + python-version: 3.8 |
| 53 | + python-path: openttd_protocol |
60 | 54 |
|
61 | 55 | pytest: |
62 | 56 | name: pytest |
63 | 57 | runs-on: ubuntu-latest |
| 58 | + |
64 | 59 | steps: |
65 | 60 | - name: Checkout |
66 | | - uses: actions/checkout@v2 |
| 61 | + uses: actions/checkout@v3 |
| 62 | + |
67 | 63 | - name: Set up Python 3.8 |
68 | | - uses: actions/setup-python@v1 |
| 64 | + uses: actions/setup-python@v4 |
69 | 65 | with: |
70 | 66 | python-version: 3.8 |
| 67 | + |
71 | 68 | - name: Install pytest |
72 | | - run: python -m pip install -r requirements.test |
| 69 | + run: | |
| 70 | + python -m pip install -r requirements.test |
| 71 | +
|
73 | 72 | - name: Run pytest |
74 | | - run: PYTHONPATH=. pytest |
| 73 | + run: | |
| 74 | + PYTHONPATH=. pytest |
75 | 75 |
|
76 | | - check_annotations: |
77 | | - name: Check Annotations |
| 76 | + annotation_check: |
| 77 | + name: Annotation Check |
78 | 78 | needs: |
79 | 79 | - flake8 |
80 | 80 | - black |
81 | 81 | - pytest |
82 | 82 | # not codeql, as that reports its own status |
83 | 83 |
|
84 | | - if: always() && github.event_name == 'pull_request' |
85 | | - |
86 | | - runs-on: ubuntu-latest |
87 | | - |
88 | | - steps: |
89 | | - - name: Check annotations |
90 | | - uses: OpenTTD/actions/annotation-check@v2 |
| 84 | + uses: OpenTTD/actions/.github/workflows/rw-annotation-check.yml@v4 |
0 commit comments