Debian Codegraph @

.github/workflows/wheels.yaml

raw symbols SCIP
1 name: Build and publish wheels
2
3 on:
4 workflow_dispatch:
5 inputs:
6 upload:
7 description: 'Upload wheels and sdist to PyPI? (0: no, 1: yes)'
8 required: true
9 default: '0'
10
11 permissions:
12 contents: write
13 actions: read
14
15 jobs:
16 build_sdist:
17 name: Build SDist
18 runs-on: ubuntu-latest
19 steps:
20 - uses: actions/checkout@v4
21
22 - name: Build SDist
23 run: pipx run build --sdist
24
25 - name: Check metadata
26 run: pipx run twine check dist/*
27
28 - uses: actions/upload-artifact@v4
29 with:
30 name: sdist
31 path: dist/*.tar.gz
32
33 build_wheels:
34 name: Build ${{ matrix.arch }} wheels on ${{ matrix.os }}
35 runs-on: ${{ matrix.os }}
36 strategy:
37 fail-fast: false
38 matrix:
39 include:
40 - os: windows-latest
41 arch: auto64
42 msvc_arch: x64
43 - os: windows-11-arm
44 arch: ARM64
45 msvc_arch: ARM64
46 - os: ubuntu-22.04
47 arch: x86_64
48 - os: ubuntu-22.04-arm
49 arch: aarch64
50 - os: macos-13
51 arch: x86_64
52 macos_deployment_target: "13.0"
53 - os: macos-14
54 arch: arm64
55 macos_deployment_target: "14.0"
56 steps:
57 - uses: actions/checkout@v4
58
59 - uses: actions/setup-python@v5
60
61 - name: Activate MSVC
62 uses: ilammy/[email protected]
63 with:
64 arch: ${{ matrix.msvc_arch }}
65 if: ${{ matrix.msvc_arch }}
66
67 - name: Build wheels
68 uses: pypa/[email protected]
69 env:
70 CIBW_SKIP: ${{ runner.os == 'Windows' && runner.arch == 'ARM64' && '*pp3* *cp38* *cp39* *cp310*' || '*pp3* *cp38*' }}
71 CIBW_ARCHS: ${{ matrix.arch }}
72 CIBW_ENVIRONMENT_MACOS:
73 MACOSX_DEPLOYMENT_TARGET=${{ matrix.macos_deployment_target }}
74 CIBW_TEST_REQUIRES: numpy
75 CIBW_TEST_COMMAND: |
76 python -c "import skfmm, sys; sys.exit(skfmm.test())"
77
78 - name: Upload artifacts
79 uses: actions/upload-artifact@v4
80 with:
81 name: wheels-${{ matrix.os }}-${{ matrix.arch }}
82 path: ./wheelhouse/*.whl
83 retention-days: 5
84
85 publish:
86 name: Publish
87 needs: [build_wheels, build_sdist]
88 runs-on: ubuntu-latest
89 steps:
90
91 - name: Checkout code
92 uses: actions/checkout@v4
93
94 - uses: actions/download-artifact@v4
95 with:
96 name: sdist
97 path: dist
98
99 - uses: actions/download-artifact@v4
100 with:
101 pattern: wheels-*
102 merge-multiple: true
103 path: dist
104
105 - name: Upload wheels and sdist to PyPI
106 if: ${{ github.event.inputs.upload == '1'}}
107 uses: pypa/gh-action-pypi-publish@release/v1
108 with:
109 user: __token__
110 password: ${{ secrets.PYPI_API_TOKEN }}
111 skip_existing: true
112 #repository_url: https://test.pypi.org/legacy/ # To test