Debian Codegraph @

.github/workflows/wheels.yml

raw
1 # Workflow to build and test wheels, similarly to numpy/numpy-release.
2 # To work on these jobs in a fork, comment out:
3 #
4 # if: github.repository == 'numpy/numpy'
5 name: Wheel builder
6
7 on:
8 pull_request:
9 branches:
10 - main
11 - maintenance/**
12 paths-ignore:
13 - '**.pyi'
14 - '**.md'
15 - '**.rst'
16 workflow_dispatch:
17
18 concurrency:
19 group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
20 cancel-in-progress: true
21
22 permissions:
23 contents: read # to fetch code (actions/checkout)
24
25 jobs:
26 build_wheels:
27 name: Build wheel ${{ matrix.python }}-${{ matrix.buildplat[1] }}-${{ matrix.buildplat[2] }}
28 # To enable this job on a fork, comment out:
29 if: github.repository == 'numpy/numpy'
30 runs-on: ${{ matrix.buildplat[0] }}
31 strategy:
32 fail-fast: false
33 matrix:
34 # Github Actions doesn't support pairing matrix values together, let's improvise
35 # https://github.com/github/feedback/discussions/7835#discussioncomment-1769026
36 buildplat:
37 - [ubuntu-22.04, manylinux_x86_64, ""]
38 - [ubuntu-22.04, musllinux_x86_64, ""]
39 - [ubuntu-22.04-arm, manylinux_aarch64, ""]
40 - [ubuntu-22.04-arm, musllinux_aarch64, ""]
41 - [macos-15-intel, macosx_x86_64, openblas]
42 - [macos-14, macosx_arm64, openblas]
43 - [windows-2022, win_amd64, ""]
44 - [windows-11-arm, win_arm64, ""]
45 python: ["cp311"]
46
47 env:
48 IS_32_BIT: ${{ matrix.buildplat[1] == 'win32' }} # used in cibw_test_command.sh
49 steps:
50 - name: Checkout numpy
51 uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
52 with:
53 submodules: true
54 persist-credentials: false
55
56 - name: Setup MSVC (32-bit)
57 if: ${{ matrix.buildplat[1] == 'win32' }}
58 uses: bus1/cabuild/action/msdevshell@e22aba57d6e74891d059d66501b6b5aed8123c4d # v1
59 with:
60 architecture: 'x86'
61
62 - name: Setup LLVM for Windows ARM64
63 if: ${{ matrix.buildplat[1] == 'win_arm64' }}
64 uses: ./.github/windows_arm64_steps
65
66 - name: pkg-config-for-win
67 if: runner.os == 'windows'
68 run: |
69 choco install -y --no-progress --stoponfirstfailure --checksum 6004DF17818F5A6DBF19CB335CC92702 pkgconfiglite
70 $CIBW = "${{ github.workspace }}/.openblas"
71 # pkgconfig needs a complete path, and not just "./openblas since the
72 # build is run in a tmp dir (?)
73 # It seems somewhere in the env passing, `\` is not
74 # passed through, so convert it to '/'
75 $CIBW = $CIBW.replace("\","/")
76 echo "CIBW_ENVIRONMENT_WINDOWS=PKG_CONFIG_PATH=$CIBW" >> $env:GITHUB_ENV
77
78 - name: Setup macOS
79 if: matrix.buildplat[0] == 'macos-15-intel' || matrix.buildplat[0] == 'macos-14'
80 run: |
81 # Needed due to https://github.com/actions/runner-images/issues/3371
82 # Supported versions: https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md
83 echo "FC=gfortran-13" >> "$GITHUB_ENV"
84 echo "F77=gfortran-13" >> "$GITHUB_ENV"
85 echo "F90=gfortran-13" >> "$GITHUB_ENV"
86 if [[ ${{ matrix.buildplat[2] }} == 'accelerate' ]]; then
87 # macosx_arm64 and macosx_x86_64 with accelerate
88 # only target Sonoma onwards
89 CIBW="MACOSX_DEPLOYMENT_TARGET=14.0 INSTALL_OPENBLAS=false RUNNER_OS=macOS"
90 echo "CIBW_ENVIRONMENT_MACOS=$CIBW" >> "$GITHUB_ENV"
91 else
92 # macosx_x86_64 with OpenBLAS
93 # if INSTALL_OPENBLAS isn't specified then scipy-openblas is automatically installed
94 CIBW="RUNNER_OS=macOS"
95 PKG_CONFIG_PATH="$PWD/.openblas"
96 DYLD="$DYLD_LIBRARY_PATH:/$PWD/.openblas/lib"
97 echo "CIBW_ENVIRONMENT_MACOS=$CIBW PKG_CONFIG_PATH=$PKG_CONFIG_PATH DYLD_LIBRARY_PATH=$DYLD" >> "$GITHUB_ENV"
98 fi
99
100 - name: Build wheels
101 uses: pypa/cibuildwheel@63fd63b352a9a8bdcc24791c9dbee952ee9a8abc # v3.3.0
102 env:
103 CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}
104
105 - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
106 with:
107 name: ${{ matrix.python }}-${{ matrix.buildplat[1] }}-${{ matrix.buildplat[2] }}
108 path: ./wheelhouse/*.whl