-
Notifications
You must be signed in to change notification settings - Fork 121
222 lines (184 loc) · 7.23 KB
/
Copy pathlinux_wheel.yaml
File metadata and controls
222 lines (184 loc) · 7.23 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
name: Linux CPU x86
on:
pull_request:
push:
branches:
- nightly
- main
- release/*
tags:
- v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ github.ref_type == 'branch' && github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
cancel-in-progress: true
permissions:
id-token: write
contents: write
defaults:
run:
shell: bash -l -eo pipefail {0}
jobs:
generate-matrix:
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
with:
package-type: wheel
os: linux
test-infra-repository: pytorch/test-infra
test-infra-ref: main
with-xpu: disable
with-rocm: disable
with-cuda: disable
build-python-only: "disable"
build:
needs: generate-matrix
strategy:
fail-fast: false
name: Build and Upload wheel
uses: pytorch/test-infra/.github/workflows/build_wheels_linux.yml@main
with:
repository: meta-pytorch/torchcodec
ref: ""
test-infra-repository: pytorch/test-infra
test-infra-ref: main
build-matrix: ${{ needs.generate-matrix.outputs.matrix }}
pre-script: packaging/pre_build_script.sh
post-script: packaging/post_build_script.sh
smoke-test-script: packaging/fake_smoke_test.py
package-name: torchcodec
trigger-event: ${{ github.event_name }}
build-platform: "python-build-package"
build-command: "BUILD_AGAINST_ALL_FFMPEG_FROM_S3=1 python -m build --wheel -vvv --no-isolation"
also-upload-to-gpu-arch-versions: "xpu"
install-and-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.10']
ffmpeg-version-for-tests: ['4', '5', '6', '7', '8', '9']
needs: build
steps:
- name: Check out repo
uses: actions/checkout@v6
- name: Remove src/ folder
run: bash packaging/remove_src.sh
- name: Setup conda env
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
# Using miniforge instead of miniconda ensures that the default
# conda channel is conda-forge instead of main/default. This ensures
# ABI consistency between dependencies:
# https://conda-forge.org/docs/user/transitioning_from_defaults/
miniforge-version: latest
activate-environment: test
python-version: ${{ matrix.python-version }}
- name: Update pip
run: python -m pip install --upgrade pip
- name: Install PyTorch
run: bash packaging/install_pytorch.sh cpu "torch torchvision"
- uses: actions/download-artifact@v4
with:
name: meta-pytorch_torchcodec__${{ matrix.python-version }}_cpu_x86_64
path: dist/
- name: Install torchcodec from the wheel
run: bash packaging/install_torchcodec_wheel.sh
- name: Install ffmpeg, post build
run: bash packaging/install_ffmpeg.sh ${{ matrix.ffmpeg-version-for-tests }}
- name: Install test dependencies
run: bash packaging/install_test_dependencies.sh ${{ matrix.ffmpeg-version-for-tests != '4' }}
- name: Run Python tests
run: |
if [ "${{ matrix.ffmpeg-version-for-tests }}" = "4" ]; then export FAIL_WITHOUT_HEIC=0; fi
python packaging/assert_ffmpeg_version.py ${{ matrix.ffmpeg-version-for-tests }}
FAIL_WITHOUT_IMAGE_CODECS=1 pytest --override-ini="addopts=-v" test
install-and-test-no-ffmpeg:
# Asserts that torchcodec works WITHOUT FFmpeg installed: the package must
# import, the FFmpeg-free image decoders must work, and the FFmpeg-backed
# entry points must fail with a clear error.
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.10']
needs: build
steps:
- name: Check out repo
uses: actions/checkout@v6
- name: Remove src/ folder
run: bash packaging/remove_src.sh
- name: Setup conda env
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
miniforge-version: latest
activate-environment: test
python-version: ${{ matrix.python-version }}
- name: Update pip
run: python -m pip install --upgrade pip
- name: Install PyTorch
run: bash packaging/install_pytorch.sh cpu "torch torchvision"
- uses: actions/download-artifact@v4
with:
name: meta-pytorch_torchcodec__${{ matrix.python-version }}_cpu_x86_64
path: dist/
- name: Install torchcodec from the wheel
run: bash packaging/install_torchcodec_wheel.sh
- name: Install test dependencies
run: bash packaging/install_test_dependencies.sh
# Deliberately NO "Install ffmpeg" step here.
- name: Assert FFmpeg is absent and torchcodec still imports
run: |
source packaging/helpers.sh
assert_ffmpeg_not_installed
python -c "import torchcodec; from torchcodec._core import ops; assert not ops._FFMPEG_AVAILABLE, 'FFmpeg was unexpectedly loaded'; print('OK: torchcodec imported without FFmpeg')"
- name: Run FFmpeg-free Python tests
run: |
FAIL_WITHOUT_IMAGE_CODECS=1 \
pytest --override-ini="addopts=-v" test/test_ffmpeg_optional.py test/test_decoders.py::TestImageDecoder
install-and-test-third-party-interface:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.10']
ffmpeg-version-for-tests: ['9']
needs: build
steps:
- name: Check out repo
uses: actions/checkout@v3
- name: Remove src/ folder
run: bash packaging/remove_src.sh
- name: Setup conda env
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
# Using miniforge instead of miniconda ensures that the default
# conda channel is conda-forge instead of main/default. This ensures
# ABI consistency between dependencies:
# https://conda-forge.org/docs/user/transitioning_from_defaults/
miniforge-version: latest
activate-environment: test
python-version: ${{ matrix.python-version }}
- name: Update pip
run: python -m pip install --upgrade pip
- name: Install PyTorch
run: bash packaging/install_pytorch.sh cpu "torch torchvision"
- uses: actions/download-artifact@v4
with:
name: meta-pytorch_torchcodec__${{ matrix.python-version }}_cpu_x86_64
path: dist/
- name: Install torchcodec from the wheel
run: bash packaging/install_torchcodec_wheel.sh
- name: Install ffmpeg, post build
run: bash packaging/install_ffmpeg.sh ${{ matrix.ffmpeg-version-for-tests }}
- name: Install pkg-config
run: |
conda install pkg-config -c conda-forge
- name: Install test dependencies
run: bash packaging/install_test_dependencies.sh
- name: Run Python tests
run: |
python packaging/assert_ffmpeg_version.py ${{ matrix.ffmpeg-version-for-tests }}
pytest --override-ini="addopts=-v" test/third-party-interface