Skip to content

Commit d22bb88

Browse files
committed
Add unit and integration tests on PR
1 parent 759700a commit d22bb88

File tree

6 files changed

+165
-30
lines changed

6 files changed

+165
-30
lines changed

.github/workflows/linux.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,6 @@ on:
1111
- 'Source/**'
1212
- 'CMakeLists.txt'
1313
- 'HelperFunctions.cmake'
14-
pull_request:
15-
paths:
16-
- '.github/workflows/**'
17-
- 'JuceLibraryCode/**'
18-
- 'PluginGenerator/**'
19-
- 'Plugins/**'
20-
- 'Resources/**'
21-
- 'Source/**'
22-
- 'CMakeLists.txt'
23-
- 'HelperFunctions.cmake'
2414

2515
jobs:
2616
build-ubuntu:

.github/workflows/osx.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,6 @@ on:
1111
- 'Source/**'
1212
- 'CMakeLists.txt'
1313
- 'HelperFunctions.cmake'
14-
pull_request:
15-
paths:
16-
- '.github/workflows/**'
17-
- 'JuceLibraryCode/**'
18-
- 'PluginGenerator/**'
19-
- 'Plugins/**'
20-
- 'Resources/**'
21-
- 'Source/**'
22-
- 'CMakeLists.txt'
23-
- 'HelperFunctions.cmake'
2414

2515
jobs:
2616
build-osx:

.github/workflows/tests.yml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
name: Tests
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'JuceLibraryCode/**'
7+
- 'Plugins/**'
8+
- 'Resources/**'
9+
- 'Source/**'
10+
- 'CMakeLists.txt'
11+
- 'HelperFunctions.cmake'
12+
branches:
13+
- 'development'
14+
- 'testing'
15+
16+
jobs:
17+
unit-tests:
18+
name: Unit Tests
19+
runs-on: ubuntu-22.04
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
- name: build
24+
env:
25+
CC: gcc-10
26+
CXX: g++-10
27+
run: |
28+
sudo apt update
29+
cd Resources/Scripts
30+
sudo ./install_linux_dependencies.sh
31+
git apply gha_unit_tests.patch
32+
cd ../../Build && cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=ON ..
33+
make -j8
34+
- name: run tests
35+
run: |
36+
cd Resources/Scripts
37+
chmod +x run_unit_tests_linux.sh
38+
./run_unit_tests_linux.sh
39+
shell: bash
40+
41+
integration-tests:
42+
name: Integration Tests
43+
runs-on: windows-2022
44+
45+
steps:
46+
- uses: actions/checkout@v4
47+
with:
48+
fetch-depth: 0
49+
- name: Start Windows Audio Engine
50+
run: net start audiosrv
51+
- name: Install Scream
52+
shell: powershell
53+
run: |
54+
Start-Service audio*
55+
Invoke-WebRequest https://github.com/duncanthrax/scream/releases/download/3.6/Scream3.6.zip -OutFile C:\Scream3.6.zip
56+
Expand-7ZipArchive -Path C:\Scream3.6.zip -DestinationPath C:\Scream
57+
$cert = (Get-AuthenticodeSignature C:\Scream\Install\driver\Scream.sys).SignerCertificate
58+
$store = [System.Security.Cryptography.X509Certificates.X509Store]::new("TrustedPublisher", "LocalMachine")
59+
$store.Open("ReadWrite")
60+
$store.Add($cert)
61+
$store.Close()
62+
cd C:\Scream\Install\driver
63+
C:\Scream\Install\helpers\devcon install Scream.inf *Scream
64+
- name: Show audio device
65+
run: Get-CimInstance Win32_SoundDevice | fl *
66+
- name: configure
67+
run: |
68+
cd Build
69+
cmake -G "Visual Studio 17 2022" -A x64 ..
70+
- name: Add msbuild to PATH
71+
uses: microsoft/[email protected]
72+
- name: build
73+
run: |
74+
cd Build
75+
msbuild ALL_BUILD.vcxproj -p:Configuration=Release -p:Platform=x64 -m
76+
- name: Install open-ephys-data-format
77+
shell: powershell
78+
run: |
79+
New-Item -Path '..\OEPlugins' -ItemType Directory
80+
git clone --branch main https://github.com/open-ephys-plugins/open-ephys-data-format.git ..\OEPlugins\open-ephys-data-format
81+
cd ..\OEPlugins\open-ephys-data-format\Build
82+
cmake -G "Visual Studio 17 2022" -A x64 ..
83+
msbuild INSTALL.vcxproj -p:Configuration=Release -p:Platform=x64
84+
- name: Install OpenEphysHDF5Lib
85+
shell: powershell
86+
run: |
87+
git clone --branch main https://github.com/open-ephys-plugins/OpenEphysHDF5Lib.git ..\OEPlugins\OpenEphysHDF5Lib
88+
cd ..\OEPlugins\OpenEphysHDF5Lib\Build
89+
cmake -G "Visual Studio 17 2022" -A x64 ..
90+
msbuild INSTALL.vcxproj -p:Configuration=Release -p:Platform=x64
91+
- name: Install nwb-format
92+
shell: powershell
93+
run: |
94+
git clone --branch main https://github.com/open-ephys-plugins/nwb-format.git ..\OEPlugins\nwb-format
95+
cd ..\OEPlugins\nwb-format\Build
96+
cmake -G "Visual Studio 17 2022" -A x64 ..
97+
msbuild INSTALL.vcxproj -p:Configuration=Release -p:Platform=x64
98+
- name: Install test-suite
99+
shell: powershell
100+
run: |
101+
git clone --branch juce8 https://github.com/open-ephys/open-ephys-python-tools.git C:\open-ephys-python-tools
102+
cd C:\open-ephys-python-tools
103+
pip install -e .
104+
pip install psutil
105+
- name: Run Tests
106+
shell: powershell
107+
run: |
108+
git clone --branch main https://github.com/open-ephys-plugins/open-ephys-test-suite.git C:\test-suite
109+
cd C:\test-suite
110+
$process = Start-Process -FilePath "Build\Release\open-ephys.exe" -ArgumentList "Build\Release\configs\file_reader_config.xml" -NoNewWindow -PassThru
111+
Write-Host "Started open-ephys process with ID: $($process.Id)"
112+
Start-Sleep -Seconds 10
113+
Write-Host "Starting Python script..."
114+
python run_all.py 2>&1 | Tee-Object -FilePath "python_output.log"
115+
Write-Host "Python script completed. Output saved to python_output.log"
116+
Stop-Process -Id $process.Id -Force
117+
env:
118+
OE_WINDOWS_GITHUB_RECORD_PATH: C:\open-ephys\data
119+
- name: Set timestamp
120+
shell: powershell
121+
id: timestamp
122+
run: |
123+
$timestamp = Get-Date -Format 'yyyy_MM_dd_HH_mm_ss'
124+
"timestamp=$timestamp" >> $env:GITHUB_OUTPUT
125+
- name: Upload test results
126+
uses: actions/upload-artifact@v4
127+
with:
128+
name: windows_${{ steps.timestamp.outputs.timestamp }}.log
129+
path: python_output.log
130+
retention-days: 7

