From ed7c707e6fb6f0eb13fc849414f8b2f0688f0782 Mon Sep 17 00:00:00 2001 From: Kyle Leaders Date: Mon, 3 Apr 2023 15:54:35 -0700 Subject: [PATCH] Add maturin build workflow (#24) * Add maturin build workflow * Fixing sdist, maturin versions * Only build on `v*` tags. * Removing trigger for pull_request and workflow --- .github/workflows/maturin-build.yml | 115 ++++++++++++++++++++++++++++ pyproject.toml | 4 +- 2 files changed, 117 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/maturin-build.yml diff --git a/.github/workflows/maturin-build.yml b/.github/workflows/maturin-build.yml new file mode 100644 index 0000000..5bef1b8 --- /dev/null +++ b/.github/workflows/maturin-build.yml @@ -0,0 +1,115 @@ +# This file is autogenerated by maturin v0.14.16 +# To update, run +# +# maturin generate-ci github +# +on: + push: + branches: + - main + tags: + - 'v*' + +permissions: + contents: read + +jobs: + linux: + runs-on: ubuntu-latest + strategy: + matrix: + target: [x86_64, x86, aarch64, armv7, s390x, ppc64le] + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.target }} + args: --release --out dist --find-interpreter + sccache: 'true' + manylinux: auto + - name: Upload wheels + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist + + windows: + runs-on: windows-latest + strategy: + matrix: + target: [x64] + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + architecture: ${{ matrix.target }} + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.target }} + args: --release --out dist --find-interpreter + sccache: 'true' + - name: Upload wheels + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist + + macos: + runs-on: macos-latest + strategy: + matrix: + target: [x86_64, aarch64] + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.target }} + args: --release --out dist --find-interpreter + sccache: 'true' + - name: Upload wheels + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist + + sdist: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Build sdist + uses: PyO3/maturin-action@v1 + with: + command: sdist + args: --out target/wheels + - name: Upload sdist + uses: actions/upload-artifact@v3 + with: + name: wheels + path: target/wheels/*.tar.gz + + release: + name: Release + runs-on: ubuntu-latest + if: "startsWith(github.ref, 'refs/tags/')" + needs: [linux, windows, macos, sdist] + steps: + - uses: actions/download-artifact@v3 + with: + name: wheels + - name: Publish to PyPI + uses: PyO3/maturin-action@v1 + env: + MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} + with: + command: upload + args: --skip-existing * diff --git a/pyproject.toml b/pyproject.toml index d2660ea..d75a90d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] build-backend = "maturin" -requires = ["maturin<=0.13,<0.14"] +requires = ["maturin>=0.14,<0.15"] [project] name = "rust_matchspec" @@ -10,4 +10,4 @@ requires-python = ">=3.7" [tool.maturin] features = ["python"] -python-source = "python" \ No newline at end of file +python-source = "python"