-
Notifications
You must be signed in to change notification settings - Fork 83
108 lines (92 loc) · 3.4 KB
/
build-wheels.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# This is partially adopted from scipy.
# See: https://github.com/scipy/scipy/blob/main/.github/workflows/wheels.yml
# License: 3-clause BSD, https://github.com/scipy/scipy/blob/main/LICENSE.txt
name: Build wheels
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
tags:
- v*
pull_request:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build_wheels:
name: Build wheel for ${{ matrix.python }}-${{ matrix.buildplat[1] }} ${{ matrix.buildplat[2] }}
runs-on: ${{ matrix.buildplat[0] }}
strategy:
matrix:
buildplat:
- [ubuntu-latest, manylinux, x86_64]
- [macos-12, macosx, x86_64]
- [windows-2019, win, AMD64]
- [macos-14, macosx, arm64]
python: ["cp38", "cp39", "cp310", "cp311", "cp312"]
exclude:
- buildplat: [macos-14, macosx, arm64]
python: "cp38"
fail-fast: false
env:
IS_32_BIT: ${{ matrix.buildplat[2] == 'x86' }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Build wheels
uses: pypa/cibuildwheel@v2.16.5
env:
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}*
CIBW_ARCHS: ${{ matrix.buildplat[2] }}
CIBW_ENVIRONMENT_PASS_LINUX: RUNNER_OS
CIBW_TEST_REQUIRES: meson-python>=0.12.0 ninja
CIBW_BEFORE_ALL_MACOS: "brew install gfortran gnu-sed && brew unlink gfortran && brew link gfortran"
CIBW_TEST_COMMAND_MACOS: "cd {project}/examples; make clean_meson; make test_meson"
CIBW_TEST_COMMAND_LINUX: "cd {project}/examples; make clean_meson; make test_meson"
CIBW_TEST_COMMAND_WINDOWS: "python -m f90wrap --version"
- name: Setup tmate session
if: failure()
uses: mxschmitt/action-tmate@v3
timeout-minutes: 15
- uses: actions/upload-artifact@v4
with:
path: ./wheelhouse/*.whl
name: ${{ matrix.python }}-${{ matrix.buildplat[1] }}-${{ matrix.buildplat[2] }}
- name: Release wheels
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: wheelhouse/*.whl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check tag
id: check-tag
run: |
if [[ ${{ github.ref }} =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+ ]]; then
echo ::set-output name=match::true
fi
shell: bash
- name: Deploy wheels to PyPI
if: steps.check-tag.outputs.match == 'true'
run: |
pip install twine
twine upload wheelhouse/*.whl
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
shell: bash
- name: Deploy sdist to PyPI
if: ${{ steps.check-tag.outputs.match == 'true' && startsWith(matrix.buildplat[0], 'ubuntu') && matrix.python == 'cp311' }}
run: |
pip install build
python -m build
twine upload dist/f90wrap-*.tar.gz
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
shell: bash