CI setup #65
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
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=/d/a/SAFpy/SAFpy/OpenBLAS/lib/libopenblas.dll -DLAPACKE_LIBRARY=/d/a/SAFpy/SAFpy/OpenBLAS/lib/libopenblas.dll -DOPENBLAS_HEADER_PATH=/d/a/SAFpy/SAFpy/OpenBLAS/include/ -DHAVE_LAPACK_CONFIG_H -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 | |
run: | | |
./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 |