|
90 | 90 | "${python_exe}" -m pip install -r ./packaging/requirements.txt |
91 | 91 | "${python_exe}" -m twine check --strict ~/package/*.whl |
92 | 92 |
|
| 93 | + check-stub: |
| 94 | + if: ${{ inputs.run-test == 'true' }} |
| 95 | + needs: ["build"] |
| 96 | + runs-on: ${{ inputs.machine }} |
| 97 | + strategy: |
| 98 | + fail-fast: false |
| 99 | + matrix: |
| 100 | + ffmpeg-version: ["8.0"] |
| 101 | + steps: |
| 102 | + - uses: actions/checkout@v4 |
| 103 | + with: |
| 104 | + persist-credentials: false |
| 105 | + |
| 106 | + - uses: actions/download-artifact@v4 |
| 107 | + with: |
| 108 | + name: "${{ env.ARTIFACT }}" |
| 109 | + path: ~/package |
| 110 | + |
| 111 | + - uses: conda-incubator/setup-miniconda@v3 |
| 112 | + with: |
| 113 | + python-version: "${{ inputs.python-version }}" |
| 114 | + conda-remove-defaults: "true" |
| 115 | + |
| 116 | + - name: Generate stub files |
| 117 | + run: | |
| 118 | + set -x |
| 119 | +
|
| 120 | + pip install $(find "${HOME}/package" -name '*.whl' -depth -maxdepth 1) nanobind |
| 121 | +
|
| 122 | +
|
| 123 | + cu_ver="${{ inputs.cuda-version }}" |
| 124 | + cu_ver="${cu_ver//[.]/}" # Remove dots |
| 125 | + pip install numpy torch --index-url "https://download.pytorch.org/whl/cu${cu_ver}" |
| 126 | +
|
| 127 | + # Install FFmpeg |
| 128 | + # Note: Somehow FFmepg 5.1 does not install libiconv so specifying it here |
| 129 | + conda install -q -c conda-forge "ffmpeg==${{ matrix.ffmpeg-version }}" libiconv |
| 130 | +
|
| 131 | + # Sort out library paths |
| 132 | + # 1. For some reason, the FFmpeg dynamic libraries are not found. |
| 133 | + export "LD_LIBRARY_PATH=${CONDA_PREFIX}/lib" |
| 134 | + # 2. CUDA runtime PyPI package is installed as part of PyTorch installation. |
| 135 | + # However, it is installed in site-packages dir, which is not in PATH by default. |
| 136 | + # (PyTorch has a special way to load it, but we don't do that) |
| 137 | + cudart_dir="$( |
| 138 | + python -c 'import os.path,nvidia.cuda_runtime;print(os.path.join(nvidia.cuda_runtime.__path__[0], "lib"))' |
| 139 | + )" |
| 140 | + export "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${cudart_dir}" |
| 141 | +
|
| 142 | +
|
| 143 | + python scripts/generate_stub.py -o ~/stubs |
| 144 | + cp ~/stubs/* src/spdl/io/lib/ |
| 145 | + git diff --exit-code |
| 146 | +
|
| 147 | + - uses: actions/upload-artifact@v4 |
| 148 | + name: Upload up-to-date stub files |
| 149 | + if: failure() |
| 150 | + with: |
| 151 | + name: "stub" |
| 152 | + path: ~/stubs |
| 153 | + if-no-files-found: error |
| 154 | + retention-days: 7 |
| 155 | + overwrite: true |
| 156 | + |
93 | 157 | check-package-dependency: |
94 | 158 | if: ${{ inputs.run-test == 'true' }} |
95 | 159 | needs: ["build"] |
|
0 commit comments