Skip to content

Commit

Permalink
Merge pull request #4144 from pwojcikdev/ci/separate-windows-build-run
Browse files Browse the repository at this point in the history
Separate Windows unit tests build and run stage
  • Loading branch information
pwojcikdev committed Feb 20, 2023
2 parents f189f66 + 0a83f57 commit cbb0126
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 23 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ jobs:
- name: Fetch Deps
run: ci/actions/windows/install_deps.ps1

- name: Build & Run Tests
- name: Build Tests
run: ci/actions/windows/build.ps1

- name: Run Tests [TEST_USE_ROCKSDB=${{ env.TEST_USE_ROCKSDB }}]
run: ci/actions/windows/run.ps1
env:
DEADLINE_SCALE_FACTOR: ${{ env.TEST_USE_ROCKSDB == 1 && '2' || '1' }}
6 changes: 6 additions & 0 deletions ci/actions/windows/build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ cmake --build . ^
--config %BUILD_TYPE% ^
-- /m:2
set exit_code=%errorlevel%

echo "Packaging NSIS"
call "%cmake_path%\cpack.exe" -C %BUILD_TYPE%
echo "Packaging ZIP"
call "%cmake_path%\cpack.exe" -G ZIP -C %BUILD_TYPE%

goto exit

:exit
Expand Down
8 changes: 2 additions & 6 deletions ci/actions/windows/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if (${env:artifact} -eq 1) {
$env:RUN = "artifact"
}
else {
if ( ${env:RELEASE} -eq "true" -or ${env:TEST_USE_ROCKSDB} -eq 1 ) {
if (${env:RELEASE} -eq "true") {
$env:BUILD_TYPE = "RelWithDebInfo"
}
else {
Expand Down Expand Up @@ -52,12 +52,8 @@ if (${env:RUN} -eq "artifact") {
if (${LastExitCode} -ne 0) {
throw "Failed to build ${env:RUN}"
}

$env:cmake_path = Split-Path -Path(get-command cmake.exe).Path
. "$PSScriptRoot\signing.ps1"

& ..\ci\actions\windows\run.bat
if (${LastExitCode} -ne 0) {
throw "Failed to Pass Test ${env:RUN}"
}

Pop-Location
36 changes: 20 additions & 16 deletions ci/actions/windows/run.bat
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
@echo off
setlocal
set exit_code=0
set count=0

goto %RUN%

:test
if %count% equ 10 goto rpc_test
call %BUILD_TYPE%\core_test.exe
set core_code=%errorlevel%
set /a count=count+1
if %core_code% neq 0 goto test

:rpc_test
call %BUILD_TYPE%\rpc_test.exe
set rpc_code=%errorlevel%
echo Core Test %core_code%
echo RPC Test %rpc_code%

exit /B %core_code%
echo Core Test return code: %core_code%
echo RPC Test return code: %rpc_code%

if not %core_code%==0 (
echo Core Test fail
set exit_code=1
)

if not %rpc_code%==0 (
echo RPC Test fail
set exit_code=1
)

:artifact
echo "Packaging NSIS"
call "%cmake_path%\cpack.exe" -C %BUILD_TYPE%
echo "Packaging ZIP"
call "%cmake_path%\cpack.exe" -G ZIP -C %BUILD_TYPE%
if %exit_code%==0 (
echo Success
exit /b 0
) else (
echo Failed
exit /b 1
)
13 changes: 13 additions & 0 deletions ci/actions/windows/run.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
$ErrorActionPreference = "Continue"

$env:BUILD_TYPE = "Debug"
$env:NETWORK_CFG = "dev"

Push-Location build

& ..\ci\actions\windows\run.bat
if (${LastExitCode} -ne 0) {
throw "Failed to Pass Tests"
}

Pop-Location

0 comments on commit cbb0126

Please sign in to comment.