-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (94 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
name: Package Wheels
on:
push:
branches: ["main"]
# release:
# branches: [ "main" ]
jobs:
build_wheels:
name: Wheel build for ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }} ${{ matrix.buildplat[2] }}
runs-on: ${{ matrix.buildplat[0] }}
strategy:
fail-fast: false
matrix:
# Github Actions doesn't support pairing matrix values together, let's improvise
# https://github.com/github/feedback/discussions/7835#discussioncomment-1769026
buildplat:
# should also be able to do multi-archs on a single entry, e.g.
# [os-image, os-name, os-arch]
- [ubuntu-latest, manylinux, x86_64]
- [macos-latest, macosx, x86_64]
- [macos-latest, macosx, arm64]
- [windows-2019, win, AMD64]
# os: [windows-latest]
# cibw_arch: ["AMD64"]
# cibw_python: ["cp38-*", "cp39-*", "cp310-*", "cp311-*"]
python: [["cp38", "3.8"], ["cp39", "3.9"], ["cp310", "3.10"], ["cp311", "3.11"], ["cp312", "3.12"]]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: "3.10"
- name: Install cibuildwheel
run: |
python -m pip install cibuildwheel
- name: Set VSDev RC (windows only)
if: runner.os == 'Windows'
run: |
choco install -y llvm --params "clang;compiler=clang" --version 18.1.0
$env:PATH = "C:\Program Files\LLVM\bin;$env:PATH"
clang --version
function Invoke-VSDevEnvironment {
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$installationPath = & $vswhere -prerelease -legacy -latest -property installationPath
$Command = Join-Path $installationPath "Common7\Tools\vsdevcmd.bat"
& "${env:COMSPEC}" /s /c "`"$Command`" -arch=amd64 -no_logo && set" | Foreach-Object {
if ($_ -match '^([^=]+)=(.*)') {
[System.Environment]::SetEnvironmentVariable($matches[1], $matches[2])
}
}
}
Invoke-VSDevEnvironment
Get-Command rc.exe | Format-Table -AutoSize
- name: Build wheels via cibuildwheel
uses: pypa/[email protected]
env:
CIBW_BUILD: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}*
CIBW_ARCHS: ${{ matrix.buildplat[2] }}
# define CC, CXX so meson will use clang-cl instead of MSVC
# CC: clang-cl
# CXX: clang-cl
# CC: gcc
# CXX: g++
# -Wl,-S equivalent to gcc's -Wl,--strip-debug
# LDFLAGS: "-Wl,-S"
- uses: actions/upload-artifact@v3
with:
name: wheels
path: |
dist
wheelhouse
dist/wheelhouse
upload_all:
needs: [build_wheels]
environment: pypi
permissions:
id-token: write
runs-on: ubuntu-latest
# if: github.event_name == 'release' && github.event.action == 'published'
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: |
dist
wheelhouse
dist/wheelhouse
- uses: pypa/gh-action-pypi-publish@release/v1