-
Notifications
You must be signed in to change notification settings - Fork 160
175 lines (163 loc) · 4.56 KB
/
Copy pathci.yml
File metadata and controls
175 lines (163 loc) · 4.56 KB
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
name: GitHub CI
# Execute this for every push
on: [push]
# Use bash explicitly for being able to enter the conda environment
defaults:
run:
shell: bash -el {0}
env:
CLIMADA_DATA_DOI: 10.5281/zenodo.20595842
jobs:
integration-test:
name: 'Core / Integration Test Pipeline'
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
-
name: Checkout Repo
uses: actions/checkout@v7
# --- Modify paths in climada.conf ---
-
name: Write climada.conf system data
uses: amochkin/action-json@v1
with:
mode: write
file: climada.conf
property: local_data.system
value: ${{ github.workspace }}/climada/data
-
name: Write climada.conf demo data
uses: amochkin/action-json@v1
with:
mode: write
file: climada.conf
property: local_data.demo
value: ${{ github.workspace }}/climada/demo
-
run: |
cat climada.conf
# ---
-
name: Install make
uses: awalsh128/cache-apt-pkgs-action@v1
with:
packages: make
-
name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
python-version: "3.12"
enable-cache: true
cache-suffix: integrationtest
-
name: Install dependencies
run: |
uv sync --locked --dev
-
name: Cache testing data
uses: actions/cache@v5
with:
path: climada.zip
key: ${{ env.CLIMADA_DATA_DOI }}
-
name: Download and unzip testing data
run: |
uvx zenodo_get ${{ env.CLIMADA_DATA_DOI }}
unzip -o climada.zip -d ${{ github.workspace }}
-
name: Run Integration Tests
run: |
uv run -- make integ_test
-
name: Upload Test Results
if: (!cancelled())
uses: actions/upload-artifact@v7
with:
name: test-results-core-integrationtests
path: tests_xml/tests.xml
-
name: Upload Coverage Reports
if: (!cancelled())
uses: actions/upload-artifact@v7
with:
name: coverage-report-core-integrationtests
path: coverage/
build-and-test:
name: 'Core / Unit Test Pipeline'
runs-on: ubuntu-latest
timeout-minutes: 20
# Run this test for different Python versions
strategy:
# Do not abort other tests if only a single one fails
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
-
name: Checkout Repo
uses: actions/checkout@v7
-
name: Install make
uses: awalsh128/cache-apt-pkgs-action@v1
with:
packages: make
-
name: Install Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # caching pip dependencies
-
name: Install dependencies
run: |
pip install --upgrade pip
pip install -e ./
pip install --group dev
-
name: Run Unit Tests
run: |
make unit_test
-
name: Upload Test Results
if: (!cancelled())
uses: actions/upload-artifact@v7
with:
name: test-results-core-unittests-py${{ matrix.python-version }}
path: tests_xml/tests.xml
-
name: Upload Coverage Reports
if: (!cancelled())
uses: actions/upload-artifact@v7
with:
name: coverage-report-core-unittests-py${{ matrix.python-version }}
path: coverage/
publish-test-results:
name: "Core / Publish Test Results"
if: ${{ always() }} # For reporting, run this job even if the previous jobs fail
needs: [build-and-test, integration-test]
runs-on: ubuntu-latest
permissions:
checks: write
steps:
-
name: Download Test Results
uses: actions/download-artifact@v8
with:
pattern: test-results-core*
path: results
-
name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: "results/**/*.xml"
check_name: "Core / Test Results"
comment_mode: "off"
test-petals:
name: Petals Compatibility
uses: CLIMADA-project/climada_petals/.github/workflows/testing.yml@develop
needs: build-and-test
with:
core_branch: ${{ github.ref }}
petals_branch: develop
permissions:
checks: write