[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/
# IDE & editors
# PyCharm
.idea/
# Emacs backup files patterns
# Emacs
\#*\#
.\#*
*~

View File

@ -3,18 +3,44 @@ language: python
branches:
only:
- master
- /\d+\.\d+\.\d+(-\S+)?$/
- /\d+\.\d+\.\d+$/
env:
global:
- TWINE_USERNAME=__token__
- MACOSX_DEPLOYMENT_TARGET=10.9
- 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_COMMAND_MACOS="tox -c /Users/travis/build/McSinyx/palace"
- 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:
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
env: CIBW_BUILD=cp36-manylinux_x86_64
- services: docker
@ -22,8 +48,6 @@ jobs:
- services: docker
env: CIBW_BUILD=cp38-manylinux_x86_64
install: pip install twine cibuildwheel
script: cibuildwheel --output-dir=dist
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
Wheel distribution is only built for GNU/Linux on amd64 at the time of writing.
If you want to help out, please head to our GitHub issues [#1][GH-1].
Wheel distributions are only built for GNU/Linux and macOS on amd64
at the time of writing. If you want to help out, please head to
GitHub issue [#1][GH-1].
### From source
Aside from the build dependencies listed in `pyproject.toml`, one will

View File

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

View File

@ -21,6 +21,7 @@ import re
from distutils.dir_util import mkpath
from distutils.file_util import copy_file
from operator import methodcaller
from os import environ
from os.path import dirname, join
from subprocess import DEVNULL, PIPE, run
@ -28,6 +29,13 @@ from Cython.Build import cythonize
from setuptools import setup, Extension
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):
"""Builder of extensions linked to alure2."""
@ -51,7 +59,8 @@ class BuildAlure2Ext(build_ext):
setup(cmdclass={'build_ext': BuildAlure2Ext},
ext_modules=cythonize(
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',
c_string_encoding='utf8', linetrace=True,
binding=False, embedsignature=True)))

View File

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