Skip to content

Commit

Permalink
Merge pull request #139 from daducci/release/v2.3.0
Browse files Browse the repository at this point in the history
[RELEASE] v2.3.0
  • Loading branch information
nightwnvol authored Jul 4, 2024
2 parents e8e70bb + ee51638 commit 2c83868
Show file tree
Hide file tree
Showing 17 changed files with 1,522 additions and 2,742 deletions.
189 changes: 189 additions & 0 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
name: Build wheels
run-name: Build wheels - ${{ github.sha }}
on:
push:
branches:
- 'master'
- 'release/**'
jobs:
build_windows_wheels:
strategy:
matrix:
py: [cp38, cp39, cp310, cp311, cp312]
arch:
- [AMD64, win_amd64, x64, x64, 64bit]
- [x86, win32, x86, Win32, 32bit]
name: ${{ matrix.py }}-${{ matrix.arch[1] }}
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Compile pthread-win32
run: |
Import-Module 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\Microsoft.VisualStudio.DevShell.dll'
Enter-VsDevShell -VsInstallPath 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise' -DevCmdArguments '-arch=x64' -StartInPath 'C:\'
git clone https://github.com/GerHobbelt/pthread-win32.git
cd C:\pthread-win32\windows\VS2022
msbuild .\pthread.2022.sln -t:pthread_static_lib -p:Configuration=Release,Platform=${{ matrix.arch[3] }}
cd C:\
mkdir C:\pthread-win32_static_lib
mkdir C:\pthread-win32_static_lib\include
mkdir C:\pthread-win32_static_lib\lib
cp C:\pthread-win32\windows\VS2022\bin\Release-Unicode-${{ matrix.arch[4] }}-${{ matrix.arch[2] }}\pthread_static_lib.lib C:\pthread-win32_static_lib\lib\pthread.lib
cp C:\pthread-win32\_ptw32.h C:\pthread-win32_static_lib\include
cp C:\pthread-win32\pthread.h C:\pthread-win32_static_lib\include
cp C:\pthread-win32\sched.h C:\pthread-win32_static_lib\include
cp C:\pthread-win32\semaphore.h C:\pthread-win32_static_lib\include
- name: Build wheel ${{ matrix.py }}-${{ matrix.arch[1] }}
uses: pypa/[email protected]
env:
PTHREAD_WIN_INCLUDE: C:\pthread-win32_static_lib\include
PTHREAD_WIN_LIB: C:\pthread-win32_static_lib\lib
CIBW_PLATFORM: windows
CIBW_BUILD: ${{ matrix.py }}-${{ matrix.arch[1] }}
CIBW_ARCHS_WINDOWS: ${{ matrix.arch[0] }}

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: wheels_${{ matrix.py }}_${{ matrix.arch[1] }}
path: ./wheelhouse/*.whl
if-no-files-found: error

build_macos_wheels:
strategy:
matrix:
config:
[
{
py: cp38,
arch: [x86_64, macosx_x86_64, 12.0, macos-12]
},
{
py: cp39,
arch: [x86_64, macosx_x86_64, 12.0, macos-12]
},
{
py: cp310,
arch: [x86_64, macosx_x86_64, 12.0, macos-12]
},
{
py: cp311,
arch: [x86_64, macosx_x86_64, 12.0, macos-12]
},
{
py: cp312,
arch: [x86_64, macosx_x86_64, 12.0, macos-12]
},
{
py: cp38,
arch: [arm64, macosx_arm64, 12.0, macos-14]
},
{
py: cp39,
arch: [arm64, macosx_arm64, 12.0, macos-14]
},
{
py: cp310,
arch: [arm64, macosx_arm64, 12.0, macos-14]
},
{
py: cp311,
arch: [arm64, macosx_arm64, 12.0, macos-14]
},
{
py: cp312,
arch: [arm64, macosx_arm64, 12.0, macos-14]
}
]
name: ${{ matrix.config.py }}-${{ matrix.config.arch[1] }}
runs-on: ${{ matrix.config.arch[3] }}
if:
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install pipx # NOTE: required only for arm64
if: startsWith(matrix.config.arch[0], 'arm64')
run: |
brew install pipx
- name: Build wheel ${{ matrix.config.py }}-${{ matrix.config.arch[1] }}
uses: pypa/[email protected]
env:
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.config.arch[2] }}
CIBW_PLATFORM: macos
CIBW_BUILD: ${{ matrix.config.py }}-${{ matrix.config.arch[1] }}
CIBW_ARCHS_MACOS: ${{ matrix.config.arch[0] }}

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: wheels_${{ matrix.config.py }}_${{ matrix.config.arch[1] }}
path: ./wheelhouse/*.whl
if-no-files-found: error

build_linux_wheels:
strategy:
matrix:
py: [cp38, cp39, cp310, cp311, cp312]
arch:
- [x86_64, manylinux_x86_64, amd64]
- [aarch64, manylinux_aarch64, arm64]
name: ${{ matrix.py }}-${{ matrix.arch[1] }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/[email protected]
with:
platforms: ${{ matrix.arch[2] }}

- name: Build wheel ${{ matrix.py }}-${{ matrix.arch[1] }}
uses: pypa/[email protected]
env:
CIBW_PLATFORM: linux
CIBW_BUILD: ${{ matrix.py }}-${{ matrix.arch[1] }}
CIBW_ARCHS_LINUX: ${{ matrix.arch[0] }}

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: wheels_${{ matrix.py }}_${{ matrix.arch[1] }}
path: ./wheelhouse/*.whl
if-no-files-found: error

build_source_distribution:
name: sdist
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Build source distribution
run: |
pip install -U pip
pip install -U build
python -m build --sdist
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: sdist
path: ./dist/*.tar.gz
if-no-files-found: error

run_id:
name: Create/Update WHEELS_ARTIFACTS_RUN_ID secret
runs-on: ubuntu-latest
needs: [build_windows_wheels, build_macos_wheels, build_linux_wheels, build_source_distribution]
steps:
- uses: actions/checkout@v4
- run: |
gh secret set WHEELS_ARTIFACTS_RUN_ID --body ${{ github.run_id }}
env:
GH_TOKEN: ${{ secrets.GH_PAT }}
56 changes: 56 additions & 0 deletions .github/workflows/publish_on_pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Publish on PyPI
run-name: Publish on PyPI - ${{ github.sha }}
on:
release:
types: [published]
jobs:
publish_on_pypi:
name: Publish on PyPI
if: github.event.release.prerelease == false
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/dmri-commit
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
github-token: ${{ secrets.GH_PAT }}
run-id: ${{ secrets.WHEELS_ARTIFACTS_RUN_ID }}
path: dist
merge-multiple: true

- name: Publish on PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
verbose: true
print-hash: true

publish_on_pypi_test:
name: Publish on PyPI Test
if: github.event.release.prerelease == true && contains(github.event.release.tag_name, 'rc')
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/project/dmri-commit
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
github-token: ${{ secrets.GH_PAT }}
run-id: ${{ secrets.WHEELS_ARTIFACTS_RUN_ID }}
path: dist
merge-multiple: true

- name: Publish on PyPI Test
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true
verbose: true
print-hash: true
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
# Change Log
### All notable changes to `COMMIT` will be documented in this file.

## `v2.3.0`<br>_2024-07-04_
### ✨Added
- Added support for Windows (requires the `pthread-win32` library)
- Precompiled wheels for Windows, MacOS, and Linux are now available on PyPI

### 🛠️Changed
- `operator.pyx` no more compiled at runtime
- Restict the `numpy` version to `<2.0.0`

### 🐛Fixed
- Improved output when running from Jupyter notebooks

---
---

## `v2.2.0`<br>_2024-04-12_
### 🐛Fixed
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ recursive-include commit *.c
recursive-include commit *.cpp
recursive-include commit *.h
recursive-include commit *pyx
include setup_operator.py
Loading

0 comments on commit 2c83868

Please sign in to comment.