Skip to content

Commit

Permalink
cherry picked stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
DBraun committed Sep 17, 2023
1 parent 90ba147 commit 11843ce
Show file tree
Hide file tree
Showing 31 changed files with 3,130 additions and 3,308 deletions.
300 changes: 146 additions & 154 deletions .github/workflows/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ jobs:
strategy:
matrix:
include:
# - { python-version: "3.7", pythonLibPath: "/opt/python/cp37-cp37m/lib", pythonInclude: "/opt/python/cp37-cp37m/include/python3.7m", cibwbuild: "cp37-manylinux_x86_64"}
# - { python-version: "3.8", pythonLibPath: "/opt/python/cp39-cp38/lib", pythonInclude: "/opt/python/cp38-cp38/include/python3.8", cibwbuild: "cp38-manylinux_x86_64"}
# - { python-version: "3.9", pythonLibPath: "/opt/python/cp39-cp39/lib", pythonInclude: "/opt/python/cp39-cp39/include/python3.9", cibwbuild: "cp39-manylinux_x86_64"}
- { python-version: "3.8", pythonLibPath: "/opt/python/cp39-cp38/lib", pythonInclude: "/opt/python/cp38-cp38/include/python3.8", cibwbuild: "cp38-manylinux_x86_64"}
- { python-version: "3.9", pythonLibPath: "/opt/python/cp39-cp39/lib", pythonInclude: "/opt/python/cp39-cp39/include/python3.9", cibwbuild: "cp39-manylinux_x86_64"}
- { python-version: "3.10", pythonLibPath: "/opt/python/cp310-cp310/lib", pythonInclude: "/opt/python/cp310-cp310/include/python3.10", cibwbuild: "cp310-manylinux_x86_64"}
# - { 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.7", pythonLibPath: "/opt/python/cp37-cp37m/lib", pythonInclude: "/opt/python/cp37-cp37m/include/python3.7m", cibwbuild: "cp37-manylinux_aarch64"}
- { 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.8", pythonLibPath: "/opt/python/cp39-cp38/lib", pythonInclude: "/opt/python/cp38-cp38/include/python3.8", cibwbuild: "cp38-manylinux_aarch64"}
# - { python-version: "3.9", pythonLibPath: "/opt/python/cp39-cp39/lib", pythonInclude: "/opt/python/cp39-cp39/include/python3.9", cibwbuild: "cp39-manylinux_aarch64"}
# - { python-version: "3.10", pythonLibPath: "/opt/python/cp310-cp310/lib", pythonInclude: "/opt/python/cp310-cp310/include/python3.10", cibwbuild: "cp310-manylinux_aarch64"}
# - { python-version: "3.11", pythonLibPath: "/opt/python/cp311-cp311/lib", pythonInclude: "/opt/python/cp311-cp311/include/python3.11", cibwbuild: "cp311-manylinux_aarch64"}

steps:
- uses: actions/checkout@v3
Expand All @@ -45,6 +44,7 @@ jobs:
cd thirdparty/libfaust
sh download_libfaust.sh
# todo: probably don't need to install Python
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
Expand All @@ -65,176 +65,168 @@ jobs:
CIBW_TEST_REQUIRES: -r test-requirements.txt soundfile jax[cpu] flax
CIBW_TEST_COMMAND: "rm -rf dawdreamer/*.so* && cd {project}/tests && python -m pytest -v ."
CIBW_ARCHS: auto64
CIBW_ARCHS_LINUX: "auto aarch64" # On an Linux Intel runner with qemu installed, build Intel and ARM wheels
CIBW_TEST_SKIP: "*311*"
CIBW_ARCHS_LINUX: auto64 aarch64 # On an Linux Intel runner with qemu installed, build Intel and ARM wheels
CIBW_TEST_SKIP: "*38* *39* *311*" # Only care about 310 (current Google Colab version)

- uses: actions/upload-artifact@v3
with:
name: my-wheel-artifact
path: ./wheelhouse/*.whl

build-windows:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- { os: windows-2022, python-version: "3.8", CIBW-BUILD: "cp38*"}
- { os: windows-2022, python-version: "3.9", CIBW-BUILD: "cp39*"}
- { os: windows-2022, python-version: "3.10", CIBW-BUILD: "cp310*"}
- { os: windows-2022, python-version: "3.11", CIBW-BUILD: "cp311*"}

steps:
- uses: actions/checkout@v3
with:
submodules: true

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Add msbuild to PATH
uses: microsoft/[email protected]

- 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
call download_libfaust.bat
- 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}}

- uses: actions/upload-artifact@v3
with:
name: my-wheel-artifact
path: ./wheelhouse/*.whl

- name: "Build docs for GitHub pages"
if: ${{ matrix.python-version == '3.8' && github.event_name == 'release' && github.event.action == 'published' }}
shell: cmd
run: |
pip install -U sphinx
cd docs && make.bat html
- name: Deploy docs
uses: peaceiris/actions-gh-pages@v3
# todo: make condition for being on main branch
if: ${{ matrix.python-version == '3.8' && github.event_name == 'release' && github.event.action == 'published' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_build/html

build-ubuntu-docker:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
submodules: true

- name: Build Docker image
run: docker build -t dawdreamer .

build-macos:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- { python-version: "3.9"}
- { os: macos-11, build: cp39-macosx_x86_64, python-version: "3.9", ARCHS: "x86_64" }
- { os: macos-11, build: cp310-macosx_x86_64, python-version: "3.10", ARCHS: "x86_64" }
- { os: macos-11, build: cp311-macosx_x86_64, python-version: "3.11", ARCHS: "x86_64" }
- { os: macos-11, build: cp39-macosx_arm64, python-version: "3.9", ARCHS: "arm64" }
- { os: macos-11, build: cp310-macosx_arm64, python-version: "3.10", ARCHS: "arm64" }
- { os: macos-11, build: cp311-macosx_arm64, python-version: "3.11", ARCHS: "arm64" }

steps:
- uses: actions/checkout@v3
with:
submodules: true

- name: Build Docker image
run: docker build -t dawdreamer .
- 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 ../..
# build-windows:
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# include:
# - { os: windows-2022, python-version: "3.7", CIBW-BUILD: "cp37*"}
# - { os: windows-2022, python-version: "3.8", CIBW-BUILD: "cp38*"}
# - { os: windows-2022, python-version: "3.9", CIBW-BUILD: "cp39*"}
# - { os: windows-2022, python-version: "3.10", CIBW-BUILD: "cp310*"}
# - { os: windows-2022, python-version: "3.11", CIBW-BUILD: "cp311*"}

# steps:
# - uses: actions/checkout@v3
# with:
# submodules: true

# - name: Setup Python ${{ matrix.python-version }}
# uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python-version }}

# - name: Add msbuild to PATH
# uses: microsoft/[email protected]

# - 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
# call download_libfaust.bat

# - 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}}

# - uses: actions/upload-artifact@v3
# with:
# name: my-wheel-artifact
# path: ./wheelhouse/*.whl

# - name: "Build docs for GitHub pages"
# if: ${{ matrix.python-version == '3.8' && github.event_name == 'release' && github.event.action == 'published' }}
# shell: cmd
# run: |
# pip install -U sphinx
# cd docs && make.bat html
# - name: Deploy docs
# uses: peaceiris/actions-gh-pages@v3
# # todo: make condition for being on main branch
# if: ${{ matrix.python-version == '3.8' && github.event_name == 'release' && github.event.action == 'published' }}
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# publish_dir: ./docs/_build/html

# build-macos:
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# include:
# - { os: macos-11, build: cp39-macosx_x86_64, python-version: "3.9", ARCHS: "x86_64" }
# - { os: macos-11, build: cp310-macosx_x86_64, python-version: "3.10", ARCHS: "x86_64" }
# - { os: macos-11, build: cp311-macosx_x86_64, python-version: "3.11", ARCHS: "x86_64" }
# - { os: macos-11, build: cp39-macosx_arm64, python-version: "3.9", ARCHS: "arm64" }
# - { os: macos-11, build: cp310-macosx_arm64, python-version: "3.10", ARCHS: "arm64" }
# - { os: macos-11, build: cp311-macosx_arm64, python-version: "3.11", ARCHS: "arm64" }

# steps:
# - uses: actions/checkout@v3
# with:
# submodules: true

# - 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
# sh download_libfaust.sh

# - 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=$(python3-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_ARCHS: auto64
# CIBW_ARCHS_MACOS: ${{matrix.ARCHS}}
# CIBW_ENVIRONMENT_MACOS: ARCHS="${{matrix.ARCHS}}"
# # todo: want to test Python 3.11
# CIBW_TEST_SKIP: "*311* *arm64*"

# - uses: actions/upload-artifact@v3
# with:
# name: my-wheel-artifact
# path: ./wheelhouse/*.whl
- name: clean faust libraries
run: |
rm -rf dawdreamer/faustlibraries/.git
- name: Download libfaust
run: |
cd thirdparty/libfaust
sh download_libfaust.sh
- 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=$(python3-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 jax[cpu] flax
CIBW_TEST_COMMAND: "cd {project}/tests; python -m pytest -v ."
CIBW_BUILD: ${{matrix.build}}
CIBW_ARCHS: auto64
CIBW_ARCHS_MACOS: ${{matrix.ARCHS}}
CIBW_ENVIRONMENT_MACOS: ARCHS="${{matrix.ARCHS}}"
CIBW_TEST_SKIP: "*311* *arm64*" # Skip 311 because some vst effects output silence on GitHub Actions only

- uses: actions/upload-artifact@v3
with:
name: my-wheel-artifact
path: ./wheelhouse/*.whl

upload-pypi:
needs: [build-ubuntu]
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'
Expand Down
Loading

0 comments on commit 11843ce

Please sign in to comment.