Skip to content

Commit

Permalink
fix c# binding for linux and macos, add CI tests (#685)
Browse files Browse the repository at this point in the history
* move to net7 for examples

Signed-off-by: Andrey Parfenov <a1994ndrey@gmail.com>
  • Loading branch information
Andrey1994 committed Nov 8, 2023
1 parent 8305c60 commit 70b378c
Show file tree
Hide file tree
Showing 20 changed files with 306 additions and 1,090 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/run_unix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ jobs:
run: if [ $GITHUB_REF_TYPE == "tag" ]; then echo "::set-output name=version::$GITHUB_REF_NAME"; else echo "::set-output name=version::$GITHUB_SHA"; fi
- name: Check Version
run: echo ${{ steps.version.outputs.version }}
- name: Install dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
- name: Install Python 3.7
uses: actions/setup-python@v3
with:
Expand Down Expand Up @@ -94,6 +98,11 @@ jobs:
docker run -e BRAINFLOW_VERSION=$BRAINFLOW_VERSION -e GITHUB_WORKSPACE=$GITHUB_WORKSPACE -v $GITHUB_WORKSPACE:$GITHUB_WORKSPACE dockcross/manylinux2014-x64:20210708-94745ff /bin/bash -c "yum install -y bluez-libs-devel dbus-devel && /opt/python/cp36-cp36m/bin/pip3.6 install cmake==3.21.4 && cd $GITHUB_WORKSPACE && mkdir build_docker && cd build_docker && /opt/_internal/cpython-3.6.14/bin/cmake -DBRAINFLOW_VERSION=$BRAINFLOW_VERSION -DBUILD_ONNX=ON -DBUILD_BLE=ON -DBUILD_BLUETOOTH=ON -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/installed_docker -DCMAKE_BUILD_TYPE=Release .. && make && make install"
env:
BRAINFLOW_VERSION: ${{ steps.version.outputs.version }}
- name: C# build
run: |
cd $GITHUB_WORKSPACE/csharp_package/brainflow
dotnet restore brainflow.sln
dotnet build brainflow.sln -c Release
- name: Setup Python Package
run: |
cd $GITHUB_WORKSPACE/python_package
Expand Down Expand Up @@ -144,6 +153,46 @@ jobs:
# start testing
- name: Run unit tests
run: $GITHUB_WORKSPACE/build/tests/brainflow_tests
- name: Synthetic C# Test MacOS
if: (matrix.os == 'macos-11.0')
run: |
cd $GITHUB_WORKSPACE/csharp_package/brainflow/examples/brainflow_get_data/bin/Release/net7.0
cp $GITHUB_WORKSPACE/installed/lib/libBoardController.dylib $GITHUB_WORKSPACE/csharp_package/brainflow/examples/brainflow_get_data/bin/Release/net7.0/
./brainflow_get_data --board-id -1
env:
DYLD_PRINT_LIBRARIES: 1
LD_LIBRARY_PATH: ${{ github.workspace }}/installed/lib
DYLD_LIBRARY_PATH: ${{ github.workspace }}/installed/lib
- name: EEG Metrics C# Test MacOS
if: (matrix.os == 'macos-11.0')
run: |
cd $GITHUB_WORKSPACE/csharp_package/brainflow/examples/eeg_metrics/bin/Release/net7.0
cp $GITHUB_WORKSPACE/installed/lib/libBoardController.dylib $GITHUB_WORKSPACE/csharp_package/brainflow/examples/eeg_metrics/bin/Release/net7.0/
cp $GITHUB_WORKSPACE/installed/lib/libDataHandler.dylib $GITHUB_WORKSPACE/csharp_package/brainflow/examples/eeg_metrics/bin/Release/net7.0/
cp $GITHUB_WORKSPACE/installed/lib/libMLModule.dylib $GITHUB_WORKSPACE/csharp_package/brainflow/examples/eeg_metrics/bin/Release/net7.0/
./eeg_metrics --board-id -1
env:
DYLD_PRINT_LIBRARIES: 1
LD_LIBRARY_PATH: ${{ github.workspace }}/installed/lib
DYLD_LIBRARY_PATH: ${{ github.workspace }}/installed/lib
- name: Synthetic C# Test Ubuntu
if: (matrix.os == 'ubuntu-20.04')
run: |
cd $GITHUB_WORKSPACE/csharp_package/brainflow/examples/brainflow_get_data/bin/Release/net7.0
./brainflow_get_data --board-id -1
env:
DYLD_PRINT_LIBRARIES: 1
LD_LIBRARY_PATH: ${{ github.workspace }}/installed/lib
DYLD_LIBRARY_PATH: ${{ github.workspace }}/installed/lib
- name: EEG Metrics C# Test Ubuntu
if: (matrix.os == 'ubuntu-20.04')
run: |
cd $GITHUB_WORKSPACE/csharp_package/brainflow/examples/eeg_metrics/bin/Release/net7.0
./eeg_metrics --board-id -1
env:
DYLD_PRINT_LIBRARIES: 1
LD_LIBRARY_PATH: ${{ github.workspace }}/installed/lib
DYLD_LIBRARY_PATH: ${{ github.workspace }}/installed/lib
- name: Run All Julia Tests
run: |
export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/installed/lib:$LD_LIBRARY_PATH
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/run_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Install dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: '3.1.x'
dotnet-version: '7.0.x'
- name: Set Version
id: version
run: if ("tag" -eq $Env:GITHUB_REF_TYPE) { echo "::set-output name=version::$Env:GITHUB_REF_NAME" } else { echo "::set-output name=version::$Env:GITHUB_SHA" }
Expand Down Expand Up @@ -139,7 +139,7 @@ jobs:
run: python %GITHUB_WORKSPACE%\emulator\brainflow_emulator\cyton_windows.py %GITHUB_WORKSPACE%\cpp_package\examples\get_data\build\Release\brainflow_get_data.exe --board-id 0 --serial-port
shell: cmd
- name: Cyton Windows C# Test
run: python %GITHUB_WORKSPACE%\emulator\brainflow_emulator\cyton_windows.py %GITHUB_WORKSPACE%\csharp_package\brainflow\examples\brainflow_get_data\bin\Release\netcoreapp3.1\brainflow_get_data.exe --board-id 0 --serial-port
run: python %GITHUB_WORKSPACE%\emulator\brainflow_emulator\cyton_windows.py %GITHUB_WORKSPACE%\csharp_package\brainflow\examples\brainflow_get_data\bin\Release\net7.0\brainflow_get_data.exe --board-id 0 --serial-port
shell: cmd
- name: Synthetic Windows Python Test
run: python %GITHUB_WORKSPACE%\python_package\examples\tests\brainflow_get_data.py --board-id -1
Expand All @@ -159,7 +159,7 @@ jobs:
shell: cmd
- name: Synthetic Windows C# Test
run: |
cd %GITHUB_WORKSPACE%\csharp_package\brainflow\examples\brainflow_get_data\bin\Release\netcoreapp3.1\
cd %GITHUB_WORKSPACE%\csharp_package\brainflow\examples\brainflow_get_data\bin\Release\net7.0\
brainflow_get_data.exe --board-id -1
shell: cmd
- name: Cyton Daisy Windows Python Test
Expand All @@ -172,13 +172,13 @@ jobs:
run: python %GITHUB_WORKSPACE%\emulator\brainflow_emulator\cyton_windows.py %GITHUB_WORKSPACE%\cpp_package\examples\get_data\build\Release\brainflow_get_data.exe --board-id 2 --serial-port
shell: cmd
- name: Cyton Daisy Windows C# Test
run: python %GITHUB_WORKSPACE%\emulator\brainflow_emulator\cyton_windows.py %GITHUB_WORKSPACE%\csharp_package\brainflow\examples\brainflow_get_data\bin\Release\netcoreapp3.1\brainflow_get_data.exe --board-id 2 --serial-port
run: python %GITHUB_WORKSPACE%\emulator\brainflow_emulator\cyton_windows.py %GITHUB_WORKSPACE%\csharp_package\brainflow\examples\brainflow_get_data\bin\Release\net7.0\brainflow_get_data.exe --board-id 2 --serial-port
shell: cmd
- name: Galea Windows Cpp Test
run: python %GITHUB_WORKSPACE%\emulator\brainflow_emulator\galea_udp.py %GITHUB_WORKSPACE%\cpp_package\examples\get_data\build\Release\brainflow_get_data.exe --board-id 3 --ip-address 127.0.0.1
shell: cmd
- name: Galea Windows C# Test
run: python %GITHUB_WORKSPACE%\emulator\brainflow_emulator\galea_udp.py %GITHUB_WORKSPACE%\csharp_package\brainflow\examples\brainflow_get_data\bin\Release\netcoreapp3.1\brainflow_get_data.exe --board-id 3 --ip-address 127.0.0.1
run: python %GITHUB_WORKSPACE%\emulator\brainflow_emulator\galea_udp.py %GITHUB_WORKSPACE%\csharp_package\brainflow\examples\brainflow_get_data\bin\Release\net7.0\brainflow_get_data.exe --board-id 3 --ip-address 127.0.0.1
shell: cmd
- name: FreeEEG32 Python Test
run: python %GITHUB_WORKSPACE%\emulator\brainflow_emulator\freeeeg32_windows.py python %GITHUB_WORKSPACE%\python_package\examples\tests\brainflow_get_data.py --board-id 17 --serial-port
Expand Down Expand Up @@ -255,7 +255,7 @@ jobs:
run: .\cpp_package\examples\signal_processing\build\Release\serialization.exe
shell: cmd
- name: ICA C# Test
run: .\csharp_package\brainflow\examples\ica\bin\Release\netcoreapp3.1\ica.exe
run: .\csharp_package\brainflow\examples\ica\bin\Release\net7.0\ica.exe
shell: cmd
# Tests for MLModule
- name: EEG Metrics Python Test
Expand All @@ -271,10 +271,10 @@ jobs:
run: .\cpp_package\examples\ml\build32\Release\eeg_metrics_ci.exe --board-id -1 --metric 2 --classifier 2 --model-file %GITHUB_WORKSPACE%\src\ml\train\logreg_mindfulness.onnx
shell: cmd
- name: EEG Metrics C# Test
run: .\csharp_package\brainflow\examples\eeg_metrics\bin\Release\netcoreapp3.1\eeg_metrics.exe
run: .\csharp_package\brainflow\examples\eeg_metrics\bin\Release\net7.0\eeg_metrics.exe
shell: cmd
- name: EEG Metrics CI C# Test
run: .\csharp_package\brainflow\examples\eeg_metrics_ci\bin\Release\netcoreapp3.1\eeg_metrics_ci.exe --board-id -1 --metric 2 --classifier 2 --model-file %GITHUB_WORKSPACE%\src\ml\train\logreg_mindfulness.onnx
run: .\csharp_package\brainflow\examples\eeg_metrics_ci\bin\Release\net7.0\eeg_metrics_ci.exe --board-id -1 --metric 2 --classifier 2 --model-file %GITHUB_WORKSPACE%\src\ml\train\logreg_mindfulness.onnx
shell: cmd
- name: EEG Metrics CI Rust Test
run: |
Expand Down
4 changes: 2 additions & 2 deletions csharp_package/brainflow/brainflow.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31515.178
# Visual Studio Version 17
VisualStudioVersion = 17.7.34221.43
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{FF155433-168F-4A55-BA98-DFD197A98185}"
EndProject
Expand Down

0 comments on commit 70b378c

Please sign in to comment.