From f2868fa76ee2c0993cf669c1b8d1f3142a31ebbc Mon Sep 17 00:00:00 2001 From: Ed Page Date: Tue, 7 Mar 2023 02:01:04 -0600 Subject: [PATCH] feat(ci): Experiment with publishing to PyPI This is part of #649 --- .github/workflows/maturin.yml | 106 ++++++++++++++++++++++++++++++++++ Cargo.toml | 3 + pyproject.toml | 18 ++++++ 3 files changed, 127 insertions(+) create mode 100644 .github/workflows/maturin.yml create mode 100644 pyproject.toml diff --git a/.github/workflows/maturin.yml b/.github/workflows/maturin.yml new file mode 100644 index 0000000..b881cae --- /dev/null +++ b/.github/workflows/maturin.yml @@ -0,0 +1,106 @@ +# This file is autogenerated by maturin v0.14.15 +# To update, run +# +# maturin generate-ci github +# +on: + push: + branches: + - master + tags: + - "v*.*.*" + - "!varcon*" + +permissions: + contents: read + +jobs: + linux: + runs-on: ubuntu-latest + strategy: + matrix: + target: [x86_64, x86, aarch64, armv7, s390x, ppc64le] + steps: + - uses: actions/checkout@v3 + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.target }} + args: --release --out dist + 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, x86] + steps: + - uses: actions/checkout@v3 + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.target }} + args: --release --out dist + 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 + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.target }} + args: --release --out dist + 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 dist + - name: Upload sdist + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist + + 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/Cargo.toml b/Cargo.toml index 6bb362d..2d6b65f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,6 +32,9 @@ edition.workspace = true rust-version.workspace = true include.workspace = true +[package.metadata.maturin] +name = "typos" + [package.metadata.docs.rs] no-default-features = true diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..7b7fb87 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,18 @@ +[build-system] +requires = ["maturin>=0.14,<0.15"] +build-backend = "maturin" + +[project] +name = "typos" +requires-python = ">=3.7" +classifiers = [ + "Intended Audience :: Developers", + "Topic :: Software Development", + "Programming Language :: Rust", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", +] + + +[tool.maturin] +bindings = "bin"