Skip to content

Commit

Permalink
CI setup (#3): Building and testing on all platforms
Browse files Browse the repository at this point in the history
* Create python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Add SAF submodule

* Adapt build path to reflect submodule

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Change branch in SAF

* Add develop branch to SAF

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Link saf_performance lib explicitly

* Split into two jobs

* Update python-safpy.yml

* Revert needs same job

* CI: run python version matrix

* CI: Use Python versions

* CI: Introduce macOS

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update Spatial_Audio_Framework

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update Spatial_Audio_Framework

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Introduce MSVC complex type to safpy_build.py

* Move complex typedef in safpy_build.py

* Use _Complex in safpy_build.py

* Revert "Use _Complex in safpy_build.py"

This reverts commit b0d91dc.

* Revert "Move complex typedef in safpy_build.py"

This reverts commit d5b0844.

* Revert "Introduce MSVC complex type to safpy_build.py"

This reverts commit b5e598c.

* Use Ninja on Windows

* Same test run for all

* Update python-safpy.yml

* Update python-safpy.yml

* Update python-safpy.yml

* Update safpy_build.py

* Update python-safpy.yml

* Link only openBLAS

* Update safpy_build.py

* Safpy_build: switch typedef complex on win32

* CI: use msvc again

* Update python-safpy.yml

* Update safpy_build.py

* Trying to use the native _Complex

* Update safpy_build.py

* Revert "Trying to use the native _Complex"

This reverts commit 6932d60.

* Trying typedef struct float_complex

* Update safpy_build.py

* Update safpy_build.py

* Update safpy_build.py

* Copy openblas on windows to safpy folder

* Update python-safpy.yml

* Update python-safpy.yml

* More defaults for win and openblas

* Update python-safpy.yml

* Update Spatial_Audio_Framework

* Cleanup
  • Loading branch information
chris-hld authored Feb 6, 2024
1 parent 0d646b7 commit 76247b5
Showing 1 changed file with 61 additions and 18 deletions.
79 changes: 61 additions & 18 deletions .github/workflows/python-safpy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,42 +14,82 @@ permissions:

jobs:
build-and-test:
runs-on: ubuntu-latest

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 3.10
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
python-version: ${{ matrix.python-version }}
- name: Install Python package dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install cffi numpy spaudiopy
- name: Checkout submodules
run: git submodule update --init --recursive

- name: Dependency packages
run: |
sudo apt-get update && sudo apt-get install libsndfile1 liblapack3 liblapack-dev libopenblas-base libopenblas-dev liblapacke-dev
sudo ldconfig
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
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
cp ./OpenBLAS/lib/libopenblas.lib $GITHUB_WORKSPACE
cp ./OpenBLAS/bin/libopenblas.dll $GITHUB_WORKSPACE
echo "$GITHUB_WORKSPACE" >> $GITHUB_PATH
else
echo "$RUNNER_OS not supported"
exit 1
fi
shell: bash

- name: Configure CMake (Linux)
- 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
cmake -S ./Spatial_Audio_Framework/ -B ./Spatial_Audio_Framework/build -DSAF_PERFORMANCE_LIB=SAF_USE_OPEN_BLAS_AND_LAPACKE -DSAF_BUILD_EXAMPLES=0
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/ -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
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
run: |
ldd ./Spatial_Audio_Framework/build/test/saf_test
./Spatial_Audio_Framework/build/test/saf_test
if [ "$RUNNER_OS" != "Windows" ]; then
./Spatial_Audio_Framework/build/test/saf_test
else
cp ./Spatial_Audio_Framework/build/test/Debug/saf_test.exe ./Spatial_Audio_Framework/build/test/
cp ./Spatial_Audio_Framework/build/framework/Debug/saf.lib ./Spatial_Audio_Framework/build/framework/
./Spatial_Audio_Framework/build/test/saf_test.exe
fi
shell: bash

- name: Lint with flake8
run: |
Expand All @@ -58,8 +98,11 @@ jobs:
# 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 package
run: python setup.py build

- name: Build and install package
run: python -m pip install -e .

- name: Test with pytest
run: |
pytest -vvv
run: pytest -vvv

0 comments on commit 76247b5

Please sign in to comment.