-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (109 loc) · 3.69 KB
/
test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Test Pipeline
on:
push:
branches: [master]
pull_request:
branches: [master]
types: [opened, synchronize]
schedule:
- cron: '0 0 * * 1' # Every Monday at 00:00 UTC
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: [3.11, 3.12, 3.13]
name: Test Pipeline - Python ${{ matrix.python-version }} on ${{ matrix.os }}
timeout-minutes: 15
steps:
- name: 📥 Checkout the repository
uses: actions/checkout@v4.2.2
- name: 🐍 Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5.3.0
with:
python-version: ${{ matrix.python-version }}
- id: cache
name: 📦 Create cache
uses: actions/cache@v4.2.0
with:
path: ${{ env.pythonLocation }}
key: ${{ matrix.os }}-python-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml', 'requirements*') }}
restore-keys: ${{ matrix.os }}-python-${{ matrix.python-version }}-
- name: 📦 Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: make install-dev
- name: 📂 Create coverage directory
run: mkdir coverage
- name: 🏃 Run Tests
run: make coverage
env:
COVERAGE_FILE: coverage/.coverage_${{ matrix.os }}_python_${{ matrix.python-version }}
CONTEXT: ${{ matrix.os }}-python-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml', 'requirements*') }}
- name: 🫙 Store tests coverage
uses: actions/upload-artifact@v4.6.0
if: always()
with:
name: coverage_${{ matrix.os }}_python_${{ matrix.python-version }}
path: coverage
include-hidden-files: true
coverage-combine:
needs: [test]
if: always()
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: [3.13]
steps:
- name: 📥 Checkout the repository
uses: actions/checkout@v4.2.2
- name: 🐍 Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5.3.0
with:
python-version: ${{ matrix.python-version }}
- id: cache
name: 📦 Create cache
uses: actions/cache@v4.2.0
with:
path: ${{ env.pythonLocation }}
key: ${{ matrix.os }}-python-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml', 'requirements*') }}
restore-keys: ${{ matrix.os }}-python-${{ matrix.python-version }}-
- name: 📦 Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: make install-dev
- name: 📥 Download coverage files
uses: actions/download-artifact@v4.1.8
with:
merge-multiple: true
pattern: coverage_*
path: coverage
- name: 🏃 Combine coverage files
run: |
ls -la coverage
coverage combine coverage/.coverage_*
- name: 📊 Generate coverage report
run: |
coverage report
coverage html --show-contexts --title "Coverage for ${{ github.sha }}"
- name: 🫙 Store coverage report
uses: actions/upload-artifact@v4.6.0
with:
name: coverage-html
path: htmlcov
# This job does nothing and is only used for the branch protection
check-all:
needs: [test]
if: always()
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
steps:
- name: ✅ All tests passed
uses: re-actors/alls-green@v1.2.2
with:
jobs: ${{ toJSON(needs) }}