-
Notifications
You must be signed in to change notification settings - Fork 4
157 lines (134 loc) · 3.79 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
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
148
149
150
151
152
153
154
155
156
157
name: Build Wheels
on:
workflow_dispatch:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
# branches: [ "main" ]
# paths-ignore:
# - "examples/**"
# - "doc/**"
# - "README.md"
# - "*.txt"
# - "CHANGELOG"
# pull_request:
# branches: [ "main" ]
# types:
# - opened
# - reopened
# - synchronize
# paths-ignore:
# - "examples/**"
# - "doc/**"
# - "README.md"
# - "*.txt"
# - "CHANGELOG"
#
env:
BUILD_TYPE: Release
VERBOSE: 1
# VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite;nuget,GitHub,readwrite'
VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite'
jobs:
build_sdist:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Build sdist
run: |
python -m pip install build
python -m build --sdist .
env:
SETUPTOOLS_SCM_DEBUG: 1
- name: Check sdist
run: |
python -m pip install twine
twine check dist/*
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: sdist
path: ./dist/*
build_wheels:
name: Build wheel for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-2022
- macos-13 # Uses x64
- macos-14 # Uses Apple Silicon
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Setup gha caching for vcpkg
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Setup msbuild on Windows
if: runner.os == 'Windows'
uses: microsoft/setup-msbuild@v2
- name: Enable developer command prompt
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
- name: Install build deps on MacOs
if: runner.os == 'macOs'
run: brew install autoconf automake libtool m4 ninja
- name: Build and test
uses: pypa/[email protected]
env:
MACOSX_DEPLOYMENT_TARGET: 11.0.0
GITHUB_TOK: "${{ secrets.GITHUB_TOKEN }}"
CMAKE_GENERATOR: "Ninja"
CMAKE_TOOLCHAIN_FILE: ${{ github.workspace }}/tools/vcpkg/scripts/buildsystems/vcpkg.cmake
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
publish:
runs-on: ubuntu-latest
needs: [ build_wheels, build_sdist ]
if: ${{ github.event_name == 'push' }}
steps:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install release deps
run: python -m pip install twine
- name: Retrieve sdist
uses: actions/download-artifact@v4
with:
name: sdist
path: dist
- name: Retrieve wheels
uses: actions/download-artifact@v4
with:
pattern: "cibw-*"
path: dist
merge-multiple: true
- name: Update release
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release -R "${{ github.repository }}" upload "${{ github.ref_name }}" dist/*
- name: Publish
run: |
python -m twine upload dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.pypi_password }}