|
1 |
| -name: Build wheel |
| 1 | +name: Build and test Linux wheels |
2 | 2 |
|
3 | 3 | on:
|
4 |
| - push: |
5 |
| - branches: [ main ] |
6 | 4 | pull_request:
|
| 5 | + push: |
| 6 | + branches: |
| 7 | + - nightly |
| 8 | + - main |
| 9 | + - release/* |
| 10 | + tags: |
| 11 | + - v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+ |
| 12 | + workflow_dispatch: |
7 | 13 |
|
8 | 14 | concurrency:
|
9 |
| - group: unit-test${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_number || github.ref }} |
| 15 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ github.ref_type == 'branch' && github.sha }}-${{ github.event_name == 'workflow_dispatch' }} |
10 | 16 | cancel-in-progress: true
|
11 | 17 |
|
| 18 | +permissions: |
| 19 | + id-token: write |
| 20 | + contents: write |
| 21 | + |
12 | 22 | defaults:
|
13 | 23 | run:
|
14 | 24 | shell: bash -l -eo pipefail {0}
|
15 | 25 |
|
16 | 26 | jobs:
|
| 27 | + generate-matrix: |
| 28 | + uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main |
| 29 | + with: |
| 30 | + package-type: wheel |
| 31 | + os: linux |
| 32 | + test-infra-repository: pytorch/test-infra |
| 33 | + test-infra-ref: main |
| 34 | + with-xpu: disable |
| 35 | + with-rocm: disable |
| 36 | + with-cuda: disable |
17 | 37 | build:
|
18 |
| - runs-on: ubuntu-20.04 |
| 38 | + needs: generate-matrix |
19 | 39 | strategy:
|
20 | 40 | fail-fast: false
|
21 |
| - matrix: |
22 |
| - python-version: ['3.8', '3.12'] |
23 |
| - steps: |
24 |
| - - name: Check out repo |
25 |
| - uses: actions/checkout@v3 |
26 |
| - - name: Setup conda env |
27 |
| - uses: conda-incubator/setup-miniconda@v2 |
28 |
| - with: |
29 |
| - auto-update-conda: true |
30 |
| - miniconda-version: "latest" |
31 |
| - activate-environment: test |
32 |
| - python-version: ${{ matrix.python-version }} |
33 |
| - - name: Update pip |
34 |
| - run: python -m pip install --upgrade pip |
35 |
| - - name: Install Pytorch |
36 |
| - run: | |
37 |
| - python -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu |
38 |
| - - name: Check GCC version |
39 |
| - run: | |
40 |
| - # We want to build wheels on gcc 9 to be consistent with the torch |
41 |
| - # binaries, which is why we're using ubuntu-20.04 and not |
42 |
| - # ubuntu-latest. More details below about the GLIBCXX checks. |
43 |
| - if ! gcc --version | grep -q -E "9\.[0-9]+\.[0-9]+" |
44 |
| - then |
45 |
| - echo "Wrong GCC version, exiting!" |
46 |
| - gcc --version |
47 |
| - exit 1 |
48 |
| - fi |
49 |
| - - name: Build the torchcodec wheel |
50 |
| - run: | |
51 |
| - # Just for sanity, make sure FFmpeg isn't installed or needed for buidling. |
52 |
| - .github/scripts/assert_ffmpeg_not_installed.sh |
53 |
| -
|
54 |
| - python -m pip install build |
55 |
| - BUILD_AGAINST_ALL_FFMPEG_FROM_S3=1 python -m build . -vvv --no-isolation |
56 |
| - - name: Validate wheel content |
57 |
| - run: | |
58 |
| - source .github/scripts/helpers.sh |
59 |
| - wheel_path=$(pwd)/$(find dist -type f -name "*.whl") |
60 |
| - echo "Wheel content:" |
61 |
| - unzip -l $wheel_path |
62 |
| -
|
63 |
| - for ffmpeg_major_version in 4 5 6 7; do |
64 |
| - assert_in_wheel $wheel_path torchcodec/libtorchcodec${ffmpeg_major_version}.so |
65 |
| - done |
66 |
| - assert_not_in_wheel $wheel_path libtorchcodec.so |
67 |
| -
|
68 |
| - for ffmpeg_so in libavcodec.so libavfilter.so libavformat.so libavutil.so libavdevice.so ; do |
69 |
| - assert_not_in_wheel $wheel_path $ffmpeg_so |
70 |
| - done |
71 |
| -
|
72 |
| - assert_not_in_wheel $wheel_path "^test" |
73 |
| - assert_not_in_wheel $wheel_path "^doc" |
74 |
| - assert_not_in_wheel $wheel_path "^benchmarks" |
75 |
| -
|
76 |
| - # See invoked python script below for details about this check. |
77 |
| - extracted_wheel_dir=$(mktemp -d) |
78 |
| - unzip -q $wheel_path -d $extracted_wheel_dir |
79 |
| - symbols_matches=$(find $extracted_wheel_dir | grep ".so$" | xargs objdump --syms | grep GLIBCXX_3.4.) |
80 |
| - python .github/scripts/check_glibcxx.py "$symbols_matches" |
81 |
| - - uses: actions/upload-artifact@v4 |
82 |
| - with: |
83 |
| - name: sdist-and-wheel-linux_x86_${{ matrix.python-version }} |
84 |
| - path: dist/* |
| 41 | + name: Build and Upload wheel |
| 42 | + uses: pytorch/test-infra/.github/workflows/build_wheels_linux.yml@main |
| 43 | + with: |
| 44 | + repository: pytorch/torchcodec |
| 45 | + ref: "" |
| 46 | + test-infra-repository: pytorch/test-infra |
| 47 | + test-infra-ref: main |
| 48 | + build-matrix: ${{ needs.generate-matrix.outputs.matrix }} |
| 49 | + post-script: packaging/post_build_script.sh |
| 50 | + env-var-script: packaging/env_var_script.sh |
| 51 | + smoke-test-script: packaging/fake_smoke_test.py |
| 52 | + package-name: torchcodec |
| 53 | + trigger-event: ${{ github.event_name }} |
| 54 | + build-platform: "python-build-package" |
| 55 | + wheel-build-extra-args: "-vvv --no-isolation" |
85 | 56 |
|
86 | 57 | install-and-test:
|
87 | 58 | runs-on: ubuntu-latest
|
88 | 59 | strategy:
|
89 | 60 | fail-fast: false
|
90 | 61 | matrix:
|
91 |
| - python-version: ['3.8', '3.12'] |
| 62 | + python-version: ['3.9'] |
92 | 63 | ffmpeg-version-for-tests: ['4.4.2', '5.1.2', '6.1.1', '7.0.1']
|
93 | 64 | if: ${{ always() }}
|
94 | 65 | needs: build
|
95 | 66 | steps:
|
96 |
| - - uses: actions/download-artifact@v4 |
| 67 | + - uses: actions/download-artifact@v3 |
97 | 68 | with:
|
98 |
| - name: sdist-and-wheel-linux_x86_${{ matrix.python-version }} |
99 |
| - path: dist/ |
| 69 | + name: pytorch_torchcodec__${{ matrix.python-version }}_cpu_x86_64 |
| 70 | + path: pytorch/torchcodec/dist/ |
100 | 71 | - name: Setup conda env
|
101 | 72 | uses: conda-incubator/setup-miniconda@v2
|
102 | 73 | with:
|
|
111 | 82 | python -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu
|
112 | 83 | - name: Install torchcodec from the wheel
|
113 | 84 | run: |
|
114 |
| - wheel_path=`find dist -type f -name "*.whl"` |
| 85 | + wheel_path=`find pytorch/torchcodec/dist -type f -name "*.whl"` |
115 | 86 | echo Installing $wheel_path
|
116 | 87 | python -m pip install $wheel_path -vvv
|
117 | 88 |
|
|
0 commit comments