|
| 1 | +name: " - Wheel (Windows)" |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + python-version: |
| 7 | + required: true |
| 8 | + type: string |
| 9 | + free-threaded: |
| 10 | + description: 'Whether FT Python or not. Valid value is "ft" or not.' |
| 11 | + default: '' |
| 12 | + type: string |
| 13 | + run-test: |
| 14 | + required: false |
| 15 | + default: 'false' |
| 16 | + type: string |
| 17 | + os: |
| 18 | + default: "windows-latest" |
| 19 | + type: string |
| 20 | + |
| 21 | +env: |
| 22 | + ARTIFACT: wheel-win-py${{ inputs.python-version }}${{ inputs.free-threaded }} |
| 23 | + |
| 24 | +jobs: |
| 25 | + build: |
| 26 | + runs-on: "${{ inputs.os }}" |
| 27 | + steps: |
| 28 | + - uses: actions/checkout@v4 |
| 29 | + with: |
| 30 | + persist-credentials: false |
| 31 | + |
| 32 | + - name: Build |
| 33 | + env: |
| 34 | + SPDL_USE_TRACING: 1 |
| 35 | + SPDL_BUILD_STUB: 1 |
| 36 | + shell: bash |
| 37 | + run: | |
| 38 | + set -x |
| 39 | +
|
| 40 | + # choco does not have a zlib |
| 41 | + # choco install zlib -y |
| 42 | + vcpkg install zlib |
| 43 | + find C:/vcpkg/packages/zlib_x64-windows/ |
| 44 | + echo "${VCPKG_ROOT}" |
| 45 | + export CMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake" |
| 46 | + find C:/vcpkg/scripts/buildsystems/ |
| 47 | + find C:/vcpkg/installed/x64-windows/ |
| 48 | +
|
| 49 | + curl -LsSf https://astral.sh/uv/install.sh | sh |
| 50 | + set -ex |
| 51 | +
|
| 52 | + py_ver="${{ inputs.python-version }}" |
| 53 | + if [[ "${{ inputs.free-threaded }}" == 'ft' ]]; then |
| 54 | + py_ver="${py_ver}t" |
| 55 | + fi |
| 56 | +
|
| 57 | + export PATH="${PATH}:${HOME}/.local/bin/" |
| 58 | +
|
| 59 | + uv python pin "${py_ver}" |
| 60 | + uv python list --only-installed |
| 61 | + uv venv |
| 62 | + uv build --no-python-downloads --all-packages --wheel |
| 63 | + mv ./dist ~/package |
| 64 | +
|
| 65 | + - uses: actions/upload-artifact@v4 |
| 66 | + name: Upload build artifact |
| 67 | + with: |
| 68 | + name: "${{ env.ARTIFACT }}" |
| 69 | + path: ~/package |
| 70 | + if-no-files-found: error |
| 71 | + retention-days: 7 |
| 72 | + overwrite: true |
| 73 | + |
| 74 | + - name: Check package |
| 75 | + run: | |
| 76 | + pip install -r ./packaging/requirements.txt |
| 77 | + twine check --strict ~/package/*.whl |
| 78 | +
|
| 79 | + unit-test: |
| 80 | + if: "${{ inputs.run-test == 'true' }}" |
| 81 | + name: "test ffmpeg" |
| 82 | + needs: ["build"] |
| 83 | + strategy: |
| 84 | + fail-fast: false |
| 85 | + matrix: |
| 86 | + ffmpeg-version: ["4.4.2", "5.1", "6.1", "7.1"] |
| 87 | + runs-on: "${{ inputs.os }}" |
| 88 | + defaults: |
| 89 | + run: |
| 90 | + shell: bash -el {0} |
| 91 | + steps: |
| 92 | + - uses: actions/checkout@v4 |
| 93 | + with: |
| 94 | + persist-credentials: false |
| 95 | + |
| 96 | + - uses: actions/download-artifact@v4 |
| 97 | + with: |
| 98 | + name: "${{ env.ARTIFACT }}" |
| 99 | + path: ~/package |
| 100 | + |
| 101 | + - uses: conda-incubator/setup-miniconda@v3 |
| 102 | + with: |
| 103 | + python-version: ${{ inputs.python-version }} |
| 104 | + conda-remove-defaults: "true" |
| 105 | + |
| 106 | + - name: Unit test |
| 107 | + run: | |
| 108 | + if [[ "${{ inputs.free-threaded }}" == 'ft' ]]; then |
| 109 | + conda install -q -c conda-forge python-freethreading |
| 110 | + fi |
| 111 | +
|
| 112 | + # Install SPDL |
| 113 | + pip install $(find "${HOME}/package" -name '*.whl' -depth -maxdepth 1) |
| 114 | +
|
| 115 | + # Install PyTorch and others |
| 116 | + if [[ "${{ inputs.free-threaded }}" == 'ft' ]]; then |
| 117 | + pip install torch numpy pytest |
| 118 | + else |
| 119 | + pip install torch numpy numba pytest |
| 120 | + fi |
| 121 | +
|
| 122 | + # Install FFmpeg |
| 123 | + conda install -q -c conda-forge "ffmpeg==${{ matrix.ffmpeg-version }}" |
| 124 | +
|
| 125 | + pytest -v \ |
| 126 | + tests/spdl_unittest/io/ \ |
| 127 | + tests/spdl_unittest/dataloader/ |
0 commit comments