-
Notifications
You must be signed in to change notification settings - Fork 367
140 lines (123 loc) · 4.91 KB
/
ci-testing.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
name: Tests
on:
push:
pull_request:
schedule:
# 10th of each month
- cron: "0 0 10 * *"
workflow_dispatch:
jobs:
build:
if: github.repository == 'scitools/cartopy'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.10', '3.11', '3.12', '3.13-dev']
use-network: [true]
include:
- os: ubuntu-latest
python-version: '3.11'
use-network: false
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Minimum packages
if: |
matrix.python-version == '3.10' && matrix.os == 'ubuntu-latest' &&
(github.event_name == 'push' || github.event_name == 'pull_request')
id: minimum-packages
run: |
pip install cython==0.29.28 matplotlib==3.6 numpy==1.23 owslib==0.27 pyproj==3.3.1 scipy==1.9 shapely==2.0 pyshp==2.3.1
- name: Coverage packages
id: coverage
# only want the coverage to be run on the latest ubuntu and for code changes i.e. push and pr
if: |
matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest' &&
(github.event_name == 'push' || github.event_name == 'pull_request')
run: |
echo "CYTHON_COVERAGE=1" >> $GITHUB_ENV
# Also add doctest here to avoid windows runners which expect a different path separator
echo "EXTRA_TEST_ARGS=--cov=cartopy -ra --doctest-modules" >> $GITHUB_ENV
pip install cython
- name: Install Nightlies
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
run: |
# Install Nightly builds from Scientific Python
python -m pip install --pre --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple matplotlib pyproj scipy shapely
- name: Install Cartopy
id: install
run: |
pip install -e .[test]
python -c "import cartopy; print('Version ', cartopy.__version__)"
- name: Install extras
# Default is to install just the minimum testing requirements,
# but we want to get as much coverage as possible.
if: steps.minimum-packages.conclusion == 'skipped'
run: |
pip install .[ows,plotting,speedups]
- name: Testing
id: test
if: matrix.use-network
# we need to force bash to use line continuations on Windows
shell: bash
run: |
# Check that the downloader tool at least knows where to get the data from (but don't actually download it)
python -m cartopy.feature.download gshhs physical --dry-run
# It should also be available as a script
cartopy_feature_download gshhs physical --dry-run
CARTOPY_GIT_DIR=$PWD
pytest -rfEsX -n 4 \
--color=yes \
--mpl --mpl-generate-summary=html \
--mpl-results-path="cartopy_test_output-${{ matrix.os }}-${{ matrix.python-version }}" \
--pyargs cartopy ${EXTRA_TEST_ARGS}
- name: No Network Tests
# Ensure any test that needs network access has been marked as such
if: ${{ ! matrix.use-network }}
run: |
pip install pytest-socket
pytest -rfEsX -n 4 \
--color=yes \
--pyargs cartopy -m "not natural_earth and not network" --disable-socket
- name: Coveralls
if: steps.coverage.conclusion == 'success'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run:
coveralls --service=github
- name: Upload image results
uses: actions/upload-artifact@v4
if: failure()
with:
name: image-failures-${{ matrix.os }}-${{ matrix.python-version }}
path: cartopy_test_output-${{ matrix.os }}-${{ matrix.python-version }}
# Separate dependent job to only upload one issue from the matrix of jobs
create-issue:
if: ${{ failure() && github.event_name == 'schedule' }}
needs: [build]
permissions:
issues: write
runs-on: ubuntu-latest
name: Create issue on failure
steps:
- name: Create issue on failure
uses: imjohnbo/issue-bot@v3
with:
title: "[TST] Upcoming dependency test failures"
body: |
The build with nightly wheels from matplotlib, pyproj, scipy, shapely and
their dependencies has failed. Check the logs for any updates that need to
be made in cartopy.
https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
pinned: false
close-previous: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}