Compile, Test, and Deploy #544
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: Compile, Test, and Deploy | |
| on: | |
| pull_request: {} | |
| workflow_dispatch: {} # Allow manual trigger | |
| release: | |
| types: [published] | |
| jobs: | |
| build-ubuntu: | |
| runs-on: ubuntu-22.04 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - { python-version: "3.11", pythonLibPath: "/opt/python/cp311-cp311/lib", pythonInclude: "/opt/python/cp311-cp311/include/python3.11", cibwbuild: "cp311-manylinux_x86_64"} | |
| - { python-version: "3.12", pythonLibPath: "/opt/python/cp312-cp312/lib", pythonInclude: "/opt/python/cp312-cp312/include/python3.12", cibwbuild: "cp312-manylinux_x86_64"} | |
| - { python-version: "3.13", pythonLibPath: "/opt/python/cp313-cp313/lib", pythonInclude: "/opt/python/cp313-cp313/include/python3.13", cibwbuild: "cp313-manylinux_x86_64"} | |
| - { python-version: "3.14", pythonLibPath: "/opt/python/cp314-cp314/lib", pythonInclude: "/opt/python/cp314-cp314/include/python3.14", cibwbuild: "cp314-manylinux_x86_64"} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| submodules: recursive | |
| - name: Set up QEMU for aarch64 on Linux | |
| # if: endsWith(${{matrix.cibwbuild}}, "aarch64") | |
| if: runner.os == 'Linux' | |
| uses: docker/setup-qemu-action@v3 | |
| with: | |
| platforms: all | |
| - name: clean faust libraries | |
| run: | | |
| rm -rf dawdreamer/faustlibraries/.git | |
| rm thirdparty/faust/architecture/android/app/lib/libsndfile/lib/armeabi-v7a/libsndfile.so | |
| rm thirdparty/faust/architecture/android/app/lib/libsndfile/lib/arm64-v8a/libsndfile.so | |
| - name: Download libfaust | |
| run: | | |
| cd thirdparty/libfaust | |
| python download_libfaust.py | |
| - name: Build wheels | |
| uses: pypa/[email protected] | |
| env: | |
| CIBW_PLATFORM: linux | |
| CIBW_BUILD: ${{ matrix.cibwbuild }} | |
| CIBW_ENABLE: all | |
| CIBW_BUILD_VERBOSITY: 3 | |
| CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux_2_34_x86_64 | |
| CIBW_MANYLINUX_AARCH64_IMAGE: quay.io/pypa/manylinux_2_34_aarch64 | |
| CIBW_BEFORE_BUILD_LINUX: | |
| export PYTHONLIBPATH=${{ matrix.pythonLibPath }} && export PYTHONINCLUDEPATH=${{ matrix.pythonInclude }} && sh -v build_linux.sh | |
| CIBW_REPAIR_WHEEL_COMMAND_LINUX: > | |
| LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/dawdreamer:$PWD/thirdparty/libfaust/ubuntu-x86_64/Release/lib && pip install auditwheel-symbols && (auditwheel repair -w {dest_dir} {wheel} || auditwheel-symbols --manylinux 2_34 {wheel}) | |
| CIBW_TEST_REQUIRES: -r test-requirements.txt soundfile | |
| CIBW_TEST_COMMAND: "rm -rf dawdreamer/*.so* && cd {project}/tests && python -m pytest -v . --ignore=test_jax.py" | |
| CIBW_ARCHS: auto64 | |
| CIBW_ARCHS_LINUX: auto64 aarch64 # On an Linux Intel runner with qemu installed, build Intel and ARM wheels | |
| CIBW_TEST_SKIP: "*arm64* *314*" # Skip ARM64 tests and Python 3.13/3.14 tests until stable | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: artifact-${{ matrix.cibwbuild}} | |
| path: ./wheelhouse/*.whl | |
| build-ubuntu-docker: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| submodules: recursive | |
| - name: Build Docker image | |
| run: docker build -t dawdreamer . | |
| build-windows: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - { os: windows-2022, python-version: "3.11", CIBW-BUILD: "cp311*"} | |
| - { os: windows-2022, python-version: "3.12", CIBW-BUILD: "cp312*"} | |
| - { os: windows-2022, python-version: "3.13", CIBW-BUILD: "cp313*"} | |
| - { os: windows-2022, python-version: "3.14", CIBW-BUILD: "cp314*"} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| submodules: recursive | |
| - name: Setup Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Add msbuild to PATH | |
| uses: microsoft/setup-msbuild@v2 | |
| - name: Get CMake | |
| uses: lukka/get-cmake@latest | |
| - name: clean faust libraries | |
| run: | | |
| Remove-Item -Recurse -Force "dawdreamer/faustlibraries/.git" | |
| - name: Download libfaust | |
| shell: cmd | |
| run: | | |
| cd thirdparty/libfaust | |
| python download_libfaust.py | |
| - name: Build libsamplerate | |
| run: | | |
| cd thirdparty/libsamplerate | |
| cmake -DCMAKE_BUILD_TYPE=Release -Bbuild_release | |
| cd build_release | |
| msbuild libsamplerate.sln /property:Configuration=Release | |
| - name: Build Windows (Release) | |
| run: | | |
| msbuild Builds/VisualStudio2022/DawDreamer.sln /property:Configuration=Release | |
| - name: Install cibuildwheel | |
| run: python -m pip install cibuildwheel | |
| - name: Build Wheels | |
| run: | | |
| python -m cibuildwheel --output-dir wheelhouse | |
| env: | |
| PYTHONMAJOR: ${{ matrix.python-version }} | |
| CIBW_BUILD_VERBOSITY: 1 | |
| CIBW_TEST_REQUIRES: -r test-requirements.txt | |
| CIBW_TEST_COMMAND: "cd /D {project}\\tests && python -m pytest -v ." | |
| CIBW_ARCHS: auto64 | |
| CIBW_BUILD: ${{matrix.CIBW-BUILD}} | |
| CIBW_ENABLE: all | |
| CIBW_TEST_SKIP: "*314*" # Skip Python 3.14 tests until stable | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: artifact-windows-${{ matrix.python-version}} | |
| path: ./wheelhouse/*.whl | |
| build-macos: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # Apple Silicon only | |
| - { os: macos-14, build: cp311-macosx_arm64, python-version: "3.11", ARCHS: "arm64" } | |
| - { os: macos-14, build: cp312-macosx_arm64, python-version: "3.12", ARCHS: "arm64" } | |
| - { os: macos-14, build: cp313-macosx_arm64, python-version: "3.13", ARCHS: "arm64" } | |
| - { os: macos-14, build: cp314-macosx_arm64, python-version: "3.14", ARCHS: "arm64" } | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| submodules: recursive | |
| - name: Get CMake | |
| uses: lukka/get-cmake@latest | |
| - name: Build libsamplerate | |
| run: | | |
| cd thirdparty/libsamplerate | |
| cmake -DCMAKE_BUILD_TYPE=Release -Bbuild_release -DCMAKE_OSX_ARCHITECTURES="${{matrix.ARCHS}}" -DLIBSAMPLERATE_EXAMPLES=off -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 | |
| make --directory=build_release | |
| cd ../.. | |
| - name: clean faust libraries | |
| run: | | |
| rm -rf dawdreamer/faustlibraries/.git | |
| - name: Download libfaust | |
| run: | | |
| cd thirdparty/libfaust | |
| python download_libfaust.py | |
| - name: Build wheels ${{ matrix.python-version }} | |
| uses: pypa/[email protected] | |
| env: | |
| # note that the Projucer project refers to PYTHONMAJOR and pythonLocation, so they must be set here | |
| PYTHONMAJOR: ${{ matrix.python-version }} | |
| MACOSX_DEPLOYMENT_TARGET: 11.0 | |
| CIBW_BUILD_VERBOSITY: 1 | |
| CIBW_BEFORE_BUILD: | | |
| export pythonLocation=$(python${{matrix.python-version}}-config --prefix) | |
| otool -L $pythonLocation/bin/python3 | |
| xcodebuild ARCHS="${{matrix.ARCHS}}" ONLY_ACTIVE_ARCH=NO -configuration Release-${{matrix.ARCHS}} -project Builds/MacOSX/DawDreamer.xcodeproj/ CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED="NO" CODE_SIGN_ENTITLEMENTS="" CODE_SIGNING_ALLOWED="NO" | |
| cd Builds/MacOSX/build/Release-${{matrix.ARCHS}} | |
| mv dawdreamer.so.dylib dawdreamer.so | |
| CIBW_TEST_REQUIRES: -r test-requirements.txt | |
| CIBW_TEST_COMMAND: "cd {project}/tests; python -m pytest -v ." | |
| CIBW_BUILD: ${{matrix.build}} | |
| CIBW_ENABLE: all | |
| CIBW_ARCHS: arm64 | |
| CIBW_ARCHS_MACOS: arm64 | |
| CIBW_ENVIRONMENT_MACOS: ARCHS="arm64" | |
| CIBW_TEST_SKIP: "*314*" # Skip Python 3.14 tests until stable | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: artifact-macos-${{ matrix.build}} | |
| path: ./wheelhouse/*.whl | |
| upload-pypi: | |
| needs: [build-windows, build-ubuntu, build-macos] | |
| runs-on: ubuntu-latest | |
| name: "Upload wheels to PyPI" | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| pattern: artifact-* | |
| merge-multiple: true | |
| path: dist | |
| - uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| user: __token__ | |
| password: ${{ secrets.PYPI_API_TOKEN }} |