Publish to TestPyPI and PyPI #15
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
name: Publish to TestPyPI and PyPI | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
pypi_repo: | ||
description: "Repo to upload to (TestPyPI or PyPI)" | ||
default: "testpypi" | ||
required: true | ||
jobs: | ||
build_wheels_linux: | ||
Check failure on line 11 in .github/workflows/publish.yml
|
||
name: Build wheels for ubuntu-latest/${{ matrix.arch }}/${{ matrix.python_tag }} | ||
needs: [build_sdist] | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
arch: [x86_64] | ||
python_tag: ["cp38-*", "cp39-*", "cp310-*", "cp311-*", "cp312-*"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
# - uses: actions/download-artifact@v4 | ||
# with: | ||
# name: artifact-sdist | ||
# path: dist | ||
# - name: Copy wheel | ||
# run: cp dist/editdistpy-*.tar.gz editdistpy.tar.gz | ||
- name: Build wheel | ||
uses: pypa/[email protected] | ||
env: | ||
CIBW_ARCHS_LINUX: ${{ matrix.arch }} | ||
CIBW_BUILD: ${{ matrix.python_tag }} | ||
CIBW_BUILD_VERBOSITY: 3 | ||
CIBW_BEFORE_TEST: pip install symspellpy --no-deps | ||
CIBW_TEST_REQUIRES: pytest numpy | ||
CIBW_TEST_COMMAND: python -m pytest --traceconfig -sv {project}/tests | ||
with: | ||
output-dir: wheelhouse | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: artifact-${{ github.job }}-${{ strategy.job-index }} | ||
path: ./wheelhouse/*.whl | ||
build_wheels_macos: | ||
name: Build wheels for macos-latest/${{ matrix.arch }}/${{ matrix.python_tag }} | ||
needs: [build_sdist] | ||
runs-on: macos-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
arch: [x86_64, arm64] | ||
python_tag: ["cp38-*", "cp39-*", "cp310-*", "cp311-*", "cp312-*"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
# - uses: actions/download-artifact@v4 | ||
# with: | ||
# name: artifact-sdist | ||
# path: dist | ||
# - name: Copy wheel | ||
# run: cp dist/editdistpy-*.tar.gz editdistpy.tar.gz | ||
- name: Build wheel | ||
uses: pypa/[email protected] | ||
env: | ||
CIBW_ARCHS_MACOS: ${{ matrix.arch }} | ||
CIBW_BUILD: ${{ matrix.python_tag }} | ||
CIBW_BUILD_VERBOSITY: 3 | ||
CIBW_BEFORE_TEST: pip install symspellpy --no-deps | ||
CIBW_TEST_REQUIRES: pytest numpy | ||
CIBW_TEST_COMMAND: python -m pytest --traceconfig -sv {project}/tests | ||
with: | ||
output-dir: wheelhouse | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: artifact-${{ github.job }}-${{ strategy.job-index }} | ||
path: ./wheelhouse/*.whl | ||
build_wheels_windows: | ||
name: Build wheels for windows-latest/${{ matrix.arch }}/${{ matrix.python_tag }} | ||
needs: [build_sdist] | ||
runs-on: windows-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
arch: [AMD64] | ||
python_tag: ["cp38-*", "cp39-*", "cp310-*", "cp311-*", "cp312-*"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
# - uses: actions/download-artifact@v4 | ||
# with: | ||
# name: artifact-sdist | ||
# path: dist | ||
# - name: Copy wheel | ||
# run: cp dist/editdistpy-*.tar.gz editdistpy.tar.gz | ||
- name: Build wheel | ||
uses: pypa/[email protected] | ||
env: | ||
CIBW_ARCHS_WINDOWS: ${{ matrix.arch }} | ||
CIBW_BUILD: ${{ matrix.python_tag }} | ||
CIBW_BUILD_VERBOSITY: 3 | ||
CIBW_BEFORE_TEST: pip install symspellpy --no-deps | ||
CIBW_TEST_REQUIRES: pytest numpy | ||
CIBW_TEST_COMMAND: python -m pytest --traceconfig -sv {project}/tests | ||
with: | ||
output-dir: wheelhouse | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: artifact-${{ github.job }}-${{ strategy.job-index }} | ||
path: ./wheelhouse/*.whl | ||
publish: | ||
name: Publish to TestPyPI and PyPI | ||
runs-on: ubuntu-latest | ||
needs: [build_wheels] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.12" | ||
- name: Build | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install build | ||
python -m build --sdist | ||
- name: Download wheels | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: wheels | ||
path: dist | ||
- name: Show files to upload | ||
shell: bash | ||
run: ls -la dist | ||
- name: Publish package to TestPyPI | ||
uses: pypa/[email protected] | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.TEST_PYPI_TOKEN }} | ||
repository_url: https://test.pypi.org/legacy/ | ||
if: ${{ github.event.inputs.pypi_repo == 'testpypi' }} | ||
- name: Publish package to PyPI | ||
uses: pypa/[email protected] | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_TOKEN }} | ||
if: ${{ github.event.inputs.pypi_repo == 'pypi' }} |