Skip to content

Commit

Permalink
Add workflow based on cibuildwheels (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
awvwgk authored Jun 9, 2024
1 parent f2b5a7c commit 0d4aa99
Showing 1 changed file with 39 additions and 45 deletions.
84 changes: 39 additions & 45 deletions .github/workflows/wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: wheel

on:
push:
pull_request:
workflow_dispatch:
release:
types: [published]
Expand Down Expand Up @@ -39,7 +40,7 @@ jobs:
uses: mamba-org/setup-micromamba@v1
with:
environment-file: assets/ci/python-env.yaml
create-args: |
create-args: >-
meson-python
python-build
- name: Reorganize repository
Expand All @@ -58,65 +59,58 @@ jobs:
path: ./*.tar.gz
retention-days: 5

manylinux:
wheels:
needs:
- sdist
runs-on: ubuntu-latest
container: condaforge/linux-anvil-cos7-x86_64
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python: ['3.7', '3.8', '3.9', '3.10', '3.11']
os:
- ubuntu-latest
- windows-latest
- macos-12
python: ['38', '39', '310', '311']

defaults:
run:
shell: ${{ matrix.shell || 'bash -l {0}' }}
shell: bash -l {0}

steps:
- name: Create environment
run: >-
mamba create -n wheel
--yes
c-compiler
fortran-compiler
python=${{ matrix.python }}
auditwheel
git
python
pip
python-build
pkgconfig
patchelf
cffi
numpy
meson
unzip
wheel
- name: Download sdist
uses: actions/download-artifact@v4
with:
name: dftd3-python-sdist
- name: Build wheel
run: |
conda activate wheel
set -ex
tar xvf dftd3-*.tar.gz
python -m build dftd3-*/ --wheel
auditwheel show dftd3-*/dist/*.whl
auditwheel repair -w . dftd3-*/dist/*.whl --plat ${{ env.plat }}
env:
plat: manylinux${{ matrix.python == '3.6' && '2010' || '_2_12' }}_x86_64
- uses: actions/upload-artifact@v4
with:
name: dftd3-python-${{ matrix.python }}
path: ./*.whl
retention-days: 5
# Used to host cibuildwheel
- uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.18.1

- name: Download sdist
uses: actions/download-artifact@v4
with:
name: dftd3-python-sdist

- name: Build wheels
run: python -m cibuildwheel --output-dir . *.tar.gz
env:
CIBW_ARCHS: auto64
CIBW_BUILD: "*${{ matrix.python }}-*"
CIBW_BUILD_VERBOSITY: 1
CIBW_ARCHS_MACOS: x86_64
CIBW_ENVIRONMENT_MACOS: CC=gcc-11 CXX=g++-11 FC=gfortran-11 MACOSX_DEPLOYMENT_TARGET=12.0
CIBW_BEFORE_BUILD_WINDOWS: choco upgrade mingw && pip install delvewheel
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel show {wheel} && delvewheel repair -w {dest_dir} {wheel} --no-mangle-all"

- uses: actions/upload-artifact@v4
with:
name: dftd3-python-${{ matrix.os }}-${{ matrix.python }}
path: "*.whl"

release:
needs:
- source
- sdist
- manylinux
- wheels
runs-on: ubuntu-latest
steps:
- name: Download artifacts
Expand Down

0 comments on commit 0d4aa99

Please sign in to comment.