Skip to content

Commit

Permalink
Build wheels for Python package (#549)
Browse files Browse the repository at this point in the history
Co-authored-by: Jakub Panek <me@panekj.dev>
  • Loading branch information
redeboer and panekj authored Aug 21, 2024
1 parent d1d5a0b commit 2b00363
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 6 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/releases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -436,3 +436,79 @@ jobs:
working-directory: editors/vscode
env:
OPEN_VSX_TOKEN: ${{ secrets.OPEN_VSX_TOKEN }}

pypi_build_taplo_cli:
name: Build python wheels
needs: ["wait_for_ci"]
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu, windows, macos]
arch: [x86, x64, aarch64]
exclude:
- os: windows
arch: aarch64
- os: ubuntu
arch: aarch64
- os: macos
arch: x86
steps:
- uses: actions/checkout@v4
- name: Build sdist
if: matrix.os == 'ubuntu' && matrix.arch == 'x64'
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.arch }}
args: --release --out dist
sccache: "true"
manylinux: auto
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}-${{ matrix.arch }}
path: dist

pypi_test_taplo_cli:
name: Test python wheels
needs: ["pypi_build_taplo_cli"]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- windows-latest
- ubuntu-latest
- macos-latest
steps:
- uses: actions/download-artifact@v4
with:
pattern: wheels-*
path: wheels
merge-multiple: true
- uses: actions/setup-python@v5
with:
python-version: "3"
- run: pip install taplo --no-index --find-links wheels/
- run: taplo help

pypi_publish_taplo_cli:
name: PyPI publish taplo
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/release-taplo-cli-0')
needs: ["pypi_test_taplo_cli"]
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: wheels-*
path: dist
merge-multiple: true
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@ target
.vscode/settings.json
.cargo/config.toml
yarn-error.log

# Python
__pycache__/
*venv/
dist/
wheels/
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions crates/taplo-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ license = { workspace = true }
repository = { workspace = true }

[features]
default = ["rustls-tls", "lsp", "toml-test"]
lsp = ["taplo-lsp", "async-ctrlc"]
default = ["lsp", "rustls-tls", "toml-test"]
lsp = ["async-ctrlc", "taplo-lsp"]
native-tls = ["taplo-common/native-tls", "taplo-lsp?/native-tls"]
rustls-tls = ["taplo-common/rustls-tls", "taplo-lsp?/rustls-tls"]
toml-test = []
Expand Down
29 changes: 29 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[build-system]
requires = ["maturin>=1.4"]
build-backend = "maturin"

[project]
name = "taplo"
requires-python = ">=3.8"
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Programming Language :: Python",
"Programming Language :: Rust",
"Topic :: Software Development :: Quality Assurance",
]
dynamic = ["version"]

[tool.maturin]
bindings = "bin"
manifest-path = "crates/taplo-cli/Cargo.toml"

0 comments on commit 2b00363

Please sign in to comment.