fix: Remove duplicate Boost Test includes and improve test module con… #194
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
name: C/C++ CI MSVC | |
on: [push] | |
jobs: | |
build-on-windows: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ilammy/msvc-dev-cmd@v1 | |
- name: Cache Boost dependencies | |
uses: actions/cache@v4 | |
with: | |
path: | | |
${{ github.workspace }}/build/CMakeFiles | |
C:/Boost | |
${{ github.workspace }}/build/bin/Db*.solutions | |
key: ${{ runner.os }}-boost-${{ hashFiles('**/vcpkg.json') }} | |
restore-keys: | | |
${{ runner.os }}-boost- | |
- name: Create Build Dir | |
run: cmake -E make_directory ${{github.workspace}}/build | |
- name: Install Redis Dependencies | |
run: | | |
vcpkg install hiredis:x64-windows | |
choco install memurai-developer.install --no-progress --params="'/Port:6379'" | |
# Refresh environment variables and verify installation paths | |
$env:PATH = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") | |
refreshenv | |
# Wait for Memurai installation to complete and verify executable | |
$memuraiPath = "C:\Program Files\Memurai\memurai-developer.exe" | |
$memuraiCli = "C:\Program Files\Memurai\memurai-cli.exe" | |
$maxAttempts = 5 | |
$attempt = 0 | |
$success = $false | |
do { | |
$attempt++ | |
Write-Host "Attempt $attempt of $maxAttempts to locate Memurai executable..." | |
if (Test-Path $memuraiPath) { | |
Write-Host "Found Memurai executable at: $memuraiPath" | |
$success = $true | |
break | |
} | |
Start-Sleep -Seconds 5 | |
$env:PATH = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") | |
refreshenv | |
} while ($attempt -lt $maxAttempts) | |
if (-not $success) { | |
Write-Error "Failed to locate Memurai executable after $maxAttempts attempts" | |
Get-ChildItem "C:\Program Files\Memurai\" -Recurse | |
exit 1 | |
} | |
Write-Host "Configuring Memurai service..." | |
if (Get-Service -Name "memurai" -ErrorAction SilentlyContinue) { | |
Write-Host "Stopping existing Memurai service..." | |
Stop-Service -Name "memurai" -Force | |
Start-Sleep -s 5 | |
} | |
Write-Host "Installing Memurai service..." | |
Start-Process -FilePath $memuraiPath -ArgumentList "--service-install", "--port", "6379" -Wait -NoNewWindow -PassThru | ForEach-Object { | |
if ($_.ExitCode -ne 0) { | |
Write-Error "Failed to install Memurai service (Exit code: $($_.ExitCode))" | |
exit 1 | |
} | |
} | |
Write-Host "Starting Memurai service..." | |
Start-Service -Name "memurai" | |
Start-Sleep -s 10 | |
Write-Host "Verifying Memurai service..." | |
$maxRetries = 10 | |
$retryDelay = 3 | |
$success = $false | |
for ($i = 1; $i -le $maxRetries; $i++) { | |
Write-Host "Verification attempt $i of $maxRetries..." | |
try { | |
$status = Get-Service -Name "memurai" -ErrorAction Stop | |
if ($status.Status -eq "Running") { | |
$ping = & $memuraiCli ping | |
if ($ping -eq "PONG") { | |
Write-Host "Memurai service verified and responding!" | |
$success = $true | |
break | |
} | |
} | |
} catch { | |
Write-Warning "Service check failed: $_" | |
} | |
Start-Sleep -s $retryDelay | |
} | |
if (-not $success) { | |
Write-Error "Failed to verify Memurai service after $maxRetries attempts" | |
Get-Service -Name "memurai" | Format-List * | |
Get-EventLog -LogName Application -Source "Memurai" -Newest 10 | |
exit 1 | |
} | |
# Set environment variables for tests | |
echo "OPENMIND_TEST_REDIS_RETRY_COUNT=10" >> $env:GITHUB_ENV | |
echo "OPENMIND_TEST_REDIS_RETRY_DELAY=3000" >> $env:GITHUB_ENV | |
if (-not $success) { | |
Write-Error "Failed to verify Memurai service after $maxRetries attempts" | |
Get-Service -Name "memurai" | Format-List * | |
Get-EventLog -LogName Application -Source "Memurai" -Newest 10 | |
exit 1 | |
} | |
- name: Configure | |
working-directory: ${{github.workspace}}/build | |
env: | |
CC: cl | |
run: cmake ${{github.workspace}} -DOPENMIND_USE_VCPKG=NO -DOPENMIND_BUILD_SAMPLES=OFF -DOPENMIND_BUILD_TESTS=ON -G "Ninja Multi-Config" -D CMAKE_C_COMPILER="cl.exe" -D CMAKE_CXX_COMPILER="cl.exe" -Dleveldb_TAG:STRING="1.23" -DOPENMIND_MATH_USE_LEVELDB_CACHE=NO -DOPENMIND_STORAGE_LEVELDB=NO -DOPENMIND_STORAGE_REDIS=ON -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake | |
- name: Install prerequisites | |
run: cmake --build ${{github.workspace}}/build --target prerequisites --config Release | |
- name: Reconfigure to detect newly installed prerequisites | |
working-directory: ${{github.workspace}}/build | |
run: cmake . | |
- name: Get number of CPU cores | |
uses: SimenB/github-actions-cpu-cores@v2 | |
id: cpu-cores | |
- name: Build Debug | |
run: cmake --build ${{github.workspace}}/build --config Debug | |
- name: Build Release | |
run: cmake --build ${{github.workspace}}/build --config Release | |
- name: make check Release | |
working-directory: ${{github.workspace}}/build | |
env: | |
OPENMIND_TEST_REDIS_RETRY_COUNT: 10 | |
OPENMIND_TEST_REDIS_RETRY_DELAY: 3000 | |
run: ctest --timeout 1024 -C Release -j ${{steps.cpu-cores.outputs.count}} -E "ts" --output-on-failure | |
- name: make check Debug | |
working-directory: ${{github.workspace}}/build | |
env: | |
OPENMIND_TEST_REDIS_RETRY_COUNT: 10 | |
OPENMIND_TEST_REDIS_RETRY_DELAY: 3000 | |
run: ctest --timeout 2048 -C Debug -j ${{steps.cpu-cores.outputs.count}} -E "ts" --output-on-failure | |
- name: Install | |
working-directory: ${{github.workspace}}/build | |
run: cmake --build ${{github.workspace}}/build --target install --config Release |