1
1
Fork 0
mirror of https://github.com/McSinyx/palace synced 2023-12-14 09:02:59 +01:00

[Travis] Build for macOS

Also enable Cython trace explicitly for tests
This commit is contained in:
Nguyễn Gia Phong 2020-03-01 10:59:05 +07:00
parent 51a72e94f9
commit 428a436f36
9 changed files with 72 additions and 29 deletions

7
.ci/before-build-macos Executable file
View file

@ -0,0 +1,7 @@
#!/bin/sh
set -ev
git clone --depth 1 https://github.com/kcat/alure /tmp/alure
cd /tmp/alure/build
OPENALDIR=$(brew --prefix openal-soft) cmake -DCMAKE_FIND_FRAMEWORK=NEVER ..
cmake --build . --config Release
sudo cmake --install .

16
.ci/before-build-manylinux2014 Executable file
View file

@ -0,0 +1,16 @@
#!/bin/sh
set -ev
yum install -y git cmake pulseaudio \
alsa-lib-devel pulseaudio-libs-devel jack-audio-connection-kit-devel \
libvorbis-devel opusfile-devel libsndfile-devel
pulseaudio --start
pip install cmake>=3.13
git clone --depth 1 https://github.com/kcat/openal-soft
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -S openal-soft -B openal-soft/build
cmake --build openal-soft/build --parallel `nproc` --target install
git clone --depth 1 https://github.com/kcat/alure
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -S alure -B alure/build
cmake --build alure/build --parallel `nproc` --target install
pip uninstall -y cmake

7
.gitignore vendored
View file

@ -131,7 +131,10 @@ dmypy.json
# Pyre type checker # Pyre type checker
.pyre/ .pyre/
# IDE & editors # PyCharm
.idea/ .idea/
# Emacs backup files patterns
# Emacs
\#*\# \#*\#
.\#*
*~

View file

@ -3,18 +3,44 @@ language: python
branches: branches:
only: only:
- master - master
- /\d+\.\d+\.\d+(-\S+)?$/ - /\d+\.\d+\.\d+$/
env: env:
global: global:
- TWINE_USERNAME=__token__ - TWINE_USERNAME=__token__
- MACOSX_DEPLOYMENT_TARGET=10.9
- CIBW_MANYLINUX_X86_64_IMAGE=manylinux2014 - CIBW_MANYLINUX_X86_64_IMAGE=manylinux2014
- CIBW_BEFORE_BUILD_LINUX=.travis/cibw-before-build-manylinux2014 - CIBW_BEFORE_BUILD_LINUX=.ci/before-build-manylinux2014
- CIBW_BEFORE_BUILD_MACOS=.ci/before-build-macos
- CIBW_TEST_REQUIRES=tox - CIBW_TEST_REQUIRES=tox
- CIBW_TEST_COMMAND_MACOS="tox -c /Users/travis/build/McSinyx/palace"
- CIBW_TEST_COMMAND_LINUX="tox -c /project" - CIBW_TEST_COMMAND_LINUX="tox -c /project"
addons:
homebrew:
packages:
- openal-soft
- libvorbis
- opusfile
- libsndfile
update: true
install: pip install twine cibuildwheel
git:
depth: 1
jobs: jobs:
include: include:
- os: osx
language: shell
env: CIBW_BUILD=cp36-macosx*
- os: osx
language: shell
env: CIBW_BUILD=cp37-macosx*
- os: osx
language: shell
env: CIBW_BUILD=cp38-macosx*
- services: docker - services: docker
env: CIBW_BUILD=cp36-manylinux_x86_64 env: CIBW_BUILD=cp36-manylinux_x86_64
- services: docker - services: docker
@ -22,8 +48,6 @@ jobs:
- services: docker - services: docker
env: CIBW_BUILD=cp38-manylinux_x86_64 env: CIBW_BUILD=cp38-manylinux_x86_64
install: pip install twine cibuildwheel
script: cibuildwheel --output-dir=dist script: cibuildwheel --output-dir=dist
deploy: deploy:

