Skip to content

[BBPBGLIB-1125] GH forkflow for building a wheel #6

[BBPBGLIB-1125] GH forkflow for building a wheel

[BBPBGLIB-1125] GH forkflow for building a wheel #6

Workflow file for this run

name: Publish sdist and wheels for macos, and manylinux, publish to pypi if a release
on: [pull_request, push]
env:
apt_options: -o Acquire::Retries=3
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, macos-latest]
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.11'
- name: Cache HDF5 On Linux/macOS
if: runner.os == 'Linux' || runner.os == 'macOS'
uses: actions/cache@v3
id: cache-hdf5-posix
env:
cache-name: cache-hdf5-posix
with:
path: src-cache/
key: ${{ runner.os }}-build-${{ env.cache-name }}
- name: Build wheels on Linux
if: runner.os == 'Linux'
run: |
# note: config is stored in pyproject.toml now
pip wheel -w dist .
- name: Build wheels Mac OS
if: runner.os == 'macOS'
run: |
# x86_64 macOS allows for cross compilation; first we do arm64,
# only for the 11.0 target; and store in the cache the compiled code...
pip wheel -w dist .
# ...and now we do both targets for x86_64
unset MACOSX_DEPLOYMENT_TARGET
pip wheel -w dist .
- name: Store wheel as artifact
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/*.whl
build_sdist:
name: Build sdist
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install packages
run: |
sudo apt-get ${{env.apt_options}} update -y
sudo apt-get ${{env.apt_options}} install -y libhdf5-dev
pip install neuron
pip install libsonata
- name: Build a source tarball, check it installs
run:
./ci/python_build_sdist.sh
- name: Store sdist as artifact
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/*.tar.gz
# upload_artifacts:
# name: Upload wheels to PyPI
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
#
# runs-on: ubuntu-latest
# needs: [build_wheels, build_sdist]
#
# steps:
# - name: Download artifacts produced during the build_wheels and build_sdist jobs
# uses: actions/download-artifact@v3
# with:
# name: dist
# path: dist/
#
# - name: Display structure of downloaded files
# run: ls -R
# working-directory: dist
#
# - name: Publish package to PyPI
# uses: pypa/gh-action-pypi-publish@master
# with:
# user: __token__
# password: ${{ secrets.PYPI_PASSWORD }}
# packages_dir: dist/