-
Notifications
You must be signed in to change notification settings - Fork 160
143 lines (134 loc) · 3.8 KB
/
Copy pathci.yml
File metadata and controls
143 lines (134 loc) · 3.8 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
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@v4
-
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"
cache-suffix: integrationtest
-
name: Install dependencies
run: |
uv sync --locked --dev
-
name: Cache data
uses: actions/cache@v5
with:
path: ${{ github.workspace }}/climada
key: ${{ env.CLIMADA_DATA_DOI }}
-
name: Download and unzip data
run: |
uvx zenodo_get ${{ env.CLIMADA_DATA_DOI }}
unzip climada.zip -d ${{ github.workspace }}
-
name: Run Integration Tests
run: |
uv run -- python -c "from climada.util.constants import SYSTEM_DIR; print(SYSTEM_DIR)"
make integ_test
continue-on-error: true
build-and-test:
name: 'Core / Unit Test Pipeline'
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
# For publishing results
checks: write
# 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@v4
-
# Store the current date to use it as cache key for the environment
name: Get current date
id: date
run: echo "date=$(date +%Y-%m-%d)" >> "${GITHUB_OUTPUT}"
-
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: ${{ matrix.python-version }}
cache-suffix: unittest
-
name: Install dependencies
run: |
uv sync --locked --dev
-
name: Run Unit Tests
run: |
make unit_test
-
name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
junit_files: tests_xml/tests.xml
check_name: "Core / Unit Test Results (${{ matrix.python-version }})"
comment_mode: "off"
-
name: Upload Coverage Reports
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-report-core-unittests-py${{ matrix.python-version }}
path: coverage/
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