-
Notifications
You must be signed in to change notification settings - Fork 1
120 lines (114 loc) · 3.44 KB
/
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
109
110
111
112
113
114
115
116
117
118
119
120
# builds only on the following conditions:
# - pull requests into main
# - OR pushes of tags starting with v*
# - OR manual dispatch on repo
# publishes to test pypi if:
# - in auto-differentiation/xad-py repository AND
# - pushes of tags starting with v*
# - OR manual dispatch on repo
# publishes to real PyPI if:
# - publish to Test PyPI worked (with all build conditions above)
# - and if it's a version tag (starting with v*)
#
name: Python Wheels
on:
pull_request:
branches:
- main
push:
tags:
- v*
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
build_wheels:
name: Wheels
strategy:
fail-fast: false
matrix:
buildplat: ["manylinux_x86_64", "musllinux_x86_64", "macosx_x86_64", "win_amd64"]
python: ["cp38", "cp39", "cp310", "cp311", "cp312"]
include:
- buildplat: "manylinux_x86_64"
os: ubuntu-20.04
python_exe: "$(which python)"
- buildplat: "musllinux_x86_64"
os: ubuntu-20.04
python_exe: "$(which python)"
- buildplat: "macosx_x86_64"
os: "macos-12"
python_exe: "$(which python)"
- buildplat: "win_amd64"
os: windows-2022
python_exe: "python"
exclude:
# gives "is not a supported wheel on this platform" for some reason
- buildplat: "macosx_x86_64"
python: "cp38"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build wheels
uses: pypa/cibuildwheel@v2.17.0
env:
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat }}
CIBW_BEFORE_BUILD_WINDOWS: pip install delvewheel
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair -w {dest_dir} {wheel}"
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.python }}-${{ matrix.buildplat }}
path: ./wheelhouse/*.whl
if-no-files-found: error
test-publish:
needs: build_wheels
if: >-
github.repository == 'auto-differentiation/xad-py' &&
(github.event_name == 'workflow_dispatch' ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')))
environment:
name: testpypi
url: https://test.pypi.org/p/xad
permissions:
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@v1.8.12
name: Publish on Test PyPI
with:
verbose: true
repository-url: https://test.pypi.org/legacy/
skip-existing: true
publish:
runs-on: ubuntu-latest
needs: test-publish
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
environment:
name: pypi
url: https://pypi.org/p/xad
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@v1.8.12
name: Publish on PyPI
with:
verbose: true
skip-existing: true