-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add github action for publishing python packages to PyPI (#1592)
- Loading branch information
Showing
12 changed files
with
220 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,189 @@ | ||
name: Release Python | ||
|
||
on: | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
inputs: | ||
release_tag: | ||
description: "The release tag to target" | ||
# Create the sdist and build the wheels, but do not publish to PyPI, only to TestPyPI. | ||
dry_run: | ||
description: Dry run | ||
type: boolean | ||
default: false | ||
|
||
permissions: | ||
contents: read | ||
|
||
env: | ||
DRY_RUN: ${{ github.event.inputs.dry_run || 'false' }} | ||
|
||
jobs: | ||
linux: | ||
runs-on: ${{ matrix.platform.runner }} | ||
strategy: | ||
matrix: | ||
platform: | ||
- runner: ubuntu-22.04 | ||
target: x86_64 | ||
- runner: ubuntu-22.04 | ||
target: aarch64 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event_name == 'release' && '' || github.event.inputs.release_tag }} | ||
- 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 --manifest-path py-nickel/Cargo.toml | ||
sccache: 'true' | ||
manylinux: auto | ||
- name: Upload wheels | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: wheels-linux-${{ matrix.platform.target }} | ||
path: dist/* | ||
|
||
musllinux: | ||
runs-on: ${{ matrix.platform.runner }} | ||
strategy: | ||
matrix: | ||
platform: | ||
- runner: ubuntu-22.04 | ||
target: x86_64 | ||
- runner: ubuntu-22.04 | ||
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 --manifest-path py-nickel/Cargo.toml | ||
sccache: 'true' | ||
manylinux: musllinux_1_2 | ||
- name: Upload wheels | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: wheels-musllinux-${{ matrix.platform.target }} | ||
path: dist/* | ||
|
||
windows: | ||
runs-on: ${{ matrix.platform.runner }} | ||
strategy: | ||
matrix: | ||
platform: | ||
- runner: windows-latest | ||
target: x64 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event_name == 'release' && '' || github.event.inputs.release_tag }} | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.x | ||
architecture: ${{ matrix.platform.target }} | ||
- name: Build wheels | ||
uses: PyO3/maturin-action@v1 | ||
with: | ||
target: ${{ matrix.platform.target }} | ||
args: --release --out dist --find-interpreter --manifest-path py-nickel/Cargo.toml | ||
sccache: 'true' | ||
- name: Upload wheels | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: wheels-windows-${{ matrix.platform.target }} | ||
path: dist/* | ||
|
||
macos: | ||
runs-on: ${{ matrix.platform.runner }} | ||
strategy: | ||
matrix: | ||
platform: | ||
- runner: macos-13 | ||
target: x86_64 | ||
- runner: macos-14 | ||
target: aarch64 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event_name == 'release' && '' || github.event.inputs.release_tag }} | ||
- 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 --manifest-path py-nickel/Cargo.toml | ||
sccache: 'true' | ||
- name: Upload wheels | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: wheels-macos-${{ matrix.platform.target }} | ||
path: dist/* | ||
|
||
sdist: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event_name == 'release' && '' || github.event.inputs.release_tag }} | ||
- name: Build sdist | ||
uses: PyO3/maturin-action@v1 | ||
with: | ||
command: sdist | ||
args: --out dist --manifest-path py-nickel/Cargo.toml | ||
- name: Upload sdist | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: wheels-sdist | ||
path: dist/* | ||
|
||
publish-to-pypi: | ||
name: Publish distribution to PyPI | ||
runs-on: ubuntu-latest | ||
if: env.DRY_RUN == 'false' | ||
needs: [linux, musllinux, windows, macos, sdist] | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/py-nickel | ||
permissions: | ||
# Use to sign the release artifacts | ||
id-token: write | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
path: dist/ | ||
merge-multiple: true | ||
- name: Publish distribution to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
|
||
publish-to-testpypi: | ||
name: Publish distribution to TestPyPI | ||
runs-on: ubuntu-latest | ||
needs: [linux, musllinux, windows, macos, sdist] | ||
environment: | ||
name: testpypi | ||
url: https://test.pypi.org/p/py-nickel | ||
permissions: | ||
# Use to sign the release artifacts | ||
id-token: write | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
path: dist/ | ||
merge-multiple: true | ||
- name: Publish distribution to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
repository-url: https://test.pypi.org/legacy/ | ||
skip-existing: true |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ members = [ | |
"lsp/lsp-harness", | ||
"utils", | ||
"wasm-repl", | ||
"pyckel", | ||
"py-nickel", | ||
] | ||
resolver = "2" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[build-system] | ||
requires = ["maturin>=1.5,<2.0"] | ||
build-backend = "maturin" | ||
|
||
[project] | ||
name = "py-nickel" | ||
requires-python = ">=3.11" | ||
classifiers = [ | ||
"Programming Language :: Rust", | ||
"Programming Language :: Python :: Implementation :: CPython", | ||
"Programming Language :: Python :: Implementation :: PyPy", | ||
] | ||
dynamic = ["version"] | ||
|
||
[tool.maturin] | ||
features = ["pyo3/extension-module"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters