Skip to content

Commit

Permalink
Add workflow based on cibuildwheels
Browse files Browse the repository at this point in the history
  • Loading branch information
awvwgk committed Jun 9, 2024
1 parent f2b5a7c commit baff196
Showing 1 changed file with 33 additions and 45 deletions.
78 changes: 33 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,52 @@ 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-13, macos-14]
python: ['37', '38', '39', '310', '311', '312']

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

- 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 wheelhouse *.tar.gz
env:
CIBW_BUILD_VERBOSITY: 1
# CIBW_ARCHS_MACOS: x86_64
CIBW_ENVIRONMENT_MACOS: CC=gcc-11 CXX=g++-11 FC=gfortran-11
CIBW_BEFORE_BUILD_WINDOWS: choco upgrade mingw
CIBW_ARCHS: auto64
CIBW_BUILD: *{{ matrix.python }}*

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

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

0 comments on commit baff196

Please sign in to comment.