From e0a5efbb090bbb798a4fa5dbb56be704fcfacc16 Mon Sep 17 00:00:00 2001 From: Matthew Scroggs Date: Tue, 17 Sep 2024 17:25:27 +0100 Subject: [PATCH 1/7] add release workflow --- .github/workflows/release.yml | 116 ++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..dc97a6b3 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,116 @@ +# This file is based on one that was autogenerated by maturin v1.7.1 using: +# maturin generate-ci github +name: 📦 + +on: + push: + tags: ['*'] + branches: ['mscroggs/pip'] + pull_request: + workflow_dispatch: + +permissions: + contents: read + +jobs: + linux: + name: Build linux wheel + runs-on: ubuntu-latest + strategy: + matrix: + platform: + - target: x86_64-unknown-linux-gnu + container: quay.io/pypa/manylinux_2_28_x86_64 + wheel: wheels-linux-x86_64 + package-manager: yum + python: /opt/python/cp38-cp38/bin/python + container: ${{ matrix.platform.container }} + steps: + - name: Set up Rust + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: ${{ matrix.rust-version }} + components: rustfmt + + - name: Install OpenBLAS, LAPACK, OpenSSL (yum) + run: yum -y install openblas-devel lapack-devel openssl-devel + if: matrix.platform.package-manager == 'yum' + - name: Install OpenBLAS, LAPACK, OpenSSL (apt) + run: apt-get -y install libopenblas-dev liblapack-dev + if: matrix.platform.package-manager == 'apt' + + - uses: actions/checkout@v4 + + # TODO: swap to `pip install maturin>=1.7.2` once there's a new release + - name: Install maturin, CFFI + run: | + ${{ matrix.platform.python }} -m pip install git+https://github.com/PyO3/maturin.git + ${{ matrix.platform.python }} -m pip install cffi + + - name: Build wheel + run: ${{ matrix.platform.python }} -m maturin build --release --out dist -i ${{ matrix.platform.python }} --target ${{ matrix.platform.target }} + + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.platform.wheel }} + path: dist + + macos: + name: Build MacOS wheel + runs-on: ${{ matrix.platform.runner }} + strategy: + matrix: + platform: + - runner: macos-12 + target: x86_64 + - runner: macos-14 + target: aarch64 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.x + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.platform.target }} + args: --release --out dist --find-interpreter + sccache: 'true' + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: wheels-macos-${{ matrix.platform.target }} + path: dist + + sdist: + name: Make sdist + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Build sdist + uses: PyO3/maturin-action@v1 + with: + command: sdist + args: --out dist + - name: Upload sdist + uses: actions/upload-artifact@v4 + with: + name: wheels-sdist + path: dist + + release: + permissions: + id-token: write + name: Push to PyPI + runs-on: ubuntu-latest + # if: startsWith(github.ref, 'refs/tags/') + needs: [linux, macos, sdist] + steps: + - uses: actions/download-artifact@v4 + - run: | + mkdir dist + mv wheels-*/* dist/ + - run: ls dist/ + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 From c930d301356ba9817f4065fb17c733a1f6ce2818 Mon Sep 17 00:00:00 2001 From: Matthew Scroggs Date: Tue, 17 Sep 2024 17:28:48 +0100 Subject: [PATCH 2/7] don't run on this branch --- .github/workflows/release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dc97a6b3..8393cd53 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,7 +5,6 @@ name: 📦 on: push: tags: ['*'] - branches: ['mscroggs/pip'] pull_request: workflow_dispatch: From b2bf2656d1ebd2147cea17fc26b2ef5dea138588 Mon Sep 17 00:00:00 2001 From: Matthew Scroggs Date: Tue, 17 Sep 2024 17:36:47 +0100 Subject: [PATCH 3/7] default features --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index ab225e2b..af064d45 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,7 @@ ndelement = "0.1.1" ndgrid = "0.1.1" rayon = "1.9" rlst = { version = "0.2.0", default-features = false } -green-kernels = "0.2.0" +green-kernels = { version = "0.2.0", default-features = false } [dev-dependencies] approx = "0.5" From 4e56bf0107f05dd5c1a8a4b0f66ea62f2940b57d Mon Sep 17 00:00:00 2001 From: Matthew Scroggs Date: Tue, 17 Sep 2024 17:41:20 +0100 Subject: [PATCH 4/7] install sleef? --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8393cd53..894990ed 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,10 +32,10 @@ jobs: components: rustfmt - name: Install OpenBLAS, LAPACK, OpenSSL (yum) - run: yum -y install openblas-devel lapack-devel openssl-devel + run: yum -y install openblas-devel lapack-devel openssl-devel sleef-devel if: matrix.platform.package-manager == 'yum' - name: Install OpenBLAS, LAPACK, OpenSSL (apt) - run: apt-get -y install libopenblas-dev liblapack-dev + run: apt-get -y install libopenblas-dev liblapack-dev libsleef-dev if: matrix.platform.package-manager == 'apt' - uses: actions/checkout@v4 From f06dec1d09cbfdbad6b10449e20757345d1de002 Mon Sep 17 00:00:00 2001 From: Matthew Scroggs Date: Tue, 17 Sep 2024 17:41:47 +0100 Subject: [PATCH 5/7] tidy version numbers --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index af064d45..3dd29b7e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,8 +27,8 @@ lazy_static = "1.4" ndelement = "0.1.1" ndgrid = "0.1.1" rayon = "1.9" -rlst = { version = "0.2.0", default-features = false } -green-kernels = { version = "0.2.0", default-features = false } +rlst = "0.2.0" +green-kernels = "0.2.0" [dev-dependencies] approx = "0.5" From 7b2b3c72e4037743a81590dc76fcb8832795579c Mon Sep 17 00:00:00 2001 From: Matthew Scroggs Date: Tue, 17 Sep 2024 17:45:57 +0100 Subject: [PATCH 6/7] no devel --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 894990ed..e82ad1a8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,7 +32,7 @@ jobs: components: rustfmt - name: Install OpenBLAS, LAPACK, OpenSSL (yum) - run: yum -y install openblas-devel lapack-devel openssl-devel sleef-devel + run: yum -y install openblas-devel lapack-devel openssl-devel sleef if: matrix.platform.package-manager == 'yum' - name: Install OpenBLAS, LAPACK, OpenSSL (apt) run: apt-get -y install libopenblas-dev liblapack-dev libsleef-dev From 3a11c5fc723734825f1d5234e2b8f8c0ee40d3ef Mon Sep 17 00:00:00 2001 From: Matthew Scroggs Date: Wed, 25 Sep 2024 10:23:12 +0100 Subject: [PATCH 7/7] use maturin release --- .github/workflows/release.yml | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e82ad1a8..df5bc321 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -43,7 +43,7 @@ jobs: # TODO: swap to `pip install maturin>=1.7.2` once there's a new release - name: Install maturin, CFFI run: | - ${{ matrix.platform.python }} -m pip install git+https://github.com/PyO3/maturin.git + ${{ matrix.platform.python }} -m pip install maturin>=1.7.2 ${{ matrix.platform.python }} -m pip install cffi - name: Build wheel diff --git a/pyproject.toml b/pyproject.toml index 1498aeeb..b432e70c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,7 +19,7 @@ classifiers = [ "Programming Language :: Python :: Implementation :: CPython", ] dependencies = [ - "maturin>=1.7", + "maturin>=1.7.2", "numpy", "cffi", 'patchelf; platform_system == "Linux"',