-
Notifications
You must be signed in to change notification settings - Fork 124
79 lines (73 loc) · 2.26 KB
/
ci.yml
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
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}
jobs:
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.9", "3.10", "3.11"]
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: Create Environment with Mamba
uses: mamba-org/setup-micromamba@v1
with:
environment-name: climada_env_${{ matrix.python-version }}
environment-file: requirements/env_climada.yml
create-args: >-
python=${{ matrix.python-version }}
make
# Persist environment for branch, Python version, single day
cache-environment-key: env-${{ github.ref }}-${{ matrix.python-version }}-${{ steps.date.outputs.date }}
-
name: Install CLIMADA
run: |
python -m pip install ".[test]"
-
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: feature/exposures_crs
permissions:
checks: write