-
Notifications
You must be signed in to change notification settings - Fork 5
183 lines (153 loc) · 4.98 KB
/
ci_cd.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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
name: Unit Testing and Deployment
on:
pull_request:
workflow_dispatch:
push:
tags:
- "*"
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
ALLOW_PLOTTING: true
SHELLOPTS: 'errexit:pipefail'
jobs:
doc:
name: Build Documentation
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
cache-dependency-path: pyproject.toml
- name: Install pytest-pyvista with test dependencies
run: pip install .[docs] 'pyvista>=0.37'
- uses: awalsh128/[email protected]
with:
packages: libgl1-mesa-glx xvfb
version: 3.0
- name: Build Documentation
run: |
make -C doc html
touch doc/_build/html/.nojekyll
- name: Deploy on release
if: startsWith(github.ref, 'refs/tags/v')
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: doc/_build/html/
Linux:
name: Linux Unit Testing
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- python-version: '3.8'
vtk-version: '9.0.3'
- python-version: '3.9'
vtk-version: '9.1'
- python-version: '3.10'
vtk-version: '9.2.2'
- python-version: '3.11'
vtk-version: 'latest'
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: pyproject.toml
- name: Install pytest-pyvista with test dependencies
run: |
pip install .[tests] 'pyvista>=0.37'
- name: Set up vtk
if: ${{ matrix.vtk-version != 'latest' }}
run: pip install vtk==${{ matrix.vtk-version }}
- name: Limit NumPy for VTK 9.0.3
if: ${{ matrix.vtk-version == '9.0.3' }}
run: pip install 'numpy<1.24'
- uses: awalsh128/[email protected]
with:
packages: libgl1-mesa-glx xvfb python-tk
version: 3.0
- name: Software Report
run: |
xvfb-run python -c "import pytest_pyvista; pytest_pyvista"
which python
pip list
- name: Unit Testing
run: xvfb-run coverage run -m --source=pytest_pyvista --module pytest --verbose .
- uses: codecov/codecov-action@v3
if: matrix.python-version == '3.9'
name: 'Upload coverage to CodeCov'
release:
name: Release
if: |
github.event_name == 'push' &&
contains(github.ref, 'refs/tags')
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip build twine
- name: Build artifacts
run: |
python -m build && python -m twine check dist/*
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python -m twine upload --skip-existing ./**/*.whl
python -m twine upload --skip-existing ./**/*.tar.gz
- name: Publish to GitHub
uses: softprops/action-gh-release@v1
with:
files: |
./**/*.whl
./**/*.tar.gz
downstream:
name: Downstream tests
runs-on: ubuntu-20.04 # matching pyvista
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: git clone --depth=1 https://github.com/pyvista/pyvista.git --branch main --single-branch
- name: Install pyvista
run: pip install -ve .
working-directory: pyvista
- name: Install pyvista test requirements
run: pip install -v -r requirements_test.txt
working-directory: pyvista
- name: Install pytest-pyvista
run: pip install -ve .
- name: Software Report
run: |
xvfb-run python -c "import pyvista; print(pyvista.Report()); from pyvista import examples; print('User data path:', examples.USER_DATA_PATH)"
which python
pip list
working-directory: pyvista
- name: Unit Testing
run: xvfb-run python -m pytest --fail_extra_image_cache -v --generated_image_dir gen_dir tests/plotting/test_plotting.py
working-directory: pyvista
- name: Upload generated image artifact
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: generated_images
path: pyvista/gen_dir