Skip to content

Commit

Permalink
Merge pull request #222 from ericpre/add_osx_arm64_githubCI
Browse files Browse the repository at this point in the history
Add osx arm64 GitHub ci
  • Loading branch information
jlaehne authored Feb 3, 2024
2 parents 44e2d29 + e3930b7 commit 03bbe45
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 10 deletions.
44 changes: 35 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,52 @@ on: [push, pull_request, workflow_dispatch]

jobs:
run_test_site:
name: ${{ matrix.os }}-py${{ matrix.PYTHON_VERSION }}${{ matrix.LABEL }}
runs-on: ${{ matrix.os }}-latest
name: ${{ matrix.os }}-${{ matrix.os_version }}-py${{ matrix.PYTHON_VERSION }}${{ matrix.LABEL }}
runs-on: ${{ matrix.os }}-${{ matrix.os_version }}
timeout-minutes: 30
env:
MPLBACKEND: agg
strategy:
fail-fast: false
matrix:
os: [ubuntu, windows, macos]
os_version: [latest]
PYTHON_VERSION: ['3.9', '3.10']
LABEL: ['']
include:
# test oldest supported version of main dependencies on python 3.8
- os: ubuntu
os_version: latest
PYTHON_VERSION: '3.8'
# Set pillow and scikit-image version to be compatible with imageio and scipy
# matplotlib needs 3.5 to support markers in hyperspy 2.0 (requires `collection.set_offset_transform`)
DEPENDENCIES: matplotlib==3.5 numpy==1.20.0 imagecodecs==2020.1.31 tifffile==2020.2.16 dask[array]==2021.3.1 numba==0.52 imageio==2.16 pillow==8.3.2 scikit-image==0.18.0
LABEL: '-oldest'
# test minimum requirement
- os: ubuntu
os_version: latest
PYTHON_VERSION: '3.9'
LABEL: '-minimum'
- os: ubuntu
os_version: latest
PYTHON_VERSION: '3.12'
LABEL: '-minimum-without-hyperspy'
- os: ubuntu
os_version: latest
PYTHON_VERSION: '3.11'
LABEL: '-hyperspy-dev'
- os: ubuntu
os_version: latest
PYTHON_VERSION: '3.9'
LABEL: '-without-hyperspy'
- os: ubuntu
os_version: latest
PYTHON_VERSION: '3.8'
- os: ubuntu
os_version: latest
PYTHON_VERSION: '3.11'
- os: macos
os_version: '14'
PYTHON_VERSION: '3.11'

steps:
Expand All @@ -59,7 +73,19 @@ jobs:
name: Install Python
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: Set Environment Variable
shell: bash
# Set PIP_SELECTOR environment variable according to matrix.LABEL
Expand All @@ -81,15 +107,15 @@ jobs:
run: |
pip install ${{ matrix.DEPENDENCIES }}
- name: Install (HyperSpy dev)
- name: Install hyperspy and exspy
if: ${{ ! contains(matrix.LABEL, 'without-hyperspy') }}
# Need to install hyperspy dev until hyperspy 2.0 is released
run: |
pip install git+https://github.com/hyperspy/hyperspy.git@RELEASE_next_major
pip install hyperspy exspy
- name: Install (exspy)
if: ${{ ! contains(matrix.LABEL, '-minimum') && ! contains(matrix.LABEL, 'without-hyperspy') }}
- name: Install hyperspy and exspy (dev)
if: ${{ contains(matrix.LABEL, 'hyperspy-dev') }}
run: |
pip install git+https://github.com/hyperspy/hyperspy.git
pip install git+https://github.com/hyperspy/exspy.git
- name: Install
Expand All @@ -103,7 +129,7 @@ jobs:
- name: Run test suite
run: |
pytest --pyargs rsciio --reruns 3 -n 2 --cov=. --cov-report=xml
pytest --pyargs rsciio --reruns 3 -n ${{ steps.cpus.outputs.count }} --cov=. --cov-report=xml
- name: Upload coverage to Codecov
if: ${{ always() }}
Expand Down
2 changes: 1 addition & 1 deletion rsciio/tests/test_hspy.py
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ def test_save_ragged_array(tmp_path, file):


@zspy_marker
@pytest.mark.parametrize("nav_dim", [1, 2, 3])
@pytest.mark.parametrize("nav_dim", [1, 2])
@pytest.mark.parametrize("lazy", [True, False])
def test_save_ragged_dim(tmp_path, file, nav_dim, lazy):
file = f"nav{nav_dim}_" + file
Expand Down
1 change: 1 addition & 0 deletions upcoming_changes/222.maintenance.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Run test suite on osx arm64 on GitHub CI and speed running test suite using all available CPUs (3 or 4) instead of only 2.

0 comments on commit 03bbe45

Please sign in to comment.