-
Notifications
You must be signed in to change notification settings - Fork 44
147 lines (130 loc) · 4.33 KB
/
Copy pathcibuildwheel.yml
File metadata and controls
147 lines (130 loc) · 4.33 KB
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: Build
on:
push:
branches: [main]
pull_request:
branches: ["*"]
workflow_dispatch: # allows you to trigger manually
# When this workflow is queued, automatically cancel any previous running
# or pending jobs from the same branch
concurrency:
group: cidbuildwheel-${{ github.ref }}
cancel-in-progress: true
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os:
- ubuntu-latest # x64
- ubuntu-24.04-arm # ARM
- macos-15-intel # x64
- macos-latest # ARM
- windows-latest # x64
- windows-11-arm # ARM
steps:
- uses: actions/checkout@v6
# See https://cibuildwheel.pypa.io/en/1.x/cpp_standards/
- name: Setup MSVC on Windows x64
if: matrix.os == 'windows-latest'
uses: ilammy/msvc-dev-cmd@v1
- name: Setup MSVC on Windows ARM64
if: matrix.os == 'windows-11-arm'
uses: bus1/cabuild/action/msdevshell@e22aba57d6e74891d059d66501b6b5aed8123c4d # v1
with:
architecture: arm64
# Install LLVM on Windows
- name: Install LLVM on Windows x64
if: matrix.os == 'windows-latest'
run: |
choco install llvm --version=18.1.8 -y --force
echo "C:\Program Files\LLVM\bin" >> $env:GITHUB_PATH
- name: Install LLVM on Windows ARM64
if: matrix.os == 'windows-11-arm'
shell: pwsh
run: |
Invoke-WebRequest https://github.com/llvm/llvm-project/releases/download/llvmorg-20.1.6/LLVM-20.1.6-woa64.exe -UseBasicParsing -OutFile LLVM-woa64.exe
Start-Process -FilePath ".\LLVM-woa64.exe" -ArgumentList "/S" -Wait
echo "C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "CC=clang-cl" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Debug env
run: env
- name: Build wheels
uses: pypa/cibuildwheel@v3.3.0
env:
CIBW_ARCHS_LINUX: auto
DISTUTILS_USE_SDK: 1
MSSdk: 1
AR: llvm-ar
AS: llvm-as
CC: clang
RANLIB: echo
CIBW_BUILD_VERBOSITY: 5
with:
package-dir: .
output-dir: wheelhouse
config-file: "{package}/pyproject.toml"
- uses: actions/upload-artifact@v5
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Build sdist
run: pipx run build --sdist
- uses: actions/upload-artifact@v5
with:
name: cibw-sdist
path: dist/*.tar.gz
create_release:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
permissions:
contents: write
checks: write
actions: read
issues: read
packages: write
pull-requests: read
repository-projects: read
statuses: read
steps:
- name: Get the tag name and determine if it's a prerelease
id: get_tag_info
run: |
FULL_TAG=${GITHUB_REF#refs/tags/}
if [[ $FULL_TAG == release-* ]]; then
TAG_NAME=${FULL_TAG#release-}
IS_PRERELEASE=false
elif [[ $FULL_TAG == prerelease-* ]]; then
TAG_NAME=${FULL_TAG#prerelease-}
IS_PRERELEASE=true
else
TAG_NAME=$FULL_TAG
IS_PRERELEASE=false
fi
echo "FULL_TAG=$TAG_NAME" >> $GITHUB_ENV
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
echo "IS_PRERELEASE=$IS_PRERELEASE" >> $GITHUB_ENV
- uses: actions/download-artifact@v5
with:
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true
- name: Create Draft Release
id: create_release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/release-') || startsWith(github.ref, 'refs/tags/prerelease-')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: ${{ env.TAG_NAME }}
draft: true
prerelease: ${{ env.IS_PRERELEASE }}
files: "./dist/*"