-
Notifications
You must be signed in to change notification settings - Fork 280
154 lines (137 loc) · 4.45 KB
/
build-test.yaml
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
name: Build and Test
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
defaults:
run:
shell: bash
env:
HOMEBREW_NO_AUTO_UPDATE: 1
jobs:
build:
name: "${{ matrix.tests-type }} tests: py${{ matrix.python-version }} on ${{ matrix.os }} (${{ matrix.test-runner }})"
strategy:
# run all tests even if e.g. image tests fail early
fail-fast: false
matrix:
os: [
macos-latest,
windows-latest,
ubuntu-latest,
]
python-version: ['3.11']
dependencies: [full]
tests-type: [unit]
test-runner: [pytest]
include:
- os: ubuntu-latest
python-version: '3.8'
dependencies: minimal
tests-type: unit
test-runner: pytest
- os: ubuntu-latest
# this job is necessary for non-answer, 'yield' based tests
# because pytest doesn't support such tests, and nose is not
# compatible with Python 3.10
python-version: '3.9'
dependencies: full
tests-type: unit
test-runner: nose
- os: ubuntu-latest
# answer tests use 'yield', so they require nose
# they are also attached to a specific, occasionally updated, Python version
# but it does *not* have to match the current minimal supported version
python-version: '3.9'
dependencies: full
tests-type: answer
test-runner: nose
runs-on: ${{ matrix.os }}
concurrency:
# auto-cancel any in-progress job *on the same branch*
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.tests-type }}-py${{ matrix.python-version }}-${{ matrix.os }}-${{ matrix.test-runner }}
cancel-in-progress: true
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Checkout repo (bare)
if: matrix.tests-type != 'answer'
uses: actions/checkout@v3
- name: Checkout repo (with submodules)
if: matrix.tests-type == 'answer'
uses: actions/checkout@v3
with:
submodules: true
- name: Set up Conda (windows only)
uses: s-weigand/setup-conda@v1
if: matrix.os == 'windows-latest'
with:
update-conda: true
conda-channels: conda-forge
activate-conda: true
python-version: ${{matrix.python-version}}
- name: Install dependencies and yt
shell: bash
env:
dependencies: ${{ matrix.dependencies }}
run: source ./tests/ci_install.sh
- name: Run Unit Tests (pytest)
if: matrix.test-runner == 'pytest'
run: pytest --color=yes
- name: Run Tests (nose)
if: matrix.test-runner == 'nose'
run: cat nose_ignores.txt | xargs python -m nose -c nose_unit.cfg --traverse-namespace
image-tests:
name: Image tests
runs-on: ubuntu-latest
concurrency:
# auto-cancel any in-progress job *on the same branch*
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Checkout repo (with submodules)
uses: actions/checkout@v3
with:
submodules: true
- name: Install dependencies and yt
shell: bash
env:
dependencies: ''
run: |
source ./tests/ci_install.sh
python -m pip install 'cartopy>=0.22'
- name: Run Image Tests
run: |
pytest --color=yes --mpl -m mpl_image_compare \
--mpl-generate-summary=html \
--mpl-results-path=pytest_mpl_results \
--mpl-baseline-path=tests/pytest_mpl_baseline
- name: Generate new image baseline
if: failure()
run: |
pytest --color=yes --mpl -m mpl_image_compare \
--mpl-generate-path=pytest_mpl_new_baseline \
--last-failed
# always attempt to upload artifacts, even
# (and especially) in case of failure.
- name: Upload pytest-mpl report
if: always()
uses: actions/upload-artifact@v3
with:
name: yt_pytest_mpl_results
path: pytest_mpl_results/*
- name: Upload pytest-mpl baseline
if: always()
uses: actions/upload-artifact@v3
with:
name: yt_pytest_mpl_new_baseline
path: pytest_mpl_new_baseline/*
if-no-files-found: ignore