-
Notifications
You must be signed in to change notification settings - Fork 29
151 lines (128 loc) · 4.25 KB
/
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
148
149
150
151
name: Tests
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
workflow_dispatch:
workflow: '*'
jobs:
code:
name: code style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: psf/black@stable
- name: Install Black with Jupyter extension
run: |
pip install black[jupyter]
- name: Check code style of Jupyter notebooks
run: |
black --diff --line-length 77 doc/tutorials/*.ipynb
# Make sure all necessary files are included in a release
manifest:
name: check manifest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
pip install manifix
- name: Check MANIFEST.in file
run: |
python setup.py manifix
tests:
name: ${{ matrix.os }}-py${{ matrix.python-version }}${{ matrix.LABEL }}
runs-on: ${{ matrix.os }}
timeout-minutes: 15
env:
MPLBACKEND: agg
PYTEST_ARGS: --pyargs kikuchipy --reruns 2 -n 2 --cov=kikuchipy
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.10', '3.11']
include:
- os: ubuntu-latest
python-version: 3.8
DEPENDENCIES: dask==2021.8.1 diffsims==0.5.1 hyperspy~=2.0.rc0 matplotlib==3.5 numba==0.55 numpy==1.21.6 orix==0.11.1 pooch==1.3.0 pyebsdindex==0.2 scikit-image==0.16.2
LABEL: -oldest
- os: ubuntu-latest
python-version: 3.11
LABEL: -minimum_requirement
- os: ubuntu-latest
python-version: 3.11
DEPENDENCIES: hyperspy~=2.0.rc0
LABEL: -hyperspy2.0
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies and package
shell: bash
run: |
pip install wheel
pip install -U -e .'[tests]'
- name: Install special versions of dependencies
if: ${{ contains(matrix.LABEL, 'oldest') || contains(matrix.Label, 'hyperspy-2.0') }}
run: |
pip install ${{ matrix.DEPENDENCIES }}
- name: Install optional dependencies
if: ${{ contains(matrix.LABEL, 'minimum_requirement') == false }}
shell: bash
run: |
pip install -e .'[all]'
pip install pyopencl
- name: Display Python, pip and package versions
run: |
python -V
pip -V
pip list
- name: Set up headless display necessary for PyVista on Linux
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt-get update
sudo apt-get install xvfb
/sbin/ldconfig -p | grep stdc++ # Temporarily check location
- name: Set up headless display necessary for PyVista on Windows
if: ${{ matrix.os == 'windows-latest' }}
uses: pyvista/setup-headless-display-action@v1
- name: Run docstring tests
if: ${{ matrix.os == 'ubuntu-latest' }}
continue-on-error: true
run: |
xvfb-run pytest --doctest-modules --doctest-continue-on-failure --ignore-glob=kikuchipy/*/tests kikuchipy/*.py
- name: Run tests in a virtual X server environment on Ubuntu
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt-get update
sudo apt-get install xvfb
xvfb-run pytest ${{ env.PYTEST_ARGS }}
- name: Run tests on Windows or macOS
if: ${{ matrix.os != 'ubuntu-latest' }}
run: |
pytest ${{ env.PYTEST_ARGS }}
- name: Generate line coverage
run: |
coverage report --show-missing
- name: Upload coverage to Coveralls
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: AndreMiras/coveralls-python-action@develop
with:
parallel: true
coveralls-finish:
needs: tests
runs-on: ubuntu-latest
steps:
- name: Coveralls finished
uses: AndreMiras/coveralls-python-action@develop
with:
parallel-finished: true