Merge pull request #218 from hakonanes/fix-publish-workflow #261
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: build | |
on: | |
push: | |
branches: | |
- '*' | |
pull_request: | |
branches: | |
- '*' | |
workflow_dispatch: | |
env: | |
MPLBACKEND: agg | |
jobs: | |
# Make sure all necessary files will be included in a release | |
manifest: | |
name: check manifest | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
pip install manifix | |
- name: Check MANIFEST.in file | |
run: | | |
python setup.py manifix | |
build-with-pip: | |
name: ${{ matrix.os }}-py${{ matrix.python-version }}${{ matrix.LABEL }} | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 15 | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
python-version: ['3.10', '3.11'] | |
include: | |
# Oldest supported version of main dependencies | |
- os: ubuntu-latest | |
python-version: 3.8 | |
OLDEST_SUPPORTED_VERSION: true | |
DEPENDENCIES: diffpy.structure==3.0.2 matplotlib==3.5 numpy==1.17.3 orix==0.12.1 scipy==1.8 tqdm==4.9 | |
LABEL: -oldest | |
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 -U -e .'[tests]' | |
- name: Install oldest supported version | |
if: ${{ matrix.OLDEST_SUPPORTED_VERSION }} | |
run: | | |
pip install ${{ matrix.DEPENDENCIES }} | |
- name: Display Python, pip and package versions | |
run: | | |
python -V | |
pip -V | |
pip list | |
- name: Run docstring tests | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
continue-on-error: true | |
run: | | |
pytest --doctest-modules --doctest-continue-on-failure --ignore-glob=diffsims/tests/* | |
- name: Run tests | |
run: | | |
pytest -n 2 --cov=diffsims --pyargs diffsims | |
- name: Generate line coverage | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
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: build-with-pip | |
runs-on: ubuntu-latest | |
steps: | |
- name: Coveralls finished | |
uses: AndreMiras/coveralls-python-action@develop | |
with: | |
parallel-finished: true |