Skip to content

[pre-commit.ci] pre-commit autoupdate #3094

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #3094

name: Publish Python distributions to PyPI and TestPyPI
on:
release:
types: [published]
pull_request:
branch: main
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build_wheels:
name: Build wheel for ${{ matrix.python }}-${{ matrix.buildplat[1] }} ${{ matrix.buildplat[2] }}
runs-on: ${{ matrix.buildplat[0] }}
strategy:
fail-fast: false
matrix:
buildplat:
- [ubuntu-20.04, manylinux, x86_64]
- [macos-12, macosx, x86_64]
- [macos-12, macosx, arm64]
- [windows-2019, win, AMD64]
python: ["cp39", "cp310", "cp311", "cp312"]
steps:
- uses: actions/checkout@main
with:
fetch-depth: 0
- name: Build wheels
uses: pypa/cibuildwheel@v2.16.2
env:
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}*
CIBW_ARCHS: ${{ matrix.buildplat[2] }}
CIBW_TEST_REQUIRES: packaging pytest pytest-cov pytest-cases
CIBW_TEST_COMMAND: "python -m pytest --pyargs pyuvdata"
CIBW_TEST_SKIP: "*-macosx_arm64"
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.python }}-${{ startsWith(matrix.buildplat[1], 'macosx') && 'macosx' || matrix.buildplat[1] }}
path: ./wheelhouse/*.whl
make_sdist:
name: Make SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
with:
fetch-depth: 0
- name: Build SDist
run: pipx run build --sdist
- uses: actions/upload-artifact@v3
with:
name: sdist
path: dist/*.tar.gz
upload_all:
needs: [build_wheels, make_sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
path: dist
- name: Move folders around
working-directory: dist
run: |
for dir in `ls .`; do
cd $dir
mv * ..
cd ..
rmdir $dir
done
- name: Upload to test PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@v1.5.0
with:
password: ${{ secrets.test_pypi_password }}
repository_url: https://test.pypi.org/legacy/
- name: Upload to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@v1.5.0
with:
password: ${{ secrets.pypi_password }}