-
Notifications
You must be signed in to change notification settings - Fork 3
111 lines (97 loc) · 4.46 KB
/
python-safpy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python application
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
permissions:
contents: read
jobs:
build-and-test:
name: Test on ${{ matrix.os }} with Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
python-version: ["3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install Python package dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install cffi numpy spaudiopy
- name: Checkout submodules
run: git submodule update --init --recursive --depth=1
- name: Install system dependencies
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get update && sudo apt-get install libsndfile1 liblapack3 liblapack-dev libopenblas-base libopenblas-dev liblapacke-dev
sudo ldconfig
elif [ "$RUNNER_OS" == "macOS" ]; then
brew install openblas
elif [ "$RUNNER_OS" == "Windows" ]; then
choco install ninja
curl https://github.com/OpenMathLib/OpenBLAS/releases/download/v0.3.26/OpenBLAS-0.3.26-x64.zip -L -o tmp.zip
7z x ./tmp.zip -oOpenBLAS
ls
echo $PWD
else
echo "$RUNNER_OS not supported"
exit 1
fi
shell: bash
- name: Configure CMake
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: |
cmake -E make_directory ./Spatial_Audio_Framework/build
if [ "$RUNNER_OS" == "Linux" ]; then
cmake -S ./Spatial_Audio_Framework/ -B ./Spatial_Audio_Framework/build -DSAF_PERFORMANCE_LIB=SAF_USE_OPEN_BLAS_AND_LAPACKE -DSAF_BUILD_EXAMPLES=0
elif [ "$RUNNER_OS" == "macOS" ]; then
cmake -S ./Spatial_Audio_Framework/ -B ./Spatial_Audio_Framework/build -DSAF_PERFORMANCE_LIB=SAF_USE_APPLE_ACCELERATE -DSAF_BUILD_EXAMPLES=0
elif [ "$RUNNER_OS" == "Windows" ]; then
cmake -S ./Spatial_Audio_Framework/ -B ./Spatial_Audio_Framework/build -DSAF_PERFORMANCE_LIB=SAF_USE_OPEN_BLAS_AND_LAPACKE -DOPENBLAS_LIBRARY=$GITHUB_WORKSPACE/OpenBLAS/lib/libopenblas.lib -DLAPACKE_LIBRARY=$GITHUB_WORKSPACE/OpenBLAS/lib/libopenblas.lib -DOPENBLAS_HEADER_PATH=$GITHUB_WORKSPACE/OpenBLAS/include/ -GNinja -DSAF_BUILD_EXAMPLES=0
fi
shell: bash
- name: Build SAF
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build ./Spatial_Audio_Framework/build -j2
- name: Print shared object dependencies
if: ${{ contains( runner.os, 'Linux' ) }}
run: ldd ./Spatial_Audio_Framework/build/test/saf_test
- name: Test SAF
if: runner.os != 'Windows'
run: |
ls -lh ./Spatial_Audio_Framework/build/test
./Spatial_Audio_Framework/build/test/saf_test
shell: bash
- name: Test SAF (Windows)
if: runner.os == 'Windows'
run: |
cp ./Spatial_Audio_Framework/build/framework/Debug/saf.lib ./Spatial_Audio_Framework/build/framework/
cp ./Spatial_Audio_Framework/build/test/Debug/saf_test.exe ./Spatial_Audio_Framework/build/test/
cd ./Spatial_Audio_Framework/build/test/
ls -lh
./saf_test.exe
cd $GITHUB_WORKSPACE
shell: bash
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Build and install package
run: python -m pip install -e .
- name: Test with pytest
run: |
pytest -vvv