Merge pull request #713 from pyxem/dependabot/github_actions/pyvista/… #414
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
## | |
## Copyright 2019-2025 the kikuchipy developers | |
## | |
## This file is part of kikuchipy. | |
## | |
## kikuchipy is free software: you can redistribute it and/or modify | |
## it under the terms of the GNU General Public License as published by | |
## the Free Software Foundation, either version 3 of the License, or | |
## (at your option) any later version. | |
## | |
## kikuchipy is distributed in the hope that it will be useful, | |
## but WITHOUT ANY WARRANTY; without even the implied warranty of | |
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
## GNU General Public License for more details. | |
## | |
## You should have received a copy of the GNU General Public License | |
## along with kikuchipy. If not, see <http://www.gnu.org/licenses/>. | |
## | |
name: Tests | |
on: | |
push: | |
branches: | |
- '*' | |
pull_request: | |
branches: | |
- '*' | |
workflow_dispatch: | |
jobs: | |
tests: | |
name: ${{ matrix.os }}-py${{ matrix.python-version }}${{ matrix.LABEL }} | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 15 | |
env: | |
MPLBACKEND: agg | |
PYTEST_ARGS: --cov-branch --cov-report=xml --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@v3 | |
- 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 reports to Codecov | |
if: ${{ github.repository_owner == 'pyxem' }} | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} |