forked from numpy/numpy
-
Notifications
You must be signed in to change notification settings - Fork 0
142 lines (128 loc) · 5.8 KB
/
wheels.yml
File metadata and controls
142 lines (128 loc) · 5.8 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
# Workflow to build and test wheels, similarly to numpy/numpy-release.
# To work on these jobs in a fork, comment out:
#
# if: github.repository == 'numpy/numpy'
name: Wheel builder
on:
pull_request:
branches:
- main
- maintenance/**
paths-ignore:
- '**.pyi'
- '**.md'
- '**.rst'
- 'tools/stubtest/**'
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: Build wheel ${{ matrix.python }}-${{ matrix.buildplat[1] }}-${{ matrix.buildplat[2] }}
# To enable this job on a fork, comment out:
if: github.repository == 'numpy/numpy' || github.repository == 'riseproject-dev/numpy'
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:
- [ubuntu-22.04, manylinux_x86_64, ""]
- [ubuntu-22.04, musllinux_x86_64, ""]
- [ubuntu-22.04-arm, manylinux_aarch64, ""]
- [ubuntu-22.04-arm, musllinux_aarch64, ""]
- [ubuntu-24.04-riscv, manylinux_riscv64, ""]
- [macos-15-intel, macosx_x86_64, openblas]
- [macos-14, macosx_arm64, openblas]
- [windows-2022, win_amd64, ""]
- [windows-11-arm, win_arm64, ""]
python: ["cp312"]
env:
IS_32_BIT: ${{ matrix.buildplat[1] == 'win32' }} # used in cibw_test_command.sh
steps:
- name: Checkout numpy
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: true
persist-credentials: false
- name: Setup Python for riscv64
if: matrix.buildplat[1] == 'manylinux_riscv64'
run: |
echo "/opt/python-3.12/bin" >> "$GITHUB_PATH"
/opt/python-3.12/bin/python3.12 -m pip install cibuildwheel==3.4.0
- name: Setup MSVC (32-bit)
if: ${{ matrix.buildplat[1] == 'win32' }}
uses: bus1/cabuild/action/msdevshell@e22aba57d6e74891d059d66501b6b5aed8123c4d # v1
with:
architecture: 'x86'
- name: Setup LLVM for Windows ARM64
if: ${{ matrix.buildplat[1] == 'win_arm64' }}
uses: ./.github/windows_arm64_steps
- name: pkg-config-for-win
if: runner.os == 'windows'
run: |
choco install -y --no-progress --stoponfirstfailure --checksum 6004DF17818F5A6DBF19CB335CC92702 pkgconfiglite
$CIBW = "${{ github.workspace }}/.openblas"
# pkgconfig needs a complete path, and not just "./openblas since the
# build is run in a tmp dir (?)
# It seems somewhere in the env passing, `\` is not
# passed through, so convert it to '/'
$CIBW = $CIBW.replace("\","/")
echo "CIBW_ENVIRONMENT_WINDOWS=PKG_CONFIG_PATH=$CIBW" >> $env:GITHUB_ENV
- name: Setup macOS
if: matrix.buildplat[0] == 'macos-15-intel' || matrix.buildplat[0] == 'macos-14'
run: |
# Needed due to https://github.com/actions/runner-images/issues/3371
# Supported versions: https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md
echo "FC=gfortran-13" >> "$GITHUB_ENV"
echo "F77=gfortran-13" >> "$GITHUB_ENV"
echo "F90=gfortran-13" >> "$GITHUB_ENV"
if [[ ${{ matrix.buildplat[2] }} == 'accelerate' ]]; then
# macosx_arm64 and macosx_x86_64 with accelerate
# only target Sonoma onwards
CIBW="MACOSX_DEPLOYMENT_TARGET=14.0 INSTALL_OPENBLAS=false RUNNER_OS=macOS"
echo "CIBW_ENVIRONMENT_MACOS=$CIBW" >> "$GITHUB_ENV"
else
# macosx_x86_64 with OpenBLAS
# if INSTALL_OPENBLAS isn't specified then scipy-openblas is automatically installed
CIBW="RUNNER_OS=macOS"
PKG_CONFIG_PATH="$PWD/.openblas"
DYLD="$DYLD_LIBRARY_PATH:/$PWD/.openblas/lib"
echo "CIBW_ENVIRONMENT_MACOS=$CIBW PKG_CONFIG_PATH=$PKG_CONFIG_PATH DYLD_LIBRARY_PATH=$DYLD" >> "$GITHUB_ENV"
fi
- name: Build wheels
if: matrix.buildplat[1] != 'manylinux_riscv64'
uses: pypa/cibuildwheel@ee02a1537ce3071a004a6b08c41e72f0fdc42d9a # v3.4.0
env:
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}
- name: Restore ccache for riscv64
if: matrix.buildplat[1] == 'manylinux_riscv64'
uses: actions/cache@v4
with:
path: .ccache
key: ccache-riscv64-${{ matrix.python }}-${{ github.sha }}
restore-keys: |
ccache-riscv64-${{ matrix.python }}-
- name: Build wheels (riscv64)
if: matrix.buildplat[1] == 'manylinux_riscv64'
run: |
mkdir -p ${{ github.workspace }}/.ccache
python3 -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}
CIBW_BEFORE_ALL_LINUX: >
yum install -y ccache || true &&
ln -sf $(which ccache) /usr/local/bin/gcc &&
ln -sf $(which ccache) /usr/local/bin/g++ &&
ln -sf $(which ccache) /usr/local/bin/cc &&
ln -sf $(which ccache) /usr/local/bin/c++
CIBW_CONTAINER_ENGINE: "docker; create_args: --volume=${{ github.workspace }}/.ccache:/root/.cache/ccache"
CIBW_TEST_COMMAND: "python -c \"import numpy; print(numpy.__version__); numpy.show_config()\""
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: ${{ matrix.python }}-${{ matrix.buildplat[1] }}-${{ matrix.buildplat[2] }}
path: ./wheelhouse/*.whl