-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Expand file tree
/
Copy pathpython-bindings.yml
More file actions
137 lines (120 loc) · 3.55 KB
/
python-bindings.yml
File metadata and controls
137 lines (120 loc) · 3.55 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
name: Python Bindings
on:
push:
branches:
- nn-py-bindings
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build_sdist:
name: Build sdist
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
fetch-tags: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Build sdist
run: |
python -m pip install build
python -m build --sdist
echo "=== sdist produced ==="
ls -la dist/
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz
build_wheels:
name: Build - cp312, ${{ matrix.name }}
needs: [build_sdist]
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- name: Linux x86_64
runner: ubuntu-latest
- name: Linux aarch64
runner: ubuntu-24.04-arm
- name: macOS arm64
runner: macos-14
- name: Windows amd64
runner: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
fetch-tags: true
- name: Download sdist
if: runner.os == 'Linux'
uses: actions/download-artifact@v4
with:
name: sdist
path: dist
- name: Locate sdist
if: runner.os == 'Linux'
id: sdist
shell: bash
run: echo "path=$(ls dist/*.tar.gz | head -n1)" >> "$GITHUB_OUTPUT"
- name: Restore Conan cache
id: conan-cache
if: runner.os == 'Windows'
uses: actions/cache/restore@v5
with:
path: ~/.conan2
key: v4-conan-${{ runner.os }}-${{ hashFiles('pyproject.toml') }}
restore-keys: |
v4-conan-${{ runner.os }}-
- name: Run cibuildwheel
uses: pypa/cibuildwheel@v3.4.0
with:
# for linux build the wheel from the sdist
package-dir: ${{ runner.os == 'Linux' && steps.sdist.outputs.path || '.' }}
env:
CIBW_CONTAINER_ENGINE: "docker; create_args: --volume /tmp/ccache:/ccache"
CIBW_ENVIRONMENT_LINUX: "LD_LIBRARY_PATH=/usr/local/lib64:${LD_LIBRARY_PATH} CCACHE_DIR=/ccache"
CIBW_CONFIG_SETTINGS_MACOS: "cmake.define.CMAKE_CXX_COMPILER_LAUNCHER=ccache cmake.define.CMAKE_C_COMPILER_LAUNCHER=ccache"
CIBW_CONFIG_SETTINGS_WINDOWS: "cmake.define.ENABLE_CONAN=ON"
- name: Save Conan cache
uses: actions/cache/save@v5
if: "!cancelled() && runner.os == 'Windows' && steps.conan-cache.outputs.cache-hit != 'true'"
with:
path: ~/.conan2
key: v4-conan-${{ runner.os }}-${{ hashFiles('pyproject.toml') }}
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.name }}
path: wheelhouse/*.whl
publish_test_pypi:
name: Publish to TestPyPI
needs: [build_wheels]
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Download wheels
uses: actions/download-artifact@v4
with:
path: dist
pattern: wheels-*
merge-multiple: true
- name: Download sdist
uses: actions/download-artifact@v4
with:
name: sdist
path: dist
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@v1.13.0
with:
repository-url: https://test.pypi.org/legacy/
verbose: true