Skip to content

Commit

Permalink
Merge pull request hyperspy#3288 from ericpre/RELEASE_next_patch
Browse files Browse the repository at this point in the history
Merge fast forward into release next patch after 2.0 release
  • Loading branch information
ericpre authored Dec 22, 2023
2 parents 502ef51 + 70412ec commit b78a4f9
Show file tree
Hide file tree
Showing 1,184 changed files with 24,531 additions and 97,990 deletions.
18 changes: 0 additions & 18 deletions .drone.yml

This file was deleted.

12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
target-branch: "RELEASE_next_patch"
13 changes: 13 additions & 0 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Documentation

on: [push, pull_request]

jobs:
Build:
# Use the "reusable workflow" from the hyperspy organisation
uses: hyperspy/.github/.github/workflows/doc.yml@main
with:
# install with speed extra to avoid warnings
pip_extra_doc: 'doc,speed'
# graphviz is required to build mermaid graph
install_package_ubuntu: graphviz
52 changes: 0 additions & 52 deletions .github/workflows/docs.yml

This file was deleted.

9 changes: 9 additions & 0 deletions .github/workflows/package_and_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: Package & Test

on: [push, pull_request]

jobs:
package_and_test:
name: Package and Test
# Use the "reusable workflow" from the hyperspy organisation
uses: hyperspy/.github/.github/workflows/package_and_test.yml@main
164 changes: 36 additions & 128 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
name: Release
# Reusable workflow are not supported with trusted publisher
# https://github.com/pypa/gh-action-pypi-publish/issues/166
# copy and paste
# https://github.com/hyperspy/.github/blob/main/.github/workflows/release_pure_python.yml

# This workflow builds the wheels "on tag".
# If run from the hyperspy/hyperspy repository, the wheels will be uploaded to pypi ;
# otherwise, the wheels will be available as a github artifact.
Expand All @@ -9,139 +14,42 @@ on:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
create_release:
package_and_test:
name: Package and Test
# Use the "reusable workflow" from the hyperspy organisation
uses: hyperspy/.github/.github/workflows/package_and_test.yml@main

upload_to_pypi:
needs: [package_and_test]
runs-on: ubuntu-latest
name: Upload to pypi
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- name: Download dist
uses: actions/download-artifact@v4

- name: Display downloaded files
run: |
ls -shR
working-directory: dist

- uses: pypa/gh-action-pypi-publish@release/v1
if: ${{ startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'hyperspy' }}
# See https://docs.pypi.org/trusted-publishers/using-a-publisher/

create_github_release:
# If zenodo is setup to create a DOI automatically on a GitHub release,
# this step will trigger the mining of the DOI
needs: upload_to_pypi
permissions:
contents: write
name: Create Release
name: Create GitHub Release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create Release
id: create_release
if: ${{ startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'hyperspy' }}
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844

build_wheels:
name: Wheels on ${{ matrix.os }}/py${{ matrix.python-version }}
needs: create_release
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
name: Install Python
with:
python-version: ${{ matrix.python-version }}

