Repository navigation
103 lines (97 loc) · 4.6 KB
/
Copy pathpython-wheels.yml
File metadata and controls
103 lines (97 loc) · 4.6 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
# SPDX-License-Identifier: MPL-2.0
name: Python wheels
on:
push:
branches: [master]
paths-ignore: ['.github/workflows/docs.yml', 'docs/**', 'mkdocs.yml', 'requirements-docs.txt', 'tools/build_docs.py', 'tools/check_api_docs.py', 'tools/check_haskell_doc_examples.py', 'tools/check_docs_links.py', 'tools/haskell_reference.py', 'README.md']
pull_request:
paths-ignore: ['.github/workflows/docs.yml', 'docs/**', 'mkdocs.yml', 'requirements-docs.txt', 'tools/build_docs.py', 'tools/check_api_docs.py', 'tools/check_haskell_doc_examples.py', 'tools/check_docs_links.py', 'tools/haskell_reference.py', 'README.md']
workflow_call:
outputs:
version:
description: Version read from the built package metadata
value: ${{ jobs.build.outputs.version }}
permissions:
contents: read
concurrency:
group: python-wheels-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name != 'workflow_dispatch' }}
jobs:
build:
runs-on: ubuntu-24.04
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- name: Read package version
id: version
run: |
python - <<'PY'
import os, pathlib, tomllib
version = tomllib.loads(pathlib.Path('pyproject.toml').read_text())['project']['version']
with open(os.environ['GITHUB_OUTPUT'], 'a') as output:
print('version=' + version, file=output)
PY
- name: Build self-contained manylinux wheel and source distribution
run: |
docker run --rm --volume "$PWD:/io" \
--env SOURCE_DATE_EPOCH="$(git show -s --format=%ct HEAD)" \
quay.io/pypa/manylinux_2_28_x86_64@sha256:e0adf18521ad35192df733a6c62d35df7801957d24e0470238aacecfab2188a3 \
bash /io/tools/build_python_wheel.sh
python -m pip install twine
python -m twine check --strict dist/*.whl dist/hmath_python-*.tar.gz
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: python-distributions
path: |
dist/*.whl
dist/hmath_python-*.tar.gz
if-no-files-found: error
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: native-distributions
path: dist/native/*
if-no-files-found: error
c-sdk:
needs: build
runs-on: ubuntu-24.04
container: python:3.12-slim-bookworm
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6
with:
name: native-distributions
path: /tmp/hmath-native
- name: Verify the relocated SDK without GHC
run: |
apt-get update
apt-get install -y --no-install-recommends build-essential pkg-config cmake
python tools/check_c_sdk.py /tmp/hmath-native/hmath-*-linux-x86_64.tar.gz
test:
needs: build
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
python: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
container: python:${{ matrix.python }}-slim-bookworm
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6
with:
name: python-distributions
path: /tmp/hmath-distributions
- name: Verify installation without GHC or a system HMath library
run: |
python -m pip install /tmp/hmath-distributions/*.whl
cd "$RUNNER_TEMP"
python "$GITHUB_WORKSPACE/tools/check_python_wheel.py"
python -m pip install numpy cffi
python "$GITHUB_WORKSPACE/tools/check_python_wheel.py" "$GITHUB_WORKSPACE/bindings/python/test_bindings.py"
python "$GITHUB_WORKSPACE/tools/check_python_wheel.py" "$GITHUB_WORKSPACE/test/native/expanded_bindings.py"
python "$GITHUB_WORKSPACE/tools/check_python_wheel.py" "$GITHUB_WORKSPACE/test/native/autodiff_bindings.py"
for contract in value polynomial optimization units expression linear stochastic numerical spectral foundation tensor; do
python "$GITHUB_WORKSPACE/tools/check_python_wheel.py" "$GITHUB_WORKSPACE/test/native/${contract}_bindings.py"
done
python "$GITHUB_WORKSPACE/tools/check_python_wheel.py" "$GITHUB_WORKSPACE/test/native/callback_errors.py"
python "$GITHUB_WORKSPACE/tools/check_docs_examples.py"