Skip to content

Commit bc36628

Browse files
authored
Fix wheel builds for MacOS and Windows (#5)
1 parent 8d84867 commit bc36628

1 file changed

Lines changed: 43 additions & 8 deletions

File tree

.github/workflows/build.yml

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
# Taken from osqp-python
2-
31
name: Build Wheels
42

53
on:
6-
# Triggers the workflow on push or pull request events
74
push:
85
branches:
96
- "*"
@@ -18,14 +15,15 @@ jobs:
1815
runs-on: ubuntu-latest
1916
strategy:
2017
fail-fast: false
18+
2119
steps:
22-
- uses: actions/checkout@master
20+
- uses: actions/checkout@v4
2321
with:
24-
submodules: "recursive"
22+
submodules: recursive
2523

2624
- name: Build source and wheel
2725
run: |
28-
python -m pip install build
26+
python -m pip install --upgrade pip build
2927
python -m build --outdir=wheelhouse
3028
3129
- name: Upload sdist and wheel to github
@@ -38,6 +36,7 @@ jobs:
3836
build_wheels:
3937
name: Building wheels on ${{ matrix.os }}
4038
runs-on: ${{ matrix.os }}
39+
4140
strategy:
4241
fail-fast: false
4342
matrix:
@@ -49,12 +48,48 @@ jobs:
4948
fetch-depth: 0
5049
submodules: true
5150

52-
- uses: pypa/cibuildwheel@v2.21
51+
- name: Cache cibuildwheel
52+
uses: actions/cache@v4
53+
with:
54+
path: |
55+
~/.cache/cibuildwheel
56+
~/Library/Caches/cibuildwheel
57+
C:\Users\runneradmin\AppData\Local\pypa\cibuildwheel\Cache
58+
key: cibuildwheel-${{ runner.os }}
59+
60+
# Pre-download virtualenv for macOS
61+
- name: Pre-download virtualenv (macOS)
62+
if: runner.os == 'macOS'
63+
run: |
64+
mkdir -p ~/Library/Caches/cibuildwheel
65+
curl -L -H "Authorization: Bearer $GITHUB_TOKEN" \
66+
https://github.com/pypa/get-virtualenv/raw/20.26.6/public/virtualenv.pyz \
67+
-o ~/Library/Caches/cibuildwheel/virtualenv-20.26.6.pyz
68+
env:
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
71+
# Pre-download virtualenv for Windows
72+
- name: Pre-download virtualenv (Windows)
73+
if: runner.os == 'Windows'
74+
shell: pwsh
75+
run: |
76+
$cache = "$env:LOCALAPPDATA\pypa\cibuildwheel\Cache"
77+
New-Item -ItemType Directory -Force -Path $cache
78+
Invoke-WebRequest `
79+
-Headers @{Authorization="Bearer $env:GITHUB_TOKEN"} `
80+
-Uri "https://github.com/pypa/get-virtualenv/raw/20.26.6/public/virtualenv.pyz" `
81+
-OutFile "$cache\virtualenv-20.26.6.pyz"
82+
env:
83+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84+
85+
- name: Build wheels
86+
uses: pypa/cibuildwheel@v2.21
5387
env:
5488
CIBW_SKIP: "pp38-*"
89+
CIBW_BUILD_VERBOSITY: 1
5590

5691
- name: Upload wheels
5792
uses: actions/upload-artifact@v4
5893
with:
5994
name: cibw-wheels-${{ matrix.os }}
60-
path: wheelhouse/*.whl
95+
path: wheelhouse/*.whl

0 commit comments

Comments
 (0)