- name: What OS and Python version
run: |
uname -a
python --version
which python
- name: install build and twine
run: |
python -m pip install --upgrade pip
python -m pip install build twine
- name: Build wheels
run: |
python -m build
- name: Display content dist folder
run: |
ls dist/
- name: Install and test distribution
env:
MPLBACKEND: agg
run: |
pip install --pre --find-links dist hyperspy[tests]==1.7.6
pytest --pyargs hyperspy -k "not test_navigation_shape_signal2D"
- uses: actions/upload-artifact@v3
with:
path: ./dist/*.whl

- name: Publish wheels to PyPI
if: github.repository_owner == 'hyperspy'
env:
# Github secret set in the hyperspy/hyperspy repository
# Not available from fork or pull request
# Secrets are not passed to workflows that are triggered by a pull request from a fork
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
twine upload dist/*.whl --verbose
build_wheels_linux:
name: Wheels on ubuntu-latest
needs: create_release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Build source distribution
run: |
pip install build
python -m build --sdist
- name: Build manylinux Python wheels
uses: RalfG/python-wheels-manylinux-build@ff8504699f7a33a08d3ff85b3c6d4e8f0e70462b
with:
python-versions: 'cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311'
build-requirements: 'cython'

- name: Display content dist folder
run: |
ls dist/
- name: Install and test distribution
env:
MPLBACKEND: agg
run: |
pip install --pre --find-links dist hyperspy[tests]==1.7.6
pytest --pyargs hyperspy -k "not test_navigation_shape_signal2D"
- uses: actions/upload-artifact@v3
if: always()
with:
path: |
./dist/*-manylinux*.whl
./sdist/*.tar.gz
- name: Publish wheels to PyPI
if: github.repository_owner == 'hyperspy'
env:
# Github secret set in the hyperspy/hyperspy repository
# Not available from fork or pull request
# Secrets are not passed to workflows that are triggered by a pull request from a fork
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
twine upload dist/*-manylinux*.whl --verbose
twine upload dist/*.tar.gz --verbose
# Don't use the pypa publish action for now as we need to filter the `linux` wheels
# With hyperspy 2.0, it will be noarch and the release workflow will refactor
# - name: Publish wheels to PyPI
# if: github.repository_owner == 'hyperspy'
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# # Github secret set in the hyperspy/hyperspy repository
# # Not available from fork or pull request
# # Secrets are not passed to workflows that are triggered by a pull request from a fork
# password: ${{ secrets.PYPI_API_TOKEN }}
42 changes: 22 additions & 20 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,42 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu, windows, macos]
PYTHON_VERSION: ['3.8', '3.9']
PYTHON_VERSION: ['3.9', '3.10', ]
PIP_SELECTOR: ['[all, tests, coverage]']
include:
# test oldest supported version of main dependencies on python 3.7
# test oldest supported version of main dependencies on python 3.8
- os: ubuntu
PYTHON_VERSION: '3.7'
PYTHON_VERSION: '3.8'
PIP_SELECTOR: '[all, tests, coverage]'
OLDEST_SUPPORTED_VERSION: true
DEPENDENCIES: matplotlib==3.1.3 numpy==1.19.0 scipy==1.4 imagecodecs==2020.1.31 tifffile==2020.2.16 dask==2.11.0 distributed==2.11.0 scikit-image==0.15 numba==0.52 scikit-learn==1.0.1
DEPENDENCIES: dask[array]==2021.3.1 matplotlib==3.1.3 numba==0.52 numpy==1.20.0 scipy==1.5 scikit-image==0.18 scikit-learn==1.0.1
LABEL: -oldest
# test minimum requirement
- os: ubuntu
PYTHON_VERSION: '3.8'
PYTHON_VERSION: '3.12'
PIP_SELECTOR: '[tests, coverage]'
LABEL: -minimum
# Run coverage
- os: ubuntu
PYTHON_VERSION: '3.7'
PIP_SELECTOR: '[all, tests, coverage]'
# Run coverage
- os: ubuntu
PYTHON_VERSION: '3.8'
PIP_SELECTOR: '[all, tests, coverage]'
- os: ubuntu
PYTHON_VERSION: '3.10'
PIP_SELECTOR: '[all, tests, coverage]'
- os: ubuntu
PYTHON_VERSION: '3.11'
PIP_SELECTOR: '[all, tests, coverage]'

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

- 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/hyperspy.git
git fetch upstream --tags
- uses: actions/setup-python@v4
name: Install Python
Expand All @@ -57,17 +62,10 @@ jobs:
python --version
pip --version
- name: Install numba rc
if: contains(matrix.PYTHON_VERSION, '3.11')
# Require for python 3.11 support, remove when numba 0.57 is release
shell: bash
run: |
pip install numba --pre
- name: Install oldest supported version
if: ${{ matrix.OLDEST_SUPPORTED_VERSION }}
run: |
pip install ${{ matrix.DEPENDENCIES }}
pip install ${{ matrix.DEPENDENCIES }} -v
- name: Install
shell: bash
Expand All @@ -82,6 +80,10 @@ jobs:
run: |
pytest ${{ env.PYTEST_ARGS }} --cov=. --cov-report=xml
- name: Run doctest (Docstring)
run: |
pytest ${{ env.PYTEST_ARGS }} --doctest-modules --ignore=hyperspy/tests
- name: Upload coverage to Codecov
if: ${{ always() }}
uses: codecov/codecov-action@v3
Loading

0 comments on commit b78a4f9

Please sign in to comment.