|
4 | 4 | push:
|
5 | 5 | branches: [ main ]
|
6 | 6 | pull_request:
|
| 7 | + paths: |
| 8 | + - src/torchcodec/* |
| 9 | + - docs/* |
| 10 | + - .github/workflows/docs.yaml # self reference |
| 11 | + |
| 12 | +permissions: |
| 13 | + id-token: write |
| 14 | + contents: write |
7 | 15 |
|
8 | 16 | defaults:
|
9 | 17 | run:
|
10 | 18 | shell: bash -l -eo pipefail {0}
|
11 | 19 |
|
12 | 20 | jobs:
|
| 21 | + generate-matrix: |
| 22 | + uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main |
| 23 | + with: |
| 24 | + package-type: wheel |
| 25 | + os: linux |
| 26 | + test-infra-repository: pytorch/test-infra |
| 27 | + test-infra-ref: main |
| 28 | + with-cpu: disable |
| 29 | + with-xpu: disable |
| 30 | + with-rocm: disable |
| 31 | + with-cuda: enable |
| 32 | + build-python-only: "disable" |
13 | 33 | build:
|
14 |
| - runs-on: ubuntu-latest |
| 34 | + needs: generate-matrix |
| 35 | + strategy: |
| 36 | + fail-fast: false |
| 37 | + name: Build and Upload wheel |
| 38 | + uses: pytorch/test-infra/.github/workflows/build_wheels_linux.yml@main |
| 39 | + with: |
| 40 | + repository: pytorch/torchcodec |
| 41 | + ref: "" |
| 42 | + test-infra-repository: pytorch/test-infra |
| 43 | + test-infra-ref: main |
| 44 | + build-matrix: ${{ needs.generate-matrix.outputs.matrix }} |
| 45 | + post-script: packaging/post_build_script.sh |
| 46 | + smoke-test-script: packaging/fake_smoke_test.py |
| 47 | + package-name: torchcodec |
| 48 | + trigger-event: ${{ github.event_name }} |
| 49 | + build-platform: "python-build-package" |
| 50 | + build-command: "BUILD_AGAINST_ALL_FFMPEG_FROM_S3=1 ENABLE_CUDA=1 python -m build --wheel -vvv --no-isolation" |
| 51 | + |
| 52 | + build-docs: |
| 53 | + runs-on: linux.4xlarge.nvidia.gpu |
15 | 54 | strategy:
|
16 | 55 | fail-fast: false
|
| 56 | + matrix: |
| 57 | + # 3.9 corresponds to the minimum python version for which we build |
| 58 | + # the wheel unless the label cliflow/binaries/all is present in the |
| 59 | + # PR. |
| 60 | + python-version: ['3.9'] |
| 61 | + cuda-version: ['12.4'] |
| 62 | + ffmpeg-version-for-tests: ['7'] |
| 63 | + container: |
| 64 | + image: "pytorch/manylinux-builder:cuda${{ matrix.cuda-version }}" |
| 65 | + options: "--gpus all -e NVIDIA_DRIVER_CAPABILITIES=video,compute,utility" |
| 66 | + needs: build |
17 | 67 | steps:
|
18 |
| - - name: Check out repo |
19 |
| - uses: actions/checkout@v3 |
20 |
| - - name: Setup conda env |
21 |
| - uses: conda-incubator/setup-miniconda@v2 |
| 68 | + - name: Setup env vars |
| 69 | + run: | |
| 70 | + cuda_version_without_periods=$(echo "${{ matrix.cuda-version }}" | sed 's/\.//g') |
| 71 | + echo cuda_version_without_periods=${cuda_version_without_periods} >> $GITHUB_ENV |
| 72 | + - uses: actions/download-artifact@v3 |
22 | 73 | with:
|
23 |
| - auto-update-conda: true |
24 |
| - miniconda-version: "latest" |
25 |
| - activate-environment: test |
26 |
| - python-version: '3.12' |
| 74 | + name: pytorch_torchcodec__3.9_cu${{ env.cuda_version_without_periods }}_x86_64 |
| 75 | + path: pytorch/torchcodec/dist/ |
| 76 | + - name: Setup miniconda using test-infra |
| 77 | + uses: pytorch/test-infra/.github/actions/setup-miniconda@main |
| 78 | + with: |
| 79 | + python-version: ${{ matrix.python-version }} |
| 80 | + # |
| 81 | + # For some reason nvidia::libnpp=12.4 doesn't install but nvidia/label/cuda-12.4.0::libnpp does. |
| 82 | + # So we use the latter convention for libnpp. |
| 83 | + # We install conda packages at the start because otherwise conda may have conflicts with dependencies. |
| 84 | + default-packages: "nvidia/label/cuda-${{ matrix.cuda-version }}.0::libnpp nvidia::cuda-nvrtc=${{ matrix.cuda-version }} nvidia::cuda-toolkit=${{ matrix.cuda-version }} nvidia::cuda-cudart=${{ matrix.cuda-version }} nvidia::cuda-driver-dev=${{ matrix.cuda-version }} conda-forge::ffmpeg=${{ matrix.ffmpeg-version-for-tests }}" |
| 85 | + - name: Check env |
| 86 | + run: | |
| 87 | + ${CONDA_RUN} env |
| 88 | + ${CONDA_RUN} conda info |
| 89 | + ${CONDA_RUN} nvidia-smi |
| 90 | + ${CONDA_RUN} conda list |
| 91 | + - name: Assert ffmpeg exists |
| 92 | + run: | |
| 93 | + ${CONDA_RUN} ffmpeg -buildconf |
27 | 94 | - name: Update pip
|
28 |
| - run: python -m pip install --upgrade pip |
29 |
| - - name: Install dependencies and FFmpeg |
| 95 | + run: ${CONDA_RUN} python -m pip install --upgrade pip |
| 96 | + - name: Install PyTorch |
30 | 97 | run: |
|
31 |
| - # TODO: torchvision and torchaudio shouldn't be needed. They were only added |
32 |
| - # to silence an error as seen in https://github.com/pytorch/torchcodec/issues/203 |
33 |
| - python -m pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cpu |
34 |
| - conda install "ffmpeg=7.0.1" pkg-config -c conda-forge |
35 |
| - ffmpeg -version |
36 |
| - - name: Build and install torchcodec |
| 98 | + ${CONDA_RUN} python -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu${{ env.cuda_version_without_periods }} |
| 99 | + ${CONDA_RUN} python -c 'import torch; print(f"{torch.__version__}"); print(f"{torch.__file__}"); print(f"{torch.cuda.is_available()=}")' |
| 100 | + - name: Install torchcodec from the wheel |
37 | 101 | run: |
|
38 |
| - python -m pip install -e ".[dev]" --no-build-isolation -vvv |
| 102 | + wheel_path=`find pytorch/torchcodec/dist -type f -name "*.whl"` |
| 103 | + echo Installing $wheel_path |
| 104 | + ${CONDA_RUN} python -m pip install $wheel_path -vvv |
| 105 | +
|
| 106 | + - name: Check out repo |
| 107 | + uses: actions/checkout@v3 |
| 108 | + |
39 | 109 | - name: Install doc dependencies
|
40 | 110 | run: |
|
41 | 111 | cd docs
|
42 |
| - python -m pip install -r requirements.txt |
| 112 | + ${CONDA_RUN} python -m pip install -r requirements.txt |
43 | 113 | - name: Build docs
|
44 | 114 | run: |
|
45 | 115 | cd docs
|
46 |
| - make html |
| 116 | + ${CONDA_RUN} make html |
47 | 117 | - uses: actions/upload-artifact@v3
|
48 | 118 | with:
|
49 | 119 | name: Built-Docs
|
|
0 commit comments