Add workflow for paddlepaddle wheel build #21
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Wheels for Paddle | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| merge_group: | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ github.ref_type == 'branch' && github.sha }}-${{ github.event_name == 'workflow_dispatch' }} | |
| cancel-in-progress: true | |
| permissions: | |
| id-token: write | |
| contents: write | |
| defaults: | |
| run: | |
| shell: bash -l -eo pipefail {0} | |
| jobs: | |
| build-paddlecodec-wheel: | |
| runs-on: ubuntu-latest | |
| container: | |
| image: pytorch/manylinux2_28-builder:cpu | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Setup conda environment | |
| uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| auto-update-conda: true | |
| miniforge-version: latest | |
| activate-environment: build | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install build dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build wheel setuptools | |
| - name: Install PaddlePaddle nightly | |
| run: | | |
| pip install --pre paddlepaddle -i https://www.paddlepaddle.org.cn/packages/nightly/cpu/ | |
| - name: Run pre-build script | |
| run: | | |
| bash packaging/pre_build_script.sh | |
| - name: Build wheel | |
| run: | | |
| # Use pre-built FFmpeg from PyTorch S3 | |
| export BUILD_AGAINST_ALL_FFMPEG_FROM_S3=1 | |
| python -m build --wheel -vvv --no-isolation | |
| - name: Upload wheel artifact | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: paddlecodec-wheel-linux-py${{ matrix.python-version }} | |
| path: dist/*.whl | |
| - name: Run post-build script | |
| run: | | |
| bash packaging/post_build_script.sh | |
| - name: List wheel contents | |
| run: | | |
| wheel_path=$(find dist -type f -name "*.whl") | |
| echo "Wheel path: $wheel_path" | |
| unzip -l $wheel_path | |
| test-paddlecodec-wheel: | |
| needs: build-paddlecodec-wheel | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] | |
| ffmpeg-version: ["4.4.2", "5.1.2", "6.1.1", "7.0.1", "8.0"] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Download wheel artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: paddlecodec-wheel-linux-py${{ matrix.python-version }} | |
| path: dist/ | |
| - name: Install FFmpeg via conda | |
| uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| auto-update-conda: true | |
| miniforge-version: latest | |
| activate-environment: test | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install FFmpeg from conda-forge | |
| run: | | |
| conda install "ffmpeg=${{ matrix.ffmpeg-version }}" -c conda-forge -y | |
| ffmpeg -version | |
| - name: Install PaddlePaddle nightly in conda env | |
| run: | | |
| pip install --pre paddlepaddle -i https://www.paddlepaddle.org.cn/packages/nightly/cpu/ | |
| - name: Install paddlecodec from wheel | |
| run: | | |
| wheel_path=$(find dist -type f -name "*.whl") | |
| echo "Installing $wheel_path" | |
| pip install $wheel_path -vvv | |
| - name: Install test dependencies | |
| run: | | |
| pip install numpy pytest pillow | |
| - name: Delete src folder | |
| run: | | |
| # Delete src/ to ensure we're testing the installed wheel, not source code | |
| rm -rf src/ | |
| ls -la | |
| - name: Run tests | |
| run: | | |
| pytest --override-ini="addopts=-v" -s test_paddle |