@@ -2,9 +2,13 @@ name: CI
2
2
3
3
on :
4
4
push :
5
- branches : [ main ]
5
+ branches : [main]
6
6
pull_request :
7
- branches : [ main ]
7
+ branches : [main]
8
+
9
+ concurrency :
10
+ group : ${{ github.workflow }}-${{ github.ref }}
11
+ cancel-in-progress : true
8
12
9
13
permissions :
10
14
contents : read
@@ -17,67 +21,63 @@ jobs:
17
21
matrix :
18
22
os : [ubuntu-latest, macos-latest, windows-latest]
19
23
python-version : ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
20
-
21
24
include :
22
25
- os : ubuntu-latest
23
26
python-version : " 3.13"
24
27
coverage : true
25
28
26
29
steps :
27
- - name : Harden the runner (Audit all outbound calls)
28
- uses : step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
29
- with :
30
- egress-policy : audit
31
-
32
- - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
30
+ - name : Harden the runner (Audit all outbound calls)
31
+ uses : step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
32
+ with :
33
+ egress-policy : audit
33
34
34
- - name : Set up Python
35
- uses : actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
36
- with :
37
- python-version : ${{ matrix.python-version }}
35
+ - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
38
36
39
- - name : Locate pip cache
40
- id : pip-cache
41
- shell : bash
42
- run : echo "dir=$(python -m pip cache dir)" >> "$GITHUB_OUTPUT"
37
+ - name : Set up Python
38
+ uses : actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
39
+ with :
40
+ python-version : ${{ matrix.python-version }}
41
+ cache : ' pip'
43
42
44
- - name : Cache pip
45
- uses : actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
46
- with :
47
- path : ${{ steps.pip-cache.outputs.dir }}
48
- key : ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
49
- restore-keys : ${{ runner.os }}-pip-
43
+ - name : Install dependencies
44
+ run : |
45
+ python -m pip install --upgrade pip
46
+ python -m pip install ".[dev,server]"
50
47
51
- - name : Install dependencies
52
- run : |
53
- python -m pip install --upgrade pip
54
- python -m pip install ".[dev,server]"
48
+ - name : Cache pytest results
49
+ uses : actions/cache@v4
50
+ with :
51
+ path : .pytest_cache
52
+ key : ${{ runner.os }}-pytest-${{ matrix.python-version }}-${{ hashFiles('**/pytest.ini') }}
53
+ restore-keys : |
54
+ ${{ runner.os }}-pytest-${{ matrix.python-version }}-
55
55
56
- - name : Run tests
57
- if : ${{ matrix.coverage != true }}
58
- run : pytest
56
+ - name : Run tests
57
+ if : ${{ matrix.coverage != true }}
58
+ run : pytest
59
59
60
- - name : Run tests and collect coverage
61
- if : ${{ matrix.coverage == true }}
62
- run : |
63
- pytest \
64
- --cov=gitingest \
65
- --cov=server \
66
- --cov-branch \
67
- --cov-report=xml \
68
- --cov-report=term
60
+ - name : Run tests and collect coverage
61
+ if : ${{ matrix.coverage == true }}
62
+ run : |
63
+ pytest \
64
+ --cov=gitingest \
65
+ --cov=server \
66
+ --cov-branch \
67
+ --cov-report=xml \
68
+ --cov-report=term
69
69
70
- - name : Upload coverage to Codecov
71
- if : ${{ matrix.coverage == true }}
72
- uses : codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3
73
- with :
74
- token : ${{ secrets.CODECOV_TOKEN }}
75
- files : coverage.xml
76
- flags : ${{ matrix.os }}-py${{ matrix.python-version }}
77
- name : codecov-${{ matrix.os }}-${{ matrix.python-version }}
78
- fail_ci_if_error : true
79
- verbose : true
70
+ - name : Upload coverage to Codecov
71
+ if : ${{ matrix.coverage == true }}
72
+ uses : codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3
73
+ with :
74
+ token : ${{ secrets.CODECOV_TOKEN }}
75
+ files : coverage.xml
76
+ flags : ${{ matrix.os }}-py${{ matrix.python-version }}
77
+ name : codecov-${{ matrix.os }}-${{ matrix.python-version }}
78
+ fail_ci_if_error : true
79
+ verbose : true
80
80
81
- - name : Run pre-commit hooks
82
- uses : pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
83
- if : ${{ matrix.python-version == '3.13' && matrix.os == 'ubuntu-latest' }}
81
+ - name : Run pre-commit hooks
82
+ uses : pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
83
+ if : ${{ matrix.python-version == '3.13' && matrix.os == 'ubuntu-latest' }}
0 commit comments