forked from Unidata/MetPy
113 lines (98 loc) · 3.62 KB
/
tests-conda.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
name: Conda Tests
# We don't want pushes (or PRs) to gh-pages to kick anything off
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
#
# Run all tests on Conda on both Windows and macOS
#
CondaTests:
name: ${{ matrix.os }} ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}-latest
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
python-version: [3.7, 3.8]
os: [macOS, Windows]
steps:
# We check out only a limited depth and then pull tags to save time
- name: Checkout source
uses: actions/checkout@v2
with:
fetch-depth: 100
- name: Get tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Setup conda caching
uses: actions/cache@v2
with:
path: ~/conda_pkgs_dir
key: conda-tests-${{ runner.os }}-${{ matrix.python-version}}-${{ hashFiles('ci/*') }}
restore-keys: |
conda-tests-${{ runner.os }}-${{ matrix.python-version}}
conda-tests-${{ runner.os }}
conda-tests-
- name: Set up Python ${{ matrix.python-version }}
uses: goanpeca/setup-miniconda@v1
with:
miniconda-version: "latest"
python-version: ${{ matrix.python-version }}
channel-priority: strict
channels: conda-forge/label/testing,conda-forge
show-channel-urls: true
# Needed for caching
use-only-tar-bz2: true
- name: Adjust dependencies for Windows
if: ${{ runner.os == 'Windows' }}
run: sed -e "s/scipy==.*/scipy==1.5.0/" -i'' ci/Current.txt
- name: Install dependencies
run: conda install --quiet --yes --file ci/test_requirements.txt --file ci/extra_requirements.txt --file ci/Current.txt
# This imports CartoPy to find its map data cache directory
- name: Get CartoPy maps dir
id: cartopy-cache
run: echo "::set-output name=dir::$(python -c 'import cartopy;print(cartopy.config["data_dir"])')"
- name: Setup mapdata caching
uses: actions/cache@v2
env:
# Increase to reset cache of map data
CACHE_NUMBER: 0
with:
path: ${{ steps.cartopy-cache.outputs.dir }}
key: cartopy-${{ env.CACHE_NUMBER }}
restore-keys: cartopy-
- name: Install
# For some reason on Windows 3.7 building the wheel fails to properly include our extra
# stuff. Executing the egg_info beforehand for some reason fixes it. No idea why. We're
# deep in territory where googling for answers helps not at all.
run: |
python setup.py egg_info
python -m pip install --no-deps .
- name: Run tests
# By running coverage in "parallel" mode and "combining", we can clean up the path names
run: |
export TEST_DATA_DIR=$GITHUB_WORKSPACE/staticdata
python -m coverage run -p -m pytest --mpl -W error::metpy.deprecation.MetpyDeprecationWarning tests/
python -m coverage combine
python -m coverage report
python -m coverage xml
- name: Run doctests
# Windows produces some slightly different types that causes doctests to fail
if: ${{ runner.os != 'Windows' }}
env:
PY_IGNORE_IMPORTMISMATCH: 1
run: python -m pytest --doctest-modules -k "not test" src;
- name: Upload test images
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: conda-${{ matrix.python-version }}-${{ runner.os }}-images
path: test_output/
- name: Upload coverage
uses: codecov/codecov-action@v1
with:
name: conda-${{ matrix.python-version }}-${{ runner.os }}