Merge pull request #78 from ericpre/RELEASE_2.1 #183
This file contains hidden or 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, pull_request] | |
jobs: | |
run_test_site: | |
name: py${{ matrix.PYTHON_VERSION }}${{ matrix.LABEL }} | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
env: | |
MPLBACKEND: agg | |
PIP_SELECTOR: '[tests]' | |
PYTEST_ARGS: --pyargs hyperspy_gui_ipywidgets | |
PYTEST_ARGS_COVERAGE: --cov=. --cov-report=xml | |
strategy: | |
fail-fast: false | |
matrix: | |
PYTHON_VERSION: ['3.10', '3.11', '3.13'] | |
LABEL: [-release, -dev] | |
PIP_ARGS: [""] | |
include: | |
- PYTHON_VERSION: '3.12' | |
PIP_ARGS: --pre | |
LABEL: -dev-pre_release | |
- PYTHON_VERSION: '3.12' | |
LABEL: -release-minimum | |
- PYTHON_VERSION: '3.12' | |
LABEL: -dev-minimum | |
- PYTHON_VERSION: '3.9' | |
LABEL: -release | |
- PYTHON_VERSION: '3.9' | |
LABEL: -oldest | |
# Matching pyproject.toml | |
DEPENDENCIES: hyperspy==2.3.0 ipywidgets==8.0 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: get repository name | |
shell: bash | |
run: echo "REPOSITORY_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV | |
- 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/${{ env.REPOSITORY_NAME }}.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 HyperSpy (dev) | |
if: contains( matrix.LABEL, 'dev') | |
run: | | |
pip install git+https://github.com/hyperspy/hyperspy.git@RELEASE_next_minor | |
- name: Install exSpy (dev) | |
if: contains( matrix.LABEL, 'dev') | |
run: | | |
pip install git+https://github.com/hyperspy/exspy.git | |
- name: Install | |
run: | | |
pip install ${{ matrix.PIP_ARGS }} .'${{ env.PIP_SELECTOR }}' | |
- name: Pip list | |
run: | | |
pip list | |
- name: Install oldest supported version | |
if: contains( matrix.LABEL, 'oldest') | |
run: | | |
pip install ${{ matrix.DEPENDENCIES }} | |
- name: Pip list | |
run: | | |
pip list | |
- name: Run test suite | |
run: | | |
pytest ${{ env.PYTEST_ARGS }} ${{ env.PYTEST_ARGS_COVERAGE }} | |
- name: Upload coverage to Codecov | |
if: ${{ always() }} && ${{ env.PYTEST_ARGS_COVERAGE }} | |
uses: codecov/codecov-action@v5 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |