Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create workflows for uploading package to PyPI index #4

Merged
merged 18 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 75 additions & 35 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
branches:
- master
pull_request:
# don't rebuild when only modifying other workflows
paths:
- '!.github/workflows/**'
- '.github/workflows/build.yml'

jobs:
build-wheels:
Expand All @@ -14,51 +18,87 @@ jobs:
matrix:
pyver: [cp39, cp310, cp311, cp312]
platform:
- arch: x86_64
os: ubuntu-20.04
- arch: arm64
os: macos-11
- arch: x86_64
os: macos-11
- arch: x86
os: windows-2019
- arch: AMD64
os: windows-2019
- arch: x86_64
os: ubuntu-20.04
- arch: arm64
os: macos-11
- arch: x86_64
os: macos-11
- arch: x86
os: windows-2019
- arch: AMD64
os: windows-2019

steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/checkout@v4
with:
submodules: recursive

- uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'

- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: ${{ matrix.pyver }}-*
CIBW_ARCHS: ${{ matrix.platform.arch }}
with:
package-dir: .
output-dir: dist
config-file: pyproject.toml
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: ${{ matrix.pyver }}-*
CIBW_ARCHS: ${{ matrix.platform.arch }}
with:
package-dir: .
output-dir: dist
config-file: pyproject.toml

- uses: actions/upload-artifact@v3
with:
path: ./dist/*.whl
- uses: actions/upload-artifact@v3
with:
path: ./dist/*.whl

build-sdist:
name: Build source distribution
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- uses: actions/setup-python@v4

- run: |
python -m pip install --upgrade pip
pip install build
python -m build --sdist

- uses: actions/upload-artifact@v3
with:
path: ./dist/*.tar.gz

check:
name: All wheels built successfully

if: always()

if: success() || failure()
needs:
- build-wheels
- build-wheels
runs-on: ubuntu-latest

runs-on: Ubuntu-latest
steps:
- uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}

publish:
name: Publish package distributions to PyPI
runs-on: ubuntu-latest
needs: [build-wheels, build-sdist]
permissions:
id-token: write
if: github.event_name == 'release' && github.event.action == 'published'

steps:
- uses: re-actors/alls-green@release/v1
- name: Download artifact
id: download-artifact
uses: actions/download-artifact@v3
with:
jobs: ${{ toJSON(needs) }}
name: artifact
path: dist

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
25 changes: 25 additions & 0 deletions .github/workflows/pypi.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Publish to TestPyPI

on: workflow_dispatch

jobs:
pypi-publish:
name: Upload release to PyPI
runs-on: ubuntu-latest
permissions:
id-token: write

steps:
- name: Download artifact
id: download-artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: build.yml
workflow_conclusion: success
path: dist
name: artifact

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
2 changes: 1 addition & 1 deletion .github/workflows/version.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Ensure version has been updated
name: Check version

on:
pull_request:
Expand Down
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
graft vibrio/vendor
global-exclude bin/**/* obj/**/* publish/*
prune vibrio/lib
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "vibrio"
version = "0.1.1"
version = "0.1.2"
readme = "README.md"
requires-python = ">=3.9"
license = { file = "LICENSE" }
Expand Down
Loading