@@ -15,32 +15,51 @@ concurrency:
15
15
16
16
17
17
jobs :
18
- unittest :
18
+ test :
19
19
strategy :
20
20
fail-fast : false
21
21
matrix :
22
- os : [ubuntu-latest, windows-latest]
23
- python-version : ["3.11", "3.12"]
24
- exclude :
25
- - os : ubuntu-latest
26
- python-version : " 3.11"
27
- - os : windows-latest
22
+ include :
23
+ - subset-name : " Model Steady State Tests"
24
+ os : ubuntu-latest
28
25
python-version : " 3.12"
29
- test-subset :
30
- - |
31
- tests/
32
-
26
+ test-subset : " tests/test_model.py::test_numerical_steady_state tests/test_model.py::test_steady_state tests/test_model.py::test_partially_analytical_steady_state"
27
+ - subset-name : " Model Tests"
28
+ os : ubuntu-latest
29
+ python-version : " 3.12"
30
+ test-subset : " tests/test_model.py --deselect tests/test_model.py::test_numerical_steady_state --deselect tests/test_model.py::test_steady_state --deselect tests/test_model.py::test_partially_analytical_steady_state"
31
+ - subset-name : " Steady State Tests"
32
+ os : ubuntu-latest
33
+ python-version : " 3.12"
34
+ test-subset : " tests/test_steady_state.py"
35
+ - subset-name : " Perturbation Tests"
36
+ os : ubuntu-latest
37
+ python-version : " 3.12"
38
+ test-subset : " tests/test_perturbation.py"
39
+ - subset-name : " Other Tests"
40
+ os : ubuntu-latest
41
+ python-version : " 3.12"
42
+ test-subset : " tests/ --ignore tests/test_model.py --ignore tests/test_steady_state.py --ignore tests/test_perturbation.py"
43
+ - subset-name : " Windows Test Model"
44
+ os : windows-latest
45
+ python-version : " 3.13"
46
+ test-subset : " tests/test_model.py --deselect tests/test_model.py::test_numerical_steady_state --deselect tests/test_model.py::test_steady_state --deselect tests/test_model.py::test_partially_analytical_steady_state --deselect tests/test_model.py::test_all_backends_agree_on_functions --deselect tests/test_model.py::test_scipy_wrapped_functions_agree"
47
+ - subset-name : " Windows Other Tests"
48
+ os : windows-latest
49
+ python-version : " 3.13"
50
+ test-subset : " tests/ --ignore tests/test_model.py --ignore tests/test_steady_state.py --ignore tests/test_perturbation.py"
51
+ name : ${{ matrix.subset-name }} (${{ matrix.os }} Python ${{ matrix.python-version }})
33
52
runs-on : ${{ matrix.os }}
34
53
35
54
env :
36
55
TEST_SUBSET : ${{ matrix.test-subset }}
37
56
38
57
defaults :
39
58
run :
40
- shell : bash -l {0}
59
+ shell : bash -leo pipefail {0}
41
60
42
61
steps :
43
- - uses : actions/checkout@v3
62
+ - uses : actions/checkout@v4
44
63
45
64
- uses : mamba-org/setup-micromamba@v2
46
65
with :
@@ -53,18 +72,71 @@ jobs:
53
72
54
73
- name : Install current branch
55
74
run : |
56
- conda activate geconpy-test
57
75
pip install -e .
58
76
python --version
59
77
78
+ - name : Create matrix id
79
+ id : matrix-id
80
+ env :
81
+ MATRIX_CONTEXT : ${{ toJson(matrix) }}
82
+ run : |
83
+ echo $MATRIX_CONTEXT
84
+ export MATRIX_ID=`echo $MATRIX_CONTEXT | sha256sum | cut -c 1-32`
85
+ echo $MATRIX_ID
86
+ echo "id=$MATRIX_ID" >> $GITHUB_OUTPUT
87
+
60
88
- name : Run tests
61
89
run : |
62
- python -m pytest -vv --cache-clear --cov=gEconpy --cov-report=xml --no-cov-on-fail --cov-report term $TEST_SUBSET
63
- - name : Upload coverage to Codecov
64
- uses : codecov/codecov-action@v3
90
+ python -m pytest -vv --cache-clear --cov=gEconpy --cov-report=xml:coverage/coverage-${MATRIX_ID}.xml --no-cov-on-fail --cov-report term $TEST_SUBSET
91
+ env :
92
+ MATRIX_ID : ${{ steps.matrix-id.outputs.id }}
93
+
94
+ - name : Upload coverage file
95
+ uses : actions/upload-artifact@v4
65
96
with :
66
- token : ${{ secrets.CODECOV_TOKEN }} # use token for more robust uploads
67
- env_vars : TEST_SUBSET
68
- name : ${{ matrix.os }}
69
- fail_ci_if_error : false
70
- verbose : true
97
+ name : coverage-${{ steps.matrix-id.outputs.id }}
98
+ path : coverage/coverage-${{ steps.matrix-id.outputs.id }}.xml
99
+
100
+
101
+ all-checks :
102
+ if : ${{ always() }}
103
+ runs-on : ubuntu-latest
104
+ name : " All tests"
105
+ needs : [test]
106
+ steps :
107
+ - name : Check build matrix status
108
+ if : ${{ needs.test.result != 'success' }}
109
+ run : exit 1
110
+
111
+ upload-coverage :
112
+ runs-on : ubuntu-latest
113
+ name : " Upload coverage"
114
+ needs : [all-checks]
115
+ if : ${{ needs.all-checks.result == 'success' }}
116
+ steps :
117
+ - uses : actions/checkout@v4
118
+ with :
119
+ persist-credentials : false
120
+
121
+ - name : Set up Python
122
+ uses : actions/setup-python@v5
123
+ with :
124
+ python-version : " 3.13"
125
+
126
+ - name : Install dependencies
127
+ run : |
128
+ python -m pip install -U coverage>=5.1 coveralls
129
+
130
+ - name : Download coverage file
131
+ uses : actions/download-artifact@v4
132
+ with :
133
+ pattern : coverage-*
134
+ path : coverage
135
+ merge-multiple : true
136
+
137
+ - name : Upload coverage to Codecov
138
+ uses : codecov/codecov-action@v5
139
+ with :
140
+ directory : ./coverage/
141
+ fail_ci_if_error : true
142
+ token : ${{ secrets.CODECOV_TOKEN }}
0 commit comments