diff --git a/.github/workflows/wheel.yml b/.github/workflows/wheel.yml index b190a058..94acab5a 100644 --- a/.github/workflows/wheel.yml +++ b/.github/workflows/wheel.yml @@ -2,6 +2,7 @@ name: wheel on: push: + pull_request: workflow_dispatch: release: types: [published] @@ -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 @@ -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