Skip to content

Merge pull request #21 from henrysky/dependabot/github_actions/pypa/c… #185

Merge pull request #21 from henrysky/dependabot/github_actions/pypa/c…

Merge pull request #21 from henrysky/dependabot/github_actions/pypa/c… #185

Workflow file for this run

# Deploy wheels and sdist to PyPI (upon release creation)
name: Wheels and deployments
on:
push:
branches:
- master
release:
types: [created]
jobs:
build_wheels:
name: Build wheel for ${{ matrix.python }}-${{ matrix.buildplat[1] }}-${{ matrix.buildplat[2] }}
runs-on: ${{ matrix.buildplat[0] }}
strategy:
# Ensure that a wheel builder finishes even if another fails
fail-fast: false
matrix:
buildplat:
- [ubuntu-latest, manylinux, x86_64]
- [macos-latest, macosx, x86_64]
- [macos-latest, macosx, arm64]
- [windows-latest, win, amd64]
python: ["cp310", "cp311", "cp312", "cp313"]
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
channels: conda-forge
auto-update-conda: true
- name: Install dependencies
shell: bash -l {0}
run: |
conda install --yes --file requirements.txt
python -m pip install -r requirements-dev.txt
- name: Set environment variables on Mac OS
if: matrix.buildplat[1] == 'macos'
shell: bash -l {0}
run: |
echo "CPPFLAGS=-I$CONDA_PREFIX/include" >> $GITHUB_ENV
echo "LDFLAGS=-L$CONDA_PREFIX/lib" >> $GITHUB_ENV
echo "REPAIR_LIBRARY_PATH=$CONDA_PREFIX/lib" >> $GITHUB_ENV
echo "$CONDA_PREFIX/bin" >> $GITHUB_PATH
- name: Set environment variables on Windows
if: matrix.buildplat[1] == 'win'
shell: bash -l {0}
run: |
echo "INCLUDE=$CONDA_PREFIX\\Library\\include" >> $GITHUB_ENV
echo "LIB=$CONDA_PREFIX\\Library\\lib" >> $GITHUB_ENV
echo "LIBPATH=$CONDA_PREFIX\\Library\\lib" >> $GITHUB_ENV
echo "$CONDA_PREFIX\\Library\\bin" >> $GITHUB_PATH
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}_${{ matrix.buildplat[2] }}
CIBW_ARCHS_MACOS: ${{ matrix.buildplat[2] }}
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.python }}-${{ matrix.buildplat[1] }}_${{ matrix.buildplat[2] }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build source directory for release
if: github.event_name == 'release' && github.event.action == 'created'
runs-on: ubuntu-latest
steps:
# check-out this repository
- uses: actions/checkout@v4
# Setup python
- uses: conda-incubator/setup-miniconda@v3
with:
channels: conda-forge
auto-update-conda: true
python-version: ${{ matrix.python }}
- name: Install dependencies
shell: bash -l {0}
run: |
conda install -y numpy astropy h5py pandas tqdm wheel pytest pytest-order galpy
python -m pip install gaiadr3-zeropoint build mwdust
- name: Build sdist
shell: bash -l {0}
run: |
python -m build --sdist
- uses: actions/upload-artifact@v4
with:
name: sdist
path: ./dist/*.tar.gz
# Deploy wheels and sdist to PyPI (upon release creation)
deploy_pypi:
name: Deploy to PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'created'
steps:
- uses: actions/checkout@v4
- run: |
mkdir tmp_wheelhouse
mkdir wheelhouse
- uses: actions/download-artifact@v4
with:
path: tmp_wheelhouse/
- run: find tmp_wheelhouse/ -mindepth 2 -type f -exec mv -i '{}' wheelhouse/ ';'
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: wheelhouse/