-
Notifications
You must be signed in to change notification settings - Fork 28
285 lines (241 loc) · 8.18 KB
/
Copy path_build_linux.yml
File metadata and controls
285 lines (241 loc) · 8.18 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
name: " - Wheel (Linux)"
on:
workflow_call:
inputs:
python-version:
required: true
type: string
free-threaded:
description: 'Whether FT Python or not. Valid value is "ft" or not.'
default: ''
type: string
arch:
required: true
type: string
machine:
required: true
type: string
run-test:
required: false
default: 'false'
type: string
test-concurrency:
required: false
default: '3'
type: string
env:
ARTIFACT: wheel-linux-py${{ inputs.python-version }}${{ inputs.free-threaded }}-${{ inputs.arch }}
STUB: stub-files-${{ inputs.arch }}-${{ inputs.python-version }}${{ inputs.free-threaded }}
jobs:
build:
runs-on: ${{ inputs.machine }}
container: "quay.io/pypa/manylinux_2_28_${{ inputs.arch }}"
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/cache/restore@v4
with:
path: src/third_party/cache
key: "cmake-build-dependencies-${{ hashFiles('src/third_party/**/CMakeLists.txt') }}"
- name: Build
env:
SPDL_USE_TRACING: 1
run: |
set -ex
# Figure out versions
py_ver="${{ inputs.python-version }}"
if [[ "${{ inputs.free-threaded }}" == 'ft' ]]; then
py_ver="${py_ver}t"
fi
uv --version
uv python pin "${py_ver}"
uv python list --only-installed
uv venv
dnf install -qy cmake ninja-build
# Build package
uv build --no-python-downloads --all-packages --wheel
./packaging/repair_wheels.sh manylinux_2_26_${{ inputs.arch }} ./dist ~/package
- uses: actions/upload-artifact@v4
name: Upload build artifact
with:
name: "${{ env.ARTIFACT }}"
path: ~/package
if-no-files-found: error
retention-days: 7
overwrite: true
- name: Check package
run: |
# Use latest Python. (it shuold not matter)
python_exe="/opt/python/cp314-cp314/bin/python"
"${python_exe}" -m pip install -r ./packaging/requirements.txt
"${python_exe}" -m twine check --strict ~/package/*.whl
- uses: actions/cache/save@v4
with:
path: src/third_party/cache
key: "cmake-build-dependencies-${{ hashFiles('src/third_party/**/CMakeLists.txt') }}"
check-package-dependency:
if: "${{ inputs.run-test == 'true' }}"
needs: ["build"]
runs-on: ${{ inputs.machine }}
steps:
# Note: the suffix 't' is different
- uses: actions/setup-python@v5
if: ${{ inputs.free-threaded == 'ft' }}
with:
python-version: "${{ inputs.python-version }}t"
- uses: actions/setup-python@v5
if: ${{ inputs.free-threaded != 'ft' }}
with:
python-version: "${{ inputs.python-version }}"
- uses: actions/download-artifact@v4
with:
name: "${{ env.ARTIFACT }}"
path: ~/package
- uses: actions/checkout@v4
- name: Dependency Check
run: |
# Install NumPy (the only dep) of SPDL manually, so that
# if a dependency is introduced accidentally, check_deps will catch
pip install numpy
pip install --no-dependencies $(find "${HOME}/package" -name '*.whl' -depth -maxdepth 1)
python .github/scripts/check_deps.py
cpp-unit-test:
if: "${{ inputs.run-test == 'true' }}"
needs: ["build"]
name: "C++ test (ffmpeg ${{ matrix.ffmpeg-version }})"
env:
SPDL_BUILD_TESTING: "1"
strategy:
fail-fast: false
matrix:
ffmpeg-version: ["8.0"]
runs-on: ${{ inputs.machine }}
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: "3.12"
channels: conda-forge
conda-remove-defaults: "true"
- name: Setup
run: |
set -ex
# Install build dependencies
conda install -q cmake ninja gtest fmt glog "ffmpeg==${{ matrix.ffmpeg-version }}" pkg-config
# For some reason, the dynamic libraries are not found.
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${CONDA_PREFIX}/lib" >> $GITHUB_ENV
- name: Build and run C++ tests
run: |
set -ex
# Configure with testing enabled
cmake -S src/libspdl -B build \
-GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DSPDL_BUILD_TESTING=ON \
-DCMAKE_PREFIX_PATH="${CONDA_PREFIX}"
# Build
cmake --build build
# Run tests
ctest --test-dir build --output-on-failure
unit-test:
if: "${{ inputs.run-test == 'true' }}"
needs: ["build"]
name: "test (py ${{ inputs.python-version }}, ffmpeg ${{ matrix.ffmpeg-version }})"
strategy:
fail-fast: false
matrix:
ffmpeg-version: ["8.0"]
runs-on: ${{ inputs.machine }}
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/download-artifact@v4
with:
name: "${{ env.ARTIFACT }}"
path: ~/package
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ inputs.python-version }}
channels: conda-forge
conda-remove-defaults: "true"
- name: Setup
run: |
set -ex
if [[ "${{ inputs.free-threaded }}" == 'ft' ]]; then
conda install -q -c conda-forge python-freethreading
fi
# Install SPDL
pip install $(find "${HOME}/package" -name '*.whl' -depth -maxdepth 1)
# Install PyTorch and others
pip install numpy torch --index-url https://download.pytorch.org/whl/cpu
conda install -q numba pytest pytest-xdist parameterized
# Install FFmpeg
# Note: Somehow FFmepg 5.1 does not install libiconv so specifying it here
conda install -q "ffmpeg==${{ matrix.ffmpeg-version }}" libiconv
# For some reason, the dynamic libraries are not found.
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${CONDA_PREFIX}/lib" >> $GITHUB_ENV
- name: Unit test
run: |
set -ex
python -c 'import spdl.io.utils;assert not spdl.io.utils.built_with_cuda()'
pytest -v -n ${{ inputs.test-concurrency }} \
tests/io/ \
tests/dataloader/ \
tests/pipeline/
stub-check:
needs: ["build"]
runs-on: ${{ inputs.machine }}
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/download-artifact@v4
with:
name: "${{ env.ARTIFACT }}"
path: ~/package
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ inputs.python-version }}
channels: conda-forge
conda-remove-defaults: "true"
- name: Setup
run: |
set -ex
if [[ "${{ inputs.free-threaded }}" == 'ft' ]]; then
conda install -q -c conda-forge python-freethreading
fi
# Install SPDL
pip install $(find "${HOME}/package" -name '*.whl' -depth -maxdepth 1)
# Install deps
pip install numpy nanobind==2.8.0 typing_extensions
# Install FFmpeg
conda install -q ffmpeg==8
# For some reason, the dynamic libraries are not found.
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${CONDA_PREFIX}/lib" >> $GITHUB_ENV
- name: Generate stubs
run: |
set -ex
python src/spdl/io/lib/stubgen.py --output-dir src/spdl/io/lib
git diff --exit-code
- uses: actions/upload-artifact@v4
name: Upload stub
if: failure()
with:
name: "${{ env.STUB }}"
path: src/spdl/io/lib/*.pyi
if-no-files-found: error
retention-days: 7
overwrite: true