-
Notifications
You must be signed in to change notification settings - Fork 283
147 lines (127 loc) · 4.15 KB
/
ci-tests.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
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
# reference:
# - https://github.com/actions/cache
# - https://github.com/actions/checkout
# - https://github.com/marketplace/actions/setup-miniconda
name: ci-tests
on:
push:
branches:
- "main"
- "v*x"
tags:
- "v*"
pull_request:
branches:
- "*"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
tests:
name: "${{ matrix.session }} (py${{ matrix.python-version }} ${{ matrix.os }})"
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.12"]
session: ["doctest", "gallery", "linkcheck"]
include:
- os: "ubuntu-latest"
python-version: "3.12"
session: "tests"
coverage: "--coverage"
- os: "ubuntu-latest"
python-version: "3.11"
session: "tests"
- os: "ubuntu-latest"
python-version: "3.10"
session: "tests"
env:
IRIS_TEST_DATA_VERSION: "2.25"
ENV_NAME: "ci-tests"
steps:
- name: "checkout"
uses: actions/checkout@v4
- name: "environment configure"
env:
# Maximum cache period (in weeks) before forcing a cache refresh.
CACHE_WEEKS: 2
run: |
echo "CACHE_PERIOD=$(date +%Y).$(expr $(date +%U) / ${CACHE_WEEKS})" >> ${GITHUB_ENV}
echo "LOCK_FILE=requirements/locks/py$(echo ${{ matrix.python-version }} | tr -d '.')-linux-64.lock" >> ${GITHUB_ENV}
- name: "data cache"
uses: ./.github/workflows/composite/iris-data-cache
with:
cache_build: 5
env_name: ${{ env.ENV_NAME }}
version: ${{ env.IRIS_TEST_DATA_VERSION }}
- name: "conda package cache"
uses: ./.github/workflows/composite/conda-pkg-cache
with:
cache_build: 5
cache_period: ${{ env.CACHE_PERIOD }}
env_name: ${{ env.ENV_NAME }}
- name: "conda install"
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
channels: conda-forge
activate-environment: ${{ env.ENV_NAME }}
auto-update-conda: false
- name: "conda environment cache"
uses: ./.github/workflows/composite/conda-env-cache
with:
cache_build: 5
cache_period: ${{ env.CACHE_PERIOD }}
env_name: ${{ env.ENV_NAME }}
install_packages: "cartopy nox pip"
- name: "conda info"
run: |
conda info
conda list
- name: "cartopy cache"
uses: ./.github/workflows/composite/cartopy-cache
with:
cache_build: 5
cache_period: ${{ env.CACHE_PERIOD }}
env_name: ${{ env.ENV_NAME }}
- name: "nox cache"
uses: ./.github/workflows/composite/nox-cache
with:
cache_build: 5
env_name: ${{ env.ENV_NAME }}
lock_file: ${{ env.LOCK_FILE }}
# TODO: drop use of site.cfg and explicit use of mplrc
- name: "iris configure"
env:
SITE_CFG: lib/iris/etc/site.cfg
MPL_RC: ${HOME}/.config/matplotlib/matplotlibrc
run: |
mkdir -p $(dirname ${SITE_CFG})
echo ${SITE_CFG}
echo "[Resources]" >> ${SITE_CFG}
echo "test_data_dir = ${HOME}/iris-test-data/test_data" >> ${SITE_CFG}
echo "doc_dir = ${GITHUB_WORKSPACE}/docs" >> ${SITE_CFG}
cat ${SITE_CFG}
mkdir -p $(dirname ${MPL_RC})
echo ${MPL_RC}
echo "backend : agg" >> ${MPL_RC}
echo "image.cmap : viridis" >> ${MPL_RC}
cat ${MPL_RC}
- name: "iris ${{ matrix.session }}"
env:
PY_VER: ${{ matrix.python-version }}
# Force coloured output on GitHub Actions.
PY_COLORS: "1"
run: |
nox --session ${{ matrix.session }} -- --verbose ${{ matrix.coverage }}
- name: "upload coverage report"
if: ${{ matrix.coverage }}
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}