Skip to content

CI setup

CI setup #46

Workflow file for this run

# 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
install openblas
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_OPEN_BLAS_AND_LAPACKE -DOPENBLAS_LIBRARY=/usr/local/opt/openblas/lib/libopenblas.dylib -DLAPACKE_LIBRARY=/usr/local/opt/openblas/lib/libopenblas.dylib -DOPENBLAS_HEADER_PATH=/usr/local/opt/openblas/include -DSAF_BUILD_EXAMPLES=0
fi
- name: Build SAF
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build ./Spatial_Audio_Framework/build
- name: Test SAF
run: |
ldd ./Spatial_Audio_Framework/build/test/saf_test
./Spatial_Audio_Framework/build/test/saf_test
- 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