Skip to content

Commit 5fbc433

Browse files
committed
Run unit and integration tests on PR to dev
1 parent 759700a commit 5fbc433

1 file changed

Lines changed: 121 additions & 0 deletions

File tree

.github/workflows/tests.yml

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
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/setup-msbuild@v1.0.2
72+
- name: build
73+
run: |
74+
msbuild ALL_BUILD.vcxproj -p:Configuration=Release -p:Platform=x64 -m
75+
- name: Install plugins
76+
shell: powershell
77+
run: |
78+
New-Item -Path 'C:\OEPlugins' -ItemType Directory
79+
git clone --branch main https://github.com/open-ephys-plugins/open-ephys-data-format.git C:\OEPlugins\open-ephys-data-format
80+
cd C:\OEPlugins\open-ephys-data-format\Build
81+
cmake -G "Visual Studio 17 2022" -A x64 ..
82+
msbuild INSTALL.vcxproj -p:Configuration=Release -p:Platform=x64
83+
git clone --branch main https://github.com/open-ephys-plugins/OpenEphysHDF5Lib.git C:\OEPlugins\OpenEphysHDF5Lib
84+
cd C:\OEPlugins\OpenEphysHDF5Lib\Build
85+
cmake -G "Visual Studio 17 2022" -A x64 ..
86+
msbuild INSTALL.vcxproj -p:Configuration=Release -p:Platform=x64
87+
git clone --branch main https://github.com/open-ephys-plugins/nwb-format.git C:\OEPlugins\nwb-format
88+
cd C:\OEPlugins\nwb-format\Build
89+
cmake -G "Visual Studio 17 2022" -A x64 ..
90+
msbuild INSTALL.vcxproj -p:Configuration=Release -p:Platform=x64
91+
- name: Install test-suite
92+
shell: powershell
93+
run: |
94+
git clone --branch juce8 https://github.com/open-ephys/open-ephys-python-tools.git C:\open-ephys-python-tools
95+
cd C:\open-ephys-python-tools
96+
pip install -e .
97+
pip install psutil
98+
- name: Run Tests
99+
shell: powershell
100+
run: |
101+
$process = Start-Process -FilePath "C:\plugin-GUI\Build\Release\open-ephys.exe" -ArgumentList "C:\plugin-GUI\Build\Release\configs\file_reader_config.xml" -NoNewWindow -PassThru
102+
Write-Host "Started open-ephys process with ID: $($process.Id)"
103+
Start-Sleep -Seconds 20
104+
Write-Host "Starting Python script..."
105+
python run_all.py 2>&1 | Tee-Object -FilePath "python_output.log"
106+
Write-Host "Python script completed. Output saved to python_output.log"
107+
Stop-Process -Id $process.Id -Force
108+
env:
109+
OE_WINDOWS_GITHUB_RECORD_PATH: C:\open-ephys\data
110+
- name: Set timestamp
111+
shell: powershell
112+
id: timestamp
113+
run: |
114+
$timestamp = Get-Date -Format 'yyyy_MM_dd_HH_mm_ss'
115+
"timestamp=$timestamp" >> $env:GITHUB_OUTPUT
116+
- name: Upload test results
117+
uses: actions/upload-artifact@v4
118+
with:
119+
name: windows_${{ steps.timestamp.outputs.timestamp }}.log
120+
path: python_output.log
121+
retention-days: 7

0 commit comments

Comments
 (0)