View file

@ -1,19 +0,0 @@
#!/bin/sh
if [ ! -d openal-soft ]
then
yum install -y git cmake pulseaudio \
alsa-lib-devel pulseaudio-libs-devel jack-audio-connection-kit-devel \
libvorbis-devel opusfile-devel libsndfile-devel
pip install cmake>=3
git clone https://github.com/kcat/openal-soft
cd openal-soft/build
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr ..
cmake --build . --parallel `nproc` --target install --config Release
git clone https://github.com/kcat/alure
mkdir alure/build
cd alure/build
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr ..
cmake --build . --parallel `nproc` --target install --config Release
pip uninstall -y cmake
pulseaudio --start
fi

View file

@ -27,8 +27,9 @@ Palace can be install from the [Python Package Index][PyPI] via simply
pip install palace pip install palace
Wheel distribution is only built for GNU/Linux on amd64 at the time of writing. Wheel distributions are only built for GNU/Linux and macOS on amd64
If you want to help out, please head to our GitHub issues [#1][GH-1]. at the time of writing. If you want to help out, please head to
GitHub issue [#1][GH-1].
### From source ### From source
Aside from the build dependencies listed in `pyproject.toml`, one will Aside from the build dependencies listed in `pyproject.toml`, one will

View file

@ -1,6 +1,6 @@
[metadata] [metadata]
name = palace name = palace
version = 0.0.10 version = 0.0.11
url = https://github.com/McSinyx/palace url = https://github.com/McSinyx/palace
author = Nguyễn Gia Phong author = Nguyễn Gia Phong
author_email = vn.mcsinyx@gmail.com author_email = vn.mcsinyx@gmail.com

View file

@ -21,6 +21,7 @@ import re
from distutils.dir_util import mkpath from distutils.dir_util import mkpath
from distutils.file_util import copy_file from distutils.file_util import copy_file
from operator import methodcaller from operator import methodcaller
from os import environ
from os.path import dirname, join from os.path import dirname, join
from subprocess import DEVNULL, PIPE, run from subprocess import DEVNULL, PIPE, run
@ -28,6 +29,13 @@ from Cython.Build import cythonize
from setuptools import setup, Extension from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext from setuptools.command.build_ext import build_ext
try:
CYTHON_TRACE = int(environ['CYTHON_TRACE'])
except KeyError:
CYTHON_TRACE = 0
except ValueError:
CYTHON_TRACE = 0
class BuildAlure2Ext(build_ext): class BuildAlure2Ext(build_ext):
"""Builder of extensions linked to alure2.""" """Builder of extensions linked to alure2."""
@ -51,7 +59,8 @@ class BuildAlure2Ext(build_ext):
setup(cmdclass={'build_ext': BuildAlure2Ext}, setup(cmdclass={'build_ext': BuildAlure2Ext},
ext_modules=cythonize( ext_modules=cythonize(
Extension(name='palace', sources=[join('src', 'palace.pyx')], Extension(name='palace', sources=[join('src', 'palace.pyx')],
language='c++', define_macros=[('CYTHON_TRACE', 1)]), define_macros=[('CYTHON_TRACE', CYTHON_TRACE)],
extra_compile_args=["-std=c++11"], language='c++'),
compiler_directives=dict(language_level='3str', c_string_type='str', compiler_directives=dict(language_level='3str', c_string_type='str',
c_string_encoding='utf8', linetrace=True, c_string_encoding='utf8', linetrace=True,
binding=False, embedsignature=True))) binding=False, embedsignature=True)))

View file

@ -4,6 +4,8 @@ minversion = 3.3
isolated_build = true isolated_build = true
[testenv] [testenv]
setenv =
CYTHON_TRACE = 1
deps = deps =
flake8 flake8
Cython Cython