Bring HyperSpy 2 compatibility work into develop branch #375
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
push: | |
branches: | |
- '*' | |
pull_request: | |
branches: | |
- '*' | |
workflow_dispatch: | |
jobs: | |
code: | |
name: code style | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: psf/black@stable | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- uses: isort/isort-action@master | |
with: | |
configuration: --profile black --filter-files --force-sort-within-sections --check-only --diff | |
- 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 | |
tests: | |
name: ${{ matrix.os }}-py${{ matrix.python-version }}${{ matrix.LABEL }} | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 15 | |
env: | |
MPLBACKEND: agg | |
PYTEST_ARGS: --reruns 2 -n 2 --cov=kikuchipy | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
python-version: ['3.11', '3.12'] | |
include: | |
- os: ubuntu-latest | |
python-version: '3.10' | |
DEPENDENCIES: dask==2021.8.1 diffsims==0.5.2 hyperspy>=2 matplotlib==3.5 numba==0.57 numpy==1.23.0 orix==0.12.1 pooch==1.3.0 pyebsdindex==0.2.0 scikit-image==0.21.0 | |
LABEL: -oldest | |
- os: ubuntu-latest | |
python-version: '3.12' | |
LABEL: -minimum_requirement | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies and package | |
shell: bash | |
run: | | |
pip install wheel | |
pip install -U -e ".[tests,coverage]" | |
- name: Install oldest supported version | |
if: contains(matrix.LABEL, 'oldest') | |
run: | | |
pip install ${{ matrix.DEPENDENCIES }} | |
- name: Install optional dependencies on Linux and Windows | |
if: ${{ contains(matrix.LABEL, 'minimum_requirement') == false && matrix.os != 'macos-latest' }} | |
shell: bash | |
run: | | |
pip install -e ".[all]" | |
pip install pyopencl | |
- name: Install optional dependencies on macOS (without nlopt) | |
if: ${{ contains(matrix.LABEL, 'minimum_requirement') == false && matrix.os == 'macos-latest' }} | |
shell: bash | |
run: | | |
pip install -e . | |
pip install "pyebsdindex[gpu]" pyvista | |
- 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 src --doctest-modules --doctest-continue-on-failure | |
- 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 |