.github/workflows/windows.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,6 @@ on:
1111
- 'Source/**'
1212
- 'CMakeLists.txt'
1313
- 'HelperFunctions.cmake'
14-
pull_request:
15-
paths:
16-
- '.github/workflows/**'
17-
- 'JuceLibraryCode/**'
18-
- 'PluginGenerator/**'
19-
- 'Plugins/**'
20-
- 'Resources/**'
21-
- 'Source/**'
22-
- 'CMakeLists.txt'
23-
- 'HelperFunctions.cmake'
2414

2515
jobs:
2616
build-windows:
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git a/Tests/Processors/CMakeLists.txt b/Tests/Processors/CMakeLists.txt
2+
index a89fa4da4..ab53e8d89 100644
3+
--- a/Tests/Processors/CMakeLists.txt
4+
+++ b/Tests/Processors/CMakeLists.txt
5+
@@ -5,8 +5,8 @@ add_sources(${COMPONENT_NAME}_tests
6+
DataBufferTests.cpp
7+
PluginManagerTests.cpp
8+
SourceNodeTests.cpp
9+
- RecordNodeTests.cpp
10+
- ProcessorGraphTests.cpp
11+
+ #RecordNodeTests.cpp
12+
+ #ProcessorGraphTests.cpp
13+
EventTests.cpp
14+
DataThreadTests.cpp
15+
GenericProcessorTests.cpp
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
# Use first argument as TEST_DIR if provided, otherwise use default
4+
TEST_DIR="${1:-../../Build/TestBin}"
5+
6+
# Track overall exit code
7+
EXIT_CODE=0
8+
9+
# Find all executable files that are not .so files
10+
for test_exec in $(find "$TEST_DIR" -type f -executable ! -name "*.so"); do
11+
echo "Running test: $test_exec"
12+
"$test_exec"
13+
TEST_RESULT=$?
14+
if [ $TEST_RESULT -ne 0 ]; then
15+
EXIT_CODE=1
16+
fi
17+
echo "----------------------------------------"
18+
done
19+
20+
exit $EXIT_CODE

0 commit comments

Comments
 (0)