Skip to content

Commit

Permalink
Merge pull request #2914 from ericpre/CI_maintenance
Browse files Browse the repository at this point in the history
Add python 3.10 and fix some tests
  • Loading branch information
jlaehne committed Mar 30, 2022
2 parents e56209a + 8e55714 commit 2fac7e8
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 26 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Create Release
id: create_release
uses: actions/create-release@v1
Expand All @@ -38,12 +38,12 @@ jobs:
fail-fast: false
matrix:
os: [windows-latest, macos-latest]
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: ['3.7', '3.8', '3.9', '3.10']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: actions/setup-python@v2
- uses: actions/setup-python@v3
name: Install Python
with:
python-version: ${{ matrix.python-version }}
Expand Down Expand Up @@ -74,7 +74,7 @@ jobs:
pip install --pre --find-links dist hyperspy[tests]
pytest --pyargs hyperspy
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
path: ./dist/*.whl

Expand All @@ -94,10 +94,10 @@ jobs:
needs: create_release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: 3.8

Expand All @@ -111,9 +111,9 @@ jobs:
python -m build --sdist
- name: Build manylinux Python wheels
uses: RalfG/python-wheels-manylinux-build@v0.3.3
uses: RalfG/python-wheels-manylinux-build@v0.4.2
with:
python-versions: 'cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39'
python-versions: 'cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310'
build-requirements: 'cython'

- name: Display content dist folder
Expand All @@ -127,7 +127,7 @@ jobs:
pip install --pre --find-links dist hyperspy[tests]
pytest --pyargs hyperspy
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
path: |
./dist/*-manylinux*.whl
Expand Down
25 changes: 14 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu, windows, macos]
PYTHON_VERSION: [3.8, 3.9]
PYTHON_VERSION: ['3.8', '3.9']
PIP_SELECTOR: ['[all, tests]']
include:
# test oldest supported version of main dependencies on python 3.6
- os: ubuntu
PYTHON_VERSION: 3.7
PYTHON_VERSION: '3.7'
OLDEST_SUPPORTED_VERSION: true
DEPENDENCIES: matplotlib==3.1.3 numpy==1.17.1 scipy==1.1 imagecodecs==2020.1.31 tifffile==2020.2.16 dask==2.11.0 distributed==2.11.0 scikit-image==0.15 numba==0.52
PIP_SELECTOR: '[all, tests, coverage]'
Expand All @@ -30,27 +30,30 @@ jobs:
LABEL: -oldest
# test minimum requirement
- os: ubuntu
PYTHON_VERSION: 3.8
PYTHON_VERSION: '3.8'
PIP_SELECTOR: '[tests]'
LABEL: -minimum
# Run coverage
- os: ubuntu
PYTHON_VERSION: 3.8
PYTHON_VERSION: '3.8'
PIP_SELECTOR: '[all, tests, coverage]'
PYTEST_ARGS_COVERAGE: --cov=. --cov-report=xml
LABEL: -coverage
- os: ubuntu
PYTHON_VERSION: 3.7
PYTHON_VERSION: '3.7'
PIP_SELECTOR: '[all, tests]'
- os: ubuntu
PYTHON_VERSION: '3.10'
PIP_SELECTOR: '[all, tests]'
exclude:
# redundant build (same as coverage)
- os: ubuntu
PYTHON_VERSION: 3.8
PYTHON_VERSION: '3.8'

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: actions/setup-python@v2
- uses: actions/setup-python@v3
name: Install Python
with:
python-version: ${{ matrix.PYTHON_VERSION }}
Expand Down Expand Up @@ -80,7 +83,7 @@ jobs:
- name: Upload coverage to Codecov
if: ${{ always() }} && ${{ matrix.PYTEST_ARGS_COVERAGE }}
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v2

build_doc:
name: Build doc
Expand All @@ -90,7 +93,7 @@ jobs:
LATEX_DEPS: dvipng latexmk texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: ericpre/sphinx-action@latest_sphinx
with:
Expand All @@ -99,7 +102,7 @@ jobs:
build-command: make html
docs-folder: doc/

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
path: ./doc/_build/html/
name: doc_build
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests_extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ jobs:
shell: bash -l {0}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: conda-incubator/setup-miniconda@master
- uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge
miniforge-version: latest
Expand Down
3 changes: 2 additions & 1 deletion hyperspy/tests/io/test_hdf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ def test_save_long_list(self, tmp_path, file):
fname = tmp_path / file
s.save(fname)
end = time.time()
assert end - start < 1.0 # It should finish in less that 1 s.
# It should finish in less that 2 s on CI.
assert end - start < 2.0

@zspy_marker
def test_numpy_only_inner_lists(self, tmp_path, file):
Expand Down
4 changes: 2 additions & 2 deletions hyperspy/tests/model/test_linear_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def test_convolved_and_std_error(self):
lm = m.as_signal()
std_lm = m.p_std
diff = linear - lm
np.testing.assert_allclose(diff.data.sum(), 0.0)
np.testing.assert_allclose(diff.data.sum(), 0.0, atol=3E-7)
np.testing.assert_allclose(std_linear, std_lm)

def test_nonconvolved(self):
Expand All @@ -293,7 +293,7 @@ def test_nonconvolved(self):
m.fit(optimizer='lm')
lm = m.as_signal()
diff = linear - lm
np.testing.assert_allclose(diff.data.sum(), 0.0)
np.testing.assert_allclose(diff.data.sum(), 0.0, atol=3E-7)


class TestWarningSlowMultifit:
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ def __exit__(self, type, value, traceback):
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: Science/Research",
Expand Down
1 change: 1 addition & 0 deletions upcoming_changes/2914.maintenance.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Tweak tests tolerance to fix tests failure on aarch64 platform; Add python 3.10 build.

0 comments on commit 2fac7e8

Please sign in to comment.