Build wheels #37
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 | |
| on: | |
| push: | |
| branches: [master] | |
| paths: | |
| - 'src/**' | |
| pull_request: | |
| branches: [master] | |
| paths: | |
| - 'src/**' | |
| release: | |
| types: [published] | |
| permissions: | |
| contents: read | |
| jobs: | |
| build_wheels: | |
| name: Build wheels on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-13, macos-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Install CUDA | |
| if: matrix.os == 'windows-latest' | |
| uses: Jimver/cuda-toolkit@v0.2.23 | |
| id: cuda-toolkit | |
| with: | |
| method: 'network' | |
| sub-packages: '["nvcc", "cudart", "opencl"]' | |
| - name: Build wheels | |
| uses: pypa/cibuildwheel@v2.23.3 | |
| env: | |
| CIBW_PROJECT_REQUIRES_PYTHON: '>=3.8' | |
| if: matrix.os == 'macos-13' | |
| MACOSX_DEPLOYMENT_TARGET: '10.12' | |
| with: | |
| output-dir: wheelhouse | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pyanime4k-wheels-${{ matrix.os }} | |
| path: wheelhouse/*.whl | |
| build_sdist: | |
| name: Build source distribution | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: clone Anime4KCPP | |
| run: mkdir -p src/Anime4KCPP && git clone https://github.com/TianZerL/Anime4KCPP.git src/Anime4KCPP | |
| - name: Build sdist | |
| run: pipx run build --sdist | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: pyanime4k-sdist | |
| path: dist/*.tar.gz | |
| upload_all: | |
| name: Upload to pypi | |
| needs: [build_wheels, build_sdist] | |
| environment: pypi | |
| permissions: | |
| id-token: write | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| pattern: pyanime4k-* | |
| path: dist | |
| merge-multiple: true | |
| - uses: pypa/gh-action-pypi-publish@release/v1 |