|
60 | 60 | # The BUILD_AGAINST_ALL_FFMPEG_FROM_S3 var, needed to build the wheel, is |
61 | 61 | # set in vc_env_helper.bat Couldn't find a way to set it from here. |
62 | 62 | build-command: "python -m build --wheel -vvv --no-isolation" |
| 63 | + |
| 64 | + install-and-test: |
| 65 | + runs-on: windows-latest |
| 66 | + strategy: |
| 67 | + fail-fast: false |
| 68 | + matrix: |
| 69 | + python-version: ['3.10'] |
| 70 | + # TODO: FFmpeg 5 on Windows segfaults in avcodec_open2() when passing |
| 71 | + # bad parameters. |
| 72 | + # See https://github.com/pytorch/torchcodec/pull/806 |
| 73 | + ffmpeg-version-for-tests: ['4.4.2', '6.1.1', '7.0.1'] |
| 74 | + needs: build |
| 75 | + steps: |
| 76 | + - uses: actions/download-artifact@v4 |
| 77 | + with: |
| 78 | + name: pytorch_torchcodec__${{ matrix.python-version }}_cpu_x64 |
| 79 | + path: pytorch/torchcodec/dist/ |
| 80 | + - name: Setup conda env |
| 81 | + uses: conda-incubator/setup-miniconda@v2 |
| 82 | + with: |
| 83 | + auto-update-conda: true |
| 84 | + miniconda-version: "latest" |
| 85 | + activate-environment: test |
| 86 | + python-version: ${{ matrix.python-version }} |
| 87 | + - name: Update pip |
| 88 | + run: python -m pip install --upgrade pip |
| 89 | + - name: Install PyTorch |
| 90 | + run: | |
| 91 | + python -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu |
| 92 | + - name: Install torchcodec from the wheel |
| 93 | + run: | |
| 94 | + wheel_path=`find pytorch/torchcodec/dist -type f -name "*.whl"` |
| 95 | + echo Installing $wheel_path |
| 96 | + python -m pip install $wheel_path -vvv |
| 97 | + - name: Check out repo |
| 98 | + uses: actions/checkout@v3 |
| 99 | + - name: Install ffmpeg, post build |
| 100 | + run: | |
| 101 | + # Ideally we would have checked for that before installing the wheel, |
| 102 | + # but we need to checkout the repo to access this file, and we don't |
| 103 | + # want to checkout the repo before installing the wheel to avoid any |
| 104 | + # side-effect. It's OK. |
| 105 | + source packaging/helpers.sh |
| 106 | + assert_ffmpeg_not_installed |
| 107 | + conda install "ffmpeg=${{ matrix.ffmpeg-version-for-tests }}" -c conda-forge |
| 108 | + ffmpeg -version |
| 109 | + - name: Test torchcodec import after FFmpeg installation |
| 110 | + run: | |
| 111 | + echo "Testing torchcodec import after FFmpeg is installed and PATH is updated..." |
| 112 | + python -c "import torchcodec; print('TorchCodec import successful!')" |
| 113 | + - name: Install test dependencies |
| 114 | + run: | |
| 115 | + # Ideally we would find a way to get those dependencies from pyproject.toml |
| 116 | + python -m pip install numpy pytest pillow |
| 117 | + - name: Delete the src/ folder just for fun |
| 118 | + run: | |
| 119 | + # The only reason we checked-out the repo is to get access to the |
| 120 | + # tests. We don't care about the rest. Out of precaution, we delete |
| 121 | + # the src/ folder to be extra sure that we're running the code from |
| 122 | + # the installed wheel rather than from the source. |
| 123 | + # This is just to be extra cautious and very overkill because a) |
| 124 | + # there's no way the `torchcodec` package from src/ can be found from |
| 125 | + # the PythonPath: the main point of `src/` is precisely to protect |
| 126 | + # against that and b) if we ever were to execute code from |
| 127 | + # `src/torchcodec`, it would fail loudly because the built .so files |
| 128 | + # aren't present there. |
| 129 | + rm -r src/ |
| 130 | + ls |
| 131 | + - name: Run Python tests |
| 132 | + run: | |
| 133 | + pytest test -vvv |
0 commit comments