-
Notifications
You must be signed in to change notification settings - Fork 13
203 lines (195 loc) · 6.56 KB
/
ci.yaml
File metadata and controls
203 lines (195 loc) · 6.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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
name: CI
on:
pull_request:
push:
branches: [main]
tags: ['v*']
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v6
- uses: ./.github/actions/setup
# Verifies that Ruff and mypy checks are passing
- name: pre-commit
run: make pre-commit
tests-core:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Check out repository
uses: actions/checkout@v6
- uses: ./.github/actions/setup
with:
python-version: "3.13"
- name: Fetch sample data
run: uv run ref datasets fetch-sample-data
- name: Test core
run: |
echo "::group::test-core"
time make test-core
echo "::endgroup::"
- name: Test ref
run: |
echo "::group::test-ref"
time make test-ref
echo "::endgroup::"
- name: Test celery
run: |
echo "::group::test-celery"
time make test-celery
echo "::endgroup::"
- name: Test integration
run: |
echo "::group::test-integration"
time make test-integration
echo "::endgroup::"
- name: Coverage report
run: |
uv run coverage report
uv run coverage xml
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v6
with:
flags: core
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
tests-providers:
env:
REF_TEST_OUTPUT: "test-outputs"
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Check out repository
uses: actions/checkout@v6
- uses: ./.github/actions/setup
with:
python-version: "3.13"
- name: Fetch test data
run: make fetch-test-data
- name: Test example provider
run: |
echo "::group::test-diagnostic-example"
time make test-diagnostic-example
echo "::endgroup::"
- name: Test ESMValTool provider
run: |
echo "::group::test-diagnostic-esmvaltool"
time make test-diagnostic-esmvaltool
echo "::endgroup::"
- name: Test ILAMB provider
run: |
echo "::group::test-diagnostic-ilamb"
time make test-diagnostic-ilamb
echo "::endgroup::"
- name: Test PMP provider
run: |
echo "::group::test-diagnostic-pmp"
time make test-diagnostic-pmp
echo "::endgroup::"
- name: Coverage report
run: |
uv run coverage report
uv run coverage xml
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v6
with:
flags: providers
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Upload scratch artifacts
uses: actions/upload-artifact@v7
if: always()
with:
name: test-output-providers
path: ${{ env.REF_TEST_OUTPUT }}
retention-days: 7
imports-without-extras:
strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest" ]
python-version: [ "3.11", "3.13" ]
runs-on: "${{ matrix.os }}"
steps:
- name: Check out repository
uses: actions/checkout@v6
- uses: ./.github/actions/setup
with:
python-version: ${{ matrix.python-version }}
- name: Check importable without extras
run: |
uv run --isolated --with-editable packages/climate-ref --with typer --no-project scripts/test-install.py climate_ref
uv run --isolated --with-editable packages/climate-ref-core --with typer --no-project scripts/test-install.py climate_ref_core
uv run --isolated --with-editable packages/climate-ref-celery --with typer --no-project scripts/test-install.py climate_ref_celery
uv run --isolated --with-editable packages/climate-ref-ilamb --with typer --no-project scripts/test-install.py climate_ref_ilamb
uv run --isolated --with-editable packages/climate-ref-esmvaltool --with typer --no-project scripts/test-install.py climate_ref_esmvaltool
uv run --isolated --with-editable packages/climate-ref-pmp --with typer --no-project scripts/test-install.py climate_ref_pmp
check-build:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v6
- uses: ./.github/actions/setup
- name: Check build
run: |
make build
tar -tvf dist/climate_ref-*.tar.gz --wildcards '*climate_ref/py.typed' '*/LICENCE' '*/NOTICE'
tar -tvf dist/climate_ref_core-*.tar.gz --wildcards '*climate_ref_core/py.typed' '*/LICENCE' '*/NOTICE'
- name: Check installable
run: |
uv pip install dist/*.whl
uv pip freeze
uv run --no-sync python -c "import climate_ref; print(climate_ref.__version__)"
uv run --no-sync ref config list
# Check if a changelog message was added to the PR
# Only runs on pull requests
check-for-changelog:
runs-on: ubuntu-latest
if: github.event.pull_request && github.actor != 'dependabot[bot]'
steps:
- name: Check out repository
uses: actions/checkout@v6
- uses: ./.github/actions/setup
- name: Get all changelog files
id: changed-changelog-files
uses: tj-actions/changed-files@v47
with:
# Avoid using single or double quotes for multiline patterns
files: |
changelog/*.md
- name: Print out the changed files
if: steps.changed-changelog-files.outputs.any_changed == 'true'
env:
ALL_CHANGED_FILES: ${{ steps.changed-changelog-files.outputs.all_changed_files }}
run: |
make changelog-draft
- name: Fail if no changelog message is present
if: steps.changed-changelog-files.outputs.any_changed == 'false'
run: |
echo "No changelog present."
exit 1
smoke-test:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Set up Docker Compose
uses: docker/setup-compose-action@v2
- uses: ./.github/actions/setup
with:
python-version: ${{ matrix.python-version }}
- name: Run smoke test
run: |
bash scripts/smoke-test.sh
- name: Cleanup
if: always()
run: |
docker compose down -v