gwastro/sbank

View on GitHub
.github/workflows/distribution.yml

Summary

Maintainability
Test Coverage
name: Build Wheels

on: [push, pull_request]

jobs:
  build_wheels:
    name: Build wheels on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        # Needs some work to make wheels also on macos
        os: [ubuntu-20.04]

    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - uses: actions/setup-python@v2
      - name: Install cibuildwheel
        run: python -m pip install cibuildwheel==2.17.0

      - name: Build wheels
        run: python -m cibuildwheel --output-dir wheelhouse
        env:
          # This BEFORE_BUILD is a horrible hack. I need to be able to link
          # against the lal library. However, the lal library installed through
          # pip is hard to link against. This symlinks it into /usr/lib so
          # that it can be found.
          CIBW_BEFORE_BUILD: bash tools/cibuildwheel_prep.sh
          CIBW_BUILD: cp36-manylinux* cp37-manylinux* cp38-manylinux* cp39-manylinux* cp310-manylinux* cp311-manylinux* cp312-manylinux*
          CIBW_ARCHS: auto64
          CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
          CIBW_MANYLINUX_PYPY_X86_64_IMAGE: manylinux_2_28
      - uses: actions/upload-artifact@v2
        with:
          path: ./wheelhouse/*.whl
  deploy_pypi:
    name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
    runs-on: ubuntu-20.04
    needs: build_wheels
    steps:
    - uses: actions/checkout@v2
      with:
        fetch-depth: 0
    - name: Set up Python 3.8
      uses: actions/setup-python@v2
      with:
        python-version: 3.8
    - uses: actions/download-artifact@v2
      with:
        path: ./
    - name: build pycbc for pypi
      run: |
        pip install -r requirements.txt
        python setup.py sdist
        mv artifact/* dist/
    - name: Publish distribution 📦 to Test PyPI
      if: github.event_name == 'push' && github.ref == 'refs/heads/master'
      uses: pypa/gh-action-pypi-publish@master
      with:
        password: ${{ secrets.test_pypi_password }}
        repository_url: https://test.pypi.org/legacy/
        skip_existing: true
    - name: Publish distribution 📦 to PyPI
      if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
      uses: pypa/gh-action-pypi-publish@master
      with:
        password: ${{ secrets.pypi_password }}