Repository navigation
145 lines (136 loc) · 6.3 KB
/
Copy pathbuild-symengine.yml
File metadata and controls
145 lines (136 loc) · 6.3 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
143
144
145
# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
---
# This workflow is based on: https://github.com/symengine/symengine-wheels' conda
# recipe (recipe/build.sh), the actual process that builds the published PyPI
# wheels - symengine.py's own .github/workflows/ci.yml tests against a
# system-installed SymEngine and never packages a wheel.
name: Build symengine wheels (riscv64)
on:
workflow_dispatch:
inputs:
version:
description: 'Version glob to (re)build; empty builds every version of docs/packages/symengine.yaml not released yet'
required: false
default: ''
cancel-in-progress:
description: Cancel an in-progress run in the same concurrency group.
required: false
type: boolean
default: true
pull_request:
branches: [main]
paths:
- '.github/workflows/build-symengine.yml'
- 'docs/packages/symengine.yaml'
push:
branches: [main]
paths:
- '.github/workflows/build-symengine.yml'
- 'docs/packages/symengine.yaml'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: ${{ case(github.event_name == 'pull_request', true, github.event_name == 'workflow_dispatch', inputs['cancel-in-progress'], false) }}
permissions:
contents: read # to fetch code (actions/checkout)
env:
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64
# The C++ SymEngine release symengine.py's own symengine_version.txt commit
# descends from, pinned by symengine-wheels' recipe/meta.yaml alongside a
# sha256 for the release tarball.
jobs:
setup:
uses: $/.github/workflows/_setup.yml
with:
package: symengine
version: ${{ inputs.version }}
build_wheels:
needs: [setup]
if: needs.setup.outputs.versions != '[]'
name: Build symengine ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.setup.outputs.matrix) }}
uses: $/.github/workflows/_build-cibuildwheel.yml
with:
package: "symengine"
version: "${{ matrix.version }}"
repository: "symengine/symengine.py"
ref: "v${{ matrix.version }}"
artifact-tag: "${{ matrix.python }}-${{ matrix.platform }}_riscv64"
timeout-minutes: 120
cibw-build: "${{ matrix.python }}-${{ matrix.platform }}_riscv64"
# Builds the C++ SymEngine library once per container (not per
# interpreter) and installs it to /usr/local, which CMake's
# find_package(SymEngine) searches by default -- setup.py's own
# cmake invocation then picks it up with no --symengine-dir needed.
# gmp/mpfr/libmpc come from Rocky 10's repos, replacing upstream's
# conda-forge builds of the same libraries -- build/link-time only,
# no effect on what the C++ library computes. INTEGER_CLASS stays
# at its default (gmp) rather than upstream's flint: flint-devel
# has no Rocky 10 package on any arch (confirmed via repoquery), and
# it is a performance accelerator, not required for correctness.
# WITH_LLVM likewise stays at its default (no): upstream's own
# recipe pins llvmdev<17, but Rocky 10 only carries llvm-devel 21.x,
# and the LLVM JIT backend is optional. BUILD_TESTS/BUILD_BENCHMARKS
# are off to keep the native build bounded; the Python wheel is
# exercised instead by the upstream pytest suite below.
cibw-before-all-linux: >
dnf -y install gmp-devel mpfr-devel libmpc-devel &&
cd /tmp &&
curl -fsSLO https://github.com/symengine/symengine/releases/download/v0.14.0/symengine-0.14.0.tar.gz &&
echo "11c5f64e9eec998152437f288b8429ec001168277d55f3f5f1df78e3cf129707 symengine-0.14.0.tar.gz" | sha256sum -c - &&
tar xzf symengine-0.14.0.tar.gz &&
cmake -Bbuild -Ssymengine-0.14.0 -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release
-DBUILD_FOR_DISTRIBUTION=yes -DBUILD_SHARED_LIBS=no -DWITH_MPC=yes -DBUILD_TESTS=no -DBUILD_BENCHMARKS=no &&
cmake --build build -j"$(nproc)" &&
cmake --build build --target install &&
cp /usr/share/licenses/gmp/COPYINGv3 /project/LICENSE.gmp &&
cp /usr/share/licenses/mpfr/COPYING.LESSER /project/LICENSE.mpfr &&
cp /usr/share/licenses/libmpc/COPYING.LESSER /project/LICENSE.mpc
cibw-before-build: "pip install -U \"cython>=0.29.24\" setuptools"
cibw-build-frontend: "pip; args: --no-build-isolation"
# SymEngineConfig.cmake (installed by the C++ build) declares
# `cmake_minimum_required(VERSION 2.8.12)` with no upper bound;
# CMake 4 in this image refuses anything below 3.5 (gotcha 257).
cibw-environment-linux: "PIP_ONLY_BINARY=numpy CMAKE_POLICY_VERSION_MINIMUM=3.5"
# The wheel bundles its own tests/ (symengine/tests/CMakeLists.txt
# installs them alongside the package), so no checkout staging is
# needed -- this is upstream's own bin/test_python.py invocation,
# run against the installed wheel with no source tree in sys.path
# to shadow it.
cibw-test-requires: "pytest sympy numpy"
cibw-test-command: "python -c \"import symengine, sys; sys.exit(0 if symengine.test() else 1)\""
gpl_sources:
name: Collect GPL sources for symengine ${{ matrix.version }}
needs: [setup]
if: needs.setup.outputs.versions != '[]'
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
uses: $/.github/workflows/_collect-gpl-sources.yml
with:
package: symengine
version: ${{ matrix.version }}
packages: gcc gmp mpfr libmpc
publish:
name: Publish symengine ${{ matrix.version }}
needs: [setup, build_wheels, gpl_sources]
if: needs.setup.outputs.versions != '[]'
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
permissions:
contents: write
pull-requests: write
uses: $/.github/workflows/_publish-wheel.yml
secrets:
app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }}
with:
matrix: ${{ needs.setup.outputs.matrix }}
artifact-pattern: symengine-${{ matrix.version }}-*-manylinux_riscv64
gpl-sources-artifact: symengine-${{ matrix.version }}-gpl-sources
gpl-sources-description: gcc, gmp, mpfr, mpc