Skip to content

Merge pull request #79 from hyperspy/dependabot/github_actions/softpr… #210

Merge pull request #79 from hyperspy/dependabot/github_actions/softpr…

Merge pull request #79 from hyperspy/dependabot/github_actions/softpr… #210

Workflow file for this run

name: Tests
on: [push, pull_request]
jobs:
run_test_site:
name: py${{ matrix.PYTHON_VERSION }}${{ matrix.LABEL }}
runs-on: ubuntu-latest
timeout-minutes: 30
env:
ETS_TOOLKIT: qt
MPLBACKEND: agg
PIP_SELECTOR: '[tests]'
PYTEST_ARGS: --pyargs hyperspy_gui_traitsui
PYTEST_ARGS_COVERAGE: --cov=. --cov-report=xml
strategy:
fail-fast: false
matrix:
PYTHON_VERSION: ['3.9', '3.10', '3.11']
LABEL: [-release, -RnM]
PIP_ARGS: [""]
include:
- PYTHON_VERSION: '3.8'
PIP_ARGS: --pre
LABEL: -pre_release-RnM
- PYTHON_VERSION: '3.12'
LABEL: -minimum
- PYTHON_VERSION: '3.12'
LABEL: -RnM
- PYTHON_VERSION: '3.8'
OLDEST_SUPPORTED_VERSION: true
# Matching setup.py
DEPENDENCIES: traits==5.0 traitsui==6.1 pyqt5==5.12.0
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch tags upstream
if: ${{ github.repository_owner != 'hyperspy' }}
# Needs to fetch the tags from upstream to get the
# correct version with setuptools_scm
run: |
git remote add upstream https://github.com/hyperspy/hyperspy_gui_traitsui.git
git fetch upstream --tags
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: ${{ matrix.PYTHON_VERSION }}
- name: Display version
run: |
python --version
pip --version
- name: Install oldest supported version
if: ${{ matrix.OLDEST_SUPPORTED_VERSION }}
run: |
pip install ${{ matrix.DEPENDENCIES }}
- name: 'Install Ubuntu packages for Qt'
run: |
sudo apt-get update
sudo apt-get install qtbase5-dev
sudo apt-get install libxkbcommon-x11-0
sudo apt-get install libxcb-icccm4
sudo apt-get install libxcb-image0
sudo apt-get install libxcb-keysyms1
sudo apt-get install libxcb-randr0
sudo apt-get install libxcb-render-util0
sudo apt-get install libxcb-xinerama0
- name: Install HyperSpy (RELEASE_next_minor)
if: contains( matrix.LABEL, 'RnM')
run: |
pip install git+https://github.com/hyperspy/hyperspy.git@RELEASE_next_minor
- name: Install HyperSpy (RELEASE_next_patch)
if: contains( matrix.LABEL, 'RnP')
run: |
pip install git+https://github.com/hyperspy/hyperspy.git@RELEASE_next_patch
- name: Install exSpy
if: ${{ ! contains( matrix.LABEL, 'minimum') }}
run: |
pip install git+https://github.com/hyperspy/exspy.git
- name: Install Dependencies
run: |
pip install pyqt5
- name: Install
run: |
pip install ${{ matrix.PIP_ARGS }} .'${{ env.PIP_SELECTOR }}'
- name: Run test suite
run: |
sudo apt-get install xvfb
xvfb-run pytest ${{ env.PYTEST_ARGS }} ${{ env.PYTEST_ARGS_COVERAGE }}
- name: Upload coverage to Codecov
if: ${{ always() }} && ${{ env.PYTEST_ARGS_COVERAGE }}
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}