-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (86 loc) · 2.88 KB
/
Copy pathbuild.yml
File metadata and controls
102 lines (86 loc) · 2.88 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
name: Build numpy binary
on:
workflow_dispatch:
inputs:
numpy_tag:
description: 'NumPy tag to build (e.g. v2.4.6)'
required: true
type: string
permissions:
contents: write
defaults:
run:
shell: bash
jobs:
build:
name: Build / ${{ matrix.os }} / Python ${{ matrix.python }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
python: "3.11"
- os: ubuntu-24.04
python: "3.13"
steps:
- name: Checkout numpy-binary
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
path: numpy-binary
- name: Checkout numpy
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: numpy/numpy
ref: ${{ inputs.numpy_tag }}
submodules: true
fetch-tags: true
path: numpy-src
- name: Apply build patch
working-directory: numpy-src
run: git apply ../numpy-binary/build.patch
- name: Install system dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -y clang lld
- name: Install uv
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
- name: Create venv
working-directory: numpy-src
run: |
uv venv .venv --python ${{ matrix.python }}
echo "${{ github.workspace }}/numpy-src/.venv/bin" >> $GITHUB_PATH
echo "VIRTUAL_ENV=${{ github.workspace }}/numpy-src/.venv" >> $GITHUB_ENV
- name: Install build dependencies
working-directory: numpy-src
run: |
uv pip install -r requirements/build_requirements.txt
uv pip install scipy_openblas64
- name: Build numpy
working-directory: numpy-src
env:
CC: clang
CXX: clang++
CPPFLAGS: '-march=x86-64'
LDFLAGS: '-fuse-ld=lld'
run: spin build --with-scipy-openblas=64
- name: Package artifact
working-directory: numpy-src
run: |
TARNAME="numpy-${{ inputs.numpy_tag }}-${{ matrix.os }}-py${{ matrix.python }}.tar.gz"
tar -czf "../numpy-binary/${TARNAME}" -C build-install/usr .
echo "TARNAME=${TARNAME}" >> $GITHUB_ENV
- name: Publish to release
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
TAG="${{ inputs.numpy_tag }}"
TARPATH="numpy-binary/${{ env.TARNAME }}"
if ! gh release view "$TAG" >/dev/null 2>&1; then
gh release create "$TAG" \
--title "NumPy ${TAG}" \
--notes "Minimal x86-64 binary builds of NumPy ${TAG}" \
--target "${{ github.sha }}"
fi
gh release upload "$TAG" "$TARPATH" --clobber