Testing: Add test for not changing underlying numpy array. #103
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: | |
pull_request: | |
branches: [main] | |
env: | |
MPLBACKEND: agg | |
jobs: | |
build-with-pip: | |
name: ${{ matrix.os }}-py${{ matrix.python-version }}${{ matrix.LABEL }} | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 45 | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
python-version: ["3.9", "3.10", "3.11"] | |
include: | |
- os: ubuntu-latest | |
python-version: 3.8 | |
DEPENDENCIES: diffsims==0.6.0 hyperspy~=2.0.rc0 lmfit==0.9.12 matplotlib==3.7.5 orix==0.12.1 scikit-image==0.19.0 scikit-learn==1.0.0 | |
LABEL: -oldest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Get the number of CPUs | |
id: cpus | |
run: | | |
import os, platform | |
num_cpus = os.cpu_count() | |
print(f"Number of CPU: {num_cpus}") | |
print(f"Architecture: {platform.machine()}") | |
output_file = os.environ["GITHUB_OUTPUT"] | |
with open(output_file, "a", encoding="utf-8") as output_stream: | |
output_stream.write(f"count={num_cpus}\n") | |
shell: python | |
- name: Install dependencies and package | |
shell: bash | |
run: | | |
pip install -U -e .'[tests]' | |
- name: Install oldest supported versions | |
if: contains(matrix.LABEL, 'oldest') | |
run: | | |
pip install ${{ matrix.DEPENDENCIES }} | |
- name: Display Python, pip and package versions | |
run: | | |
python -V | |
pip -V | |
pip list | |
- name: Run docstring tests | |
continue-on-error: true | |
run: | | |
pytest --doctest-modules --doctest-continue-on-failure --ignore-glob=pyxem/tests pyxem | |
- name: Run tests | |
run: | | |
pytest -n 1 --cov=pyxem --runslow --pyargs pyxem --durations=50 --timeout=360 | |
- 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 |