diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml new file mode 100644 index 0000000..ea04f5c --- /dev/null +++ b/.github/workflows/pypi.yml @@ -0,0 +1,70 @@ +# Copied from: https://github.com/joerick/cibuildwheel/blob/master/examples/github-deploy.yml +name: Build and upload to PyPI +on: + push: + branches: + - master + release: + types: + - published + workflow_dispatch: + inputs: + upload: + description: 'Upload to PyPi' + required: false + default: 'false' + +jobs: + build_wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [macos-10.15, ubuntu-20.04] + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + name: Install Python + with: + python-version: '3.8' + - name: Build wheels + uses: joerick/cibuildwheel@v1.10.0 + env: + CIBW_BEFORE_ALL_LINUX: "apt-get update && apt-get install -y gcc gfortran" + CIBW_BEFORE_ALL_MACOS: "brew unlink gcc && brew link gcc" # gfortran and libs don't seem to be linked by default for some reason + # Use debian builders + CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_24 + # Skip extra linux cpu archs and pypy + CIBW_SKIP: "*_aarch64 *_i686 *_ppc64le *_s390x pp*" + - uses: actions/upload-artifact@v2 + with: + path: ./wheelhouse/*.whl + build_sdist: + name: Build source distribution + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + name: Install Python + with: + python-version: '3.8' + - name: Build sdist + run: pip install build && python -m build --sdist + - uses: actions/upload-artifact@v2 + with: + path: dist/*.tar.gz + upload_pypi: + needs: [build_wheels, build_sdist] + runs-on: ubuntu-latest + if: (github.event_name == 'release' && github.event.action == 'published') || (github.event_name == 'workflow_dispatch' && github.event.inputs.upload == 'true') + steps: + - uses: actions/download-artifact@v2 + with: + name: artifact + path: dist + - uses: pypa/gh-action-pypi-publish@master + with: + user: ${{ secrets.PYPI_API_USER }} + password: ${{ secrets.PYPI_API_PASSWORD }} + repository_url: ${{ secrets.PYPI_API_URL }} diff --git a/setup.py b/setup.py index 347bbca..3ef2c40 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,7 @@ def get_lib_dir(dylib): import subprocess from os.path import realpath, dirname - p = subprocess.Popen("gfortran -print-file-name={}".format(dylib), + p = subprocess.Popen("gfortran-10 -print-file-name={}".format(dylib), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) retcode = p.wait() @@ -45,7 +45,7 @@ def get_lib_dir(dylib): if sys.platform == 'darwin': - GFORTRAN_LIB = get_lib_dir('libgfortran.3.dylib') + GFORTRAN_LIB = get_lib_dir('libgfortran.5.dylib') QUADMATH_LIB = get_lib_dir('libquadmath.0.dylib') ARGS = ["-Wl,-rpath,{}:{}".format(GFORTRAN_LIB, QUADMATH_LIB)] f_compile_args += ARGS