Skip to content

Use verbose to publish to testpypi #146

Use verbose to publish to testpypi

Use verbose to publish to testpypi #146

Workflow file for this run

# Copyright (c) Meta Platforms, Inc. and affiliates.
name: Build and Test
on:
push:
branches:
- main
tags:
- 'v*'
# This build configuration uses a matrix to build and test multiple Python versions.
# Each version is actioned across on multiple operating systems (Ubuntu, Windows, macOS).
# For standard Python builds, we use pre-built binary releases for efficiency.
# However, since nogil-enabled Python binaries are not readily available,
# we build Python from source with nogil (free threaded) builds.
# This approach allows us to test our extension with different Python configurations.
# Our goals are to ensure compatibility and reliability across various environments,
# and to create platform-specific wheels for distribution on PyPi.
jobs:
cibuildwheel:
strategy:
fail-fast: false
matrix:
include:
- wheel: "linux-3.12"
os: ubuntu-latest
CIBW_BUILD: "cp312-*"
- wheel: "linux-3.13"
os: ubuntu-latest
CIBW_BUILD: "cp313-*"
- wheel: "linux-3.13t"
os: ubuntu-latest
CIBW_BUILD: "cp313t-*"
CIBW_ENABLE: "cpython-freethreading"
- wheel: "windows-3.13"
os: windows-latest
CIBW_BUILD: "cp313-win_amd64"
- wheel: "windows-3.13t"
os: windows-latest
CIBW_BUILD: "cp313t-win_amd64"
CIBW_ENABLE: "cpython-freethreading"
- wheel: "macos-3.13"
os: macos-latest
CIBW_BUILD: "cp313-*"
- wheel: "macos-3.13t"
os: macos-latest
CIBW_BUILD: "cp313t-*"
CIBW_ENABLE: "cpython-freethreading"
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.22.0
- name: Build Python wheels
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BUILD: ${{ matrix.CIBW_BUILD }}
CIBW_ENABLE: ${{ matrix.CIBW_ENABLE }}
CIBW_TEST_COMMAND: python -m ft_utils.tests.test_run_all
- name: Upload Python wheels
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.wheel }}.zip
path: wheelhouse/*.whl
deadsnakes:
strategy:
fail-fast: false
matrix:
include:
- wheel: "linux-3.14"
python-version: "3.14-dev"
nogil: false
- wheel: "linux-3.14t"
python-version: "3.14-dev"
nogil: true
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: deadsnakes/[email protected]
with:
python-version: ${{ matrix.python-version }}
nogil: ${{ matrix.nogil }}
- name: Install build dependencies
run: python -m pip install --upgrade setuptools wheel auditwheel
- name: Build Python wheels
run: python setup.py bdist_wheel
- name: Repair Python wheels
run: auditwheel repair build/dist/*.whl
- name: Install wheels
run: python -m pip install build/dist/*.whl
- name: Test Python wheels
run: |
mkdir test_dir
cd test_dir
python -V
python -m ft_utils.tests.test_run_all
- name: Upload Python wheels
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.wheel }}.zip
path: build/dist/*.whl
publish-to-testpypi:
runs-on: ubuntu-latest
needs:
- cibuildwheel
- deadsnakes
environment:
name: testpypi
url: https://test.pypi.org/p/ft_utils
permissions:
id-token: write
steps:
- name: Download Python wheels
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: List Python wheels
run: ls -lR dist
- name: Publish Python wheels
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
verbose: true
publish-to-pypi:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs:
- cibuildwheel
- deadsnakes
environment:
name: pypi
url: https://pypi.org/p/ft_utils
permissions:
id-token: write
steps:
- name: Download Python wheels
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: List Python wheels
run: ls -lR dist
- name: Publish Python wheels
uses: pypa/gh-action-pypi-publish@release/v1
github-release:
runs-on: ubuntu-latest
needs:
- publish-to-pypi
permissions:
contents: write
id-token: write
steps:
- name: Download Python wheels
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Sign Python wheels
uses: sigstore/[email protected]
with:
inputs: ./dist/*.whl
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
"$GITHUB_REF_NAME"
--repo "$GITHUB_REPOSITORY"
--notes ""
- name: Upload artifacts
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release upload
"$GITHUB_REF_NAME" dist/**
--repo "$GITHUB_REPOSITORY"