Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
fca4a76
Added new wheel file.
ahmadsharif1 Jul 31, 2024
c228184
.
ahmadsharif1 Jul 31, 2024
d283eec
.
ahmadsharif1 Jul 31, 2024
8696a4a
.
ahmadsharif1 Jul 31, 2024
0b8d802
.
ahmadsharif1 Jul 31, 2024
96e9cd7
.
ahmadsharif1 Jul 31, 2024
b51813c
.
ahmadsharif1 Jul 31, 2024
aea47d2
.
ahmadsharif1 Jul 31, 2024
a70226e
.
ahmadsharif1 Jul 31, 2024
62977aa
.
ahmadsharif1 Jul 31, 2024
60c2f48
.
ahmadsharif1 Jul 31, 2024
74eada7
.
ahmadsharif1 Jul 31, 2024
9633dc6
.
ahmadsharif1 Jul 31, 2024
cb9d1a7
.
ahmadsharif1 Jul 31, 2024
3a0947c
.
ahmadsharif1 Jul 31, 2024
dd7a769
.
ahmadsharif1 Jul 31, 2024
623ed35
.
ahmadsharif1 Jul 31, 2024
9bb4181
Install ffmpeg in post build script
NicolasHug Aug 1, 2024
6b619e3
disable xpu, rocm and cuda
NicolasHug Aug 1, 2024
327d8a1
Add relocation script
NicolasHug Aug 1, 2024
bde5e86
moved to wheel/
NicolasHug Aug 1, 2024
e8231d6
debug
NicolasHug Aug 1, 2024
188b097
disable relocate
NicolasHug Aug 1, 2024
43c76c2
just install from normal conda
NicolasHug Aug 1, 2024
1ec79f8
install 4.4.2
NicolasHug Aug 1, 2024
a99b5e1
.
NicolasHug Aug 1, 2024
6171513
.
NicolasHug Aug 1, 2024
e27ff9a
use yum
NicolasHug Aug 1, 2024
cab67f3
try more stuff
NicolasHug Aug 1, 2024
6f606aa
nosudo
NicolasHug Aug 1, 2024
63d6790
fake smoke test
NicolasHug Aug 1, 2024
728e892
cleanup
NicolasHug Aug 1, 2024
aea589f
try to run auditwheel?
NicolasHug Aug 1, 2024
6d1e795
Add lots of exclude
NicolasHug Aug 1, 2024
0bc9bb0
tree -> find
NicolasHug Aug 1, 2024
b60d6ec
cp wheelhouse
NicolasHug Aug 1, 2024
89be61e
ugh
NicolasHug Aug 1, 2024
a2a56a5
lint
NicolasHug Aug 1, 2024
0f110e4
.
NicolasHug Aug 7, 2024
ad97d46
Cleanup matrix
NicolasHug Aug 7, 2024
888d28f
fix
NicolasHug Aug 7, 2024
08ce172
.
NicolasHug Aug 7, 2024
26d486e
Update current dev version to 0.0.2.dev
NicolasHug Aug 7, 2024
3f6988f
Merge branch '002' into wheel_build_on_test_infra
NicolasHug Aug 7, 2024
5f1a206
.
NicolasHug Aug 7, 2024
0ecb50c
temporary disable cpp and docs job
NicolasHug Aug 7, 2024
d00fe32
Fix name?
NicolasHug Aug 7, 2024
bd2b7e4
Fallback to v3??
NicolasHug Aug 7, 2024
c2a327a
Fix wheel path
NicolasHug Aug 7, 2024
540ee89
rename wheel
NicolasHug Aug 7, 2024
699e414
debuv
NicolasHug Aug 7, 2024
0e7db2d
Use old ubuntu???
NicolasHug Aug 7, 2024
51f7b76
change permissions
NicolasHug Aug 7, 2024
e0e2cf8
again
NicolasHug Aug 7, 2024
5fa1258
wtfff
NicolasHug Aug 7, 2024
ed37906
uhghusrghusrgh
NicolasHug Aug 7, 2024
8935a41
sigh
NicolasHug Aug 7, 2024
1334809
activate env??
NicolasHug Aug 7, 2024
f2a8fa0
.
NicolasHug Aug 7, 2024
7687d6a
.
NicolasHug Aug 7, 2024
5520f1f
.
NicolasHug Aug 7, 2024
286a089
.
NicolasHug Aug 7, 2024
dcb3cba
.
NicolasHug Aug 7, 2024
6782c0a
.
NicolasHug Aug 7, 2024
794104a
.
NicolasHug Aug 7, 2024
ddd32b1
Add sanity checks
NicolasHug Aug 7, 2024
7dbc1ec
cleanup
NicolasHug Aug 7, 2024
5504491
rename file
NicolasHug Aug 7, 2024
dfcd305
last cleanup
NicolasHug Aug 7, 2024
ecc0bdc
Merge branch 'main' of github.com:pytorch/torchcodec into wheel_build…
NicolasHug Aug 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 45 additions & 74 deletions .github/workflows/wheel.yaml
Original file line number Diff line number Diff line change
@@ -1,102 +1,73 @@
name: Build wheel
name: Build and test Linux wheels

on:
push:
branches: [ main ]
pull_request:
push:
branches:
- nightly
- main
- release/*
tags:
- v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+
workflow_dispatch:

concurrency:
group: unit-test${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_number || github.ref }}
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:
runs-on: ubuntu-20.04
needs: generate-matrix
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.12']
steps:
- name: Check out repo
uses: actions/checkout@v3
- name: Setup conda env
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
miniconda-version: "latest"
activate-environment: test
python-version: ${{ matrix.python-version }}
- name: Update pip
run: python -m pip install --upgrade pip
- name: Install Pytorch
run: |
python -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu
- name: Check GCC version
run: |
# We want to build wheels on gcc 9 to be consistent with the torch
# binaries, which is why we're using ubuntu-20.04 and not
# ubuntu-latest. More details below about the GLIBCXX checks.
if ! gcc --version | grep -q -E "9\.[0-9]+\.[0-9]+"
then
echo "Wrong GCC version, exiting!"
gcc --version
exit 1
fi
- name: Build the torchcodec wheel
run: |
# Just for sanity, make sure FFmpeg isn't installed or needed for buidling.
.github/scripts/assert_ffmpeg_not_installed.sh

python -m pip install build
BUILD_AGAINST_ALL_FFMPEG_FROM_S3=1 python -m build . -vvv --no-isolation
- name: Validate wheel content
run: |
source .github/scripts/helpers.sh
wheel_path=$(pwd)/$(find dist -type f -name "*.whl")
echo "Wheel content:"
unzip -l $wheel_path

for ffmpeg_major_version in 4 5 6 7; do
assert_in_wheel $wheel_path torchcodec/libtorchcodec${ffmpeg_major_version}.so
done
assert_not_in_wheel $wheel_path libtorchcodec.so

for ffmpeg_so in libavcodec.so libavfilter.so libavformat.so libavutil.so libavdevice.so ; do
assert_not_in_wheel $wheel_path $ffmpeg_so
done

assert_not_in_wheel $wheel_path "^test"
assert_not_in_wheel $wheel_path "^doc"
assert_not_in_wheel $wheel_path "^benchmarks"

# See invoked python script below for details about this check.
extracted_wheel_dir=$(mktemp -d)
unzip -q $wheel_path -d $extracted_wheel_dir
symbols_matches=$(find $extracted_wheel_dir | grep ".so$" | xargs objdump --syms | grep GLIBCXX_3.4.)
python .github/scripts/check_glibcxx.py "$symbols_matches"
- uses: actions/upload-artifact@v4
with:
name: sdist-and-wheel-linux_x86_${{ matrix.python-version }}
path: dist/*
name: Build and Upload wheel
uses: pytorch/test-infra/.github/workflows/build_wheels_linux.yml@main
with:
repository: pytorch/torchcodec
ref: ""
test-infra-repository: pytorch/test-infra
test-infra-ref: main
build-matrix: ${{ needs.generate-matrix.outputs.matrix }}
post-script: packaging/post_build_script.sh
env-var-script: packaging/env_var_script.sh
smoke-test-script: packaging/fake_smoke_test.py
package-name: torchcodec
trigger-event: ${{ github.event_name }}
build-platform: "python-build-package"
wheel-build-extra-args: "-vvv --no-isolation"

install-and-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.12']
python-version: ['3.9']
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We move from 3.8-3.12 to just 3.9.

  • We can't use 3.8 anymore because test-infra doesn't support it.
  • on top of that, we can only use 3.9 here (for now) because by default, test-infra will only generate job on 3.9 on PRs. Generating job for all python versions can be done by labeling the PR with ciflow/binaries/all (I will eventually document this). What we should be doing here is letting this install-and-test job rely on the exact same python versions that were generated by the generate-matrix job. I haven't found a way to do that yet, but this should be doable, possibly requirement extensions to test-infra.

For now though, this is OK. We will still be able to checks all necessary python version when we push a new release.

ffmpeg-version-for-tests: ['4.4.2', '5.1.2', '6.1.1', '7.0.1']
if: ${{ always() }}
needs: build
steps:
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v3
with:
name: sdist-and-wheel-linux_x86_${{ matrix.python-version }}
path: dist/
name: pytorch_torchcodec__${{ matrix.python-version }}_cpu_x86_64
path: pytorch/torchcodec/dist/
- name: Setup conda env
uses: conda-incubator/setup-miniconda@v2
with:
Expand All @@ -111,7 +82,7 @@ jobs:
python -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu
- name: Install torchcodec from the wheel
run: |
wheel_path=`find dist -type f -name "*.whl"`
wheel_path=`find pytorch/torchcodec/dist -type f -name "*.whl"`
echo Installing $wheel_path
python -m pip install $wheel_path -vvv

Expand Down
3 changes: 3 additions & 0 deletions packaging/env_var_script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

export BUILD_AGAINST_ALL_FFMPEG_FROM_S3=1
7 changes: 7 additions & 0 deletions packaging/fake_smoke_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This is a fake smoke test that runs on the test-infra instances after we build
# a wheel. We cannot run a real smoke test over there, because the machines are
# too old to even install a proper ffmpeg version - and without ffmpeg,
# importing torchcodec just fails. It's OK, we run our *entire* test suite on
# those wheels anyway (on other machines).

print("Success")
38 changes: 38 additions & 0 deletions packaging/post_build_script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash

source .github/scripts/helpers.sh

wheel_path=$(pwd)/$(find dist -type f -name "*.whl")
echo "Wheel content:"
unzip -l $wheel_path

for ffmpeg_major_version in 4 5 6 7; do
assert_in_wheel $wheel_path torchcodec/libtorchcodec${ffmpeg_major_version}.so
done
assert_not_in_wheel $wheel_path libtorchcodec.so

for ffmpeg_so in libavcodec.so libavfilter.so libavformat.so libavutil.so libavdevice.so ; do
assert_not_in_wheel $wheel_path $ffmpeg_so
done

assert_not_in_wheel $wheel_path "^test"
assert_not_in_wheel $wheel_path "^doc"
assert_not_in_wheel $wheel_path "^benchmarks"
assert_not_in_wheel $wheel_path "^packaging"

# See invoked python script below for details about this check.
extracted_wheel_dir=$(mktemp -d)
unzip -q $wheel_path -d $extracted_wheel_dir
symbols_matches=$(find $extracted_wheel_dir | grep ".so$" | xargs objdump --syms | grep GLIBCXX_3.4.)
python .github/scripts/check_glibcxx.py "$symbols_matches"

echo "ls dist"
ls dist

old="linux_x86_64"
new="manylinux_2_17_x86_64.manylinux2014_x86_64"
echo "Replacing ${old} with ${new} in wheel name"
mv dist/*${old}*.whl $(echo dist/*${old}*.whl | sed "s/${old}/${new}/")

echo "ls dist"
ls dist