From 815afeb5cb752d6634e53e0e512fe24d73224b92 Mon Sep 17 00:00:00 2001 From: Lisa Malenfant Date: Tue, 21 May 2024 14:22:46 -0700 Subject: [PATCH] Updated the PowerShell scripts so they can all run independently, added a script for just the VTS libraries --- BuildTestCore.ps1 | 6 ++++-- BuildTestRelease.ps1 | 11 +++++++++-- BuildTestReleaseMATLAB.ps1 | 22 ++++++++++++++++++++-- BuildTestReleaseMCCL.ps1 | 10 ++++++---- BuildTestReleaseScripting.ps1 | 32 ++++++++++++++++++++++++++++++++ RunMATLABUnitTests.ps1 | 20 -------------------- 6 files changed, 71 insertions(+), 30 deletions(-) create mode 100644 BuildTestReleaseScripting.ps1 delete mode 100644 RunMATLABUnitTests.ps1 diff --git a/BuildTestCore.ps1 b/BuildTestCore.ps1 index 5585b85b3..9f7e497c7 100644 --- a/BuildTestCore.ps1 +++ b/BuildTestCore.ps1 @@ -9,6 +9,8 @@ Write-Host "Run Vts.Test Debug and Release" -ForegroundColor Green dotnet test $PWD\src\Vts.Test\Vts.Test.csproj -l "console;verbosity=quiet" -c Debug dotnet test $PWD\src\Vts.Test\Vts.Test.csproj -c Release -Write-Host "Publish the VTS dll to local" -ForegroundColor Green +Write-Host "Publish the VTS dll to platform specific folders" -ForegroundColor Green Remove-Item $PWD\publish -Recurse -ErrorAction Ignore -dotnet publish $PWD\src\Vts\Vts.csproj -f net6.0 -c Release -o $PWD\publish\local --self-contained false +dotnet publish $PWD\src\Vts\Vts.csproj -f net6.0 -c Release -o $PWD\publish\win-x64 --self-contained false +dotnet publish $PWD\src\Vts\Vts.csproj -f net6.0 -c Release -o $PWD\publish\linux-x64 --self-contained false +dotnet publish $PWD\src\Vts\Vts.csproj -f net6.0 -c Release -o $PWD\publish\osx-x64 --self-contained false diff --git a/BuildTestRelease.ps1 b/BuildTestRelease.ps1 index 8e4286f63..24ecf3cbd 100644 --- a/BuildTestRelease.ps1 +++ b/BuildTestRelease.ps1 @@ -1,11 +1,18 @@ $mccl_version = "7.3.0" -$matlab_version = "10.0.0" +$vts_version = "10.0.0" +Write-Host "Create clean publish and release folders" -ForegroundColor Green +Remove-Item "$PWD\release" -Recurse -ErrorAction Ignore +Remove-Item $PWD\publish -Recurse -ErrorAction Ignore + +.\BuildTestCore.ps1 + +Invoke-Expression ".\BuildTestReleaseScripting.ps1 $vts_version" Invoke-Expression ".\BuildTestReleaseMCCL.ps1 $mccl_version" # only run if matlab installed if (Get-Command "matlab" -ErrorAction SilentlyContinue) { - Invoke-Expression ".\BuildTestReleaseMATLAB.ps1 $matlab_version" + Invoke-Expression ".\BuildTestReleaseMATLAB.ps1 $vts_version" } Read-Host -Prompt "Press Enter to exit" diff --git a/BuildTestReleaseMATLAB.ps1 b/BuildTestReleaseMATLAB.ps1 index 66af63b13..3cf4c16bd 100644 --- a/BuildTestReleaseMATLAB.ps1 +++ b/BuildTestReleaseMATLAB.ps1 @@ -11,8 +11,26 @@ Remove-Item "$matlabdir/vts_wrapper/vts_libraries" -Recurse -ErrorAction Ignore Remove-Item "$matlabdir/vts_wrapper/results*" -Recurse -ErrorAction Ignore Write-Host "Test MATLAB unit tests" -ForegroundColor Green -# RunMATLABUnitTests copies Vts.Desktop/bin/Release files to matlab/vts_wrapper/vts_libraries -.\RunMATLABUnitTests.ps1 +# RunMATLABUnitTests copies Vts\publish\win-x64 files to matlab/vts_wrapper/vts_libraries +Write-Host "Run vts_wrapper tests" -ForegroundColor Green +Write-Host "MATLAB not exiting nicely indicates test failure" -ForegroundColor Green +$vtslevel = $PWD + +# Change current dir to vts\matlab\vts_wrapper and get rid of prior build results +cd "$vtslevel\matlab\vts_wrapper" +$matlablibdir = "$vtslevel\matlab\vts_wrapper\vts_libraries" +Remove-Item $matlablibdir -Recurse -ErrorAction Ignore +New-Item $matlablibdir -ItemType "directory" + +# put supporting libraries into vts_libraries folder +$vtslibraries = "$vtslevel\publish\win-x64" +Copy-Item -Path "$vtslibraries\*" -Destination "$matlablibdir" + +matlab -wait -r "vts_tests; quit" + +# return to vts level +cd $vtslevel + Write-Host "Create MATLAB Release version = $version" -ForegroundColor Green # Create release folder if it doesn't exist diff --git a/BuildTestReleaseMCCL.ps1 b/BuildTestReleaseMCCL.ps1 index d1d5374cc..ec01a05a4 100644 --- a/BuildTestReleaseMCCL.ps1 +++ b/BuildTestReleaseMCCL.ps1 @@ -2,10 +2,10 @@ if (!$args) { $version="x.xx.x" echo "version set to x.xx.x" + .\BuildTestCore.ps1 } $vtslevel = $PWD -.\BuildTestCore.ps1 $mcclcsproj = "$PWD\src\Vts.MonteCarlo.CommandLineApplication\Vts.MonteCarlo.CommandLineApplication.csproj" $mccltestcsproj = "$PWD\src\Vts.MonteCarlo.CommandLineApplication.Test\Vts.MonteCarlo.CommandLineApplication.Test.csproj" @@ -32,8 +32,7 @@ dotnet test $mcpptestcsproj -c Release Write-Host "Release Packages: version = $version" -ForegroundColor Green -Write-Host "Create clean publish and release folders" -ForegroundColor Green -Remove-Item "$PWD\release" -Recurse -ErrorAction Ignore +Write-Host "Create clean publish folder" -ForegroundColor Green Remove-Item $PWD\publish -Recurse -ErrorAction Ignore dotnet publish $mcclcsproj -c Release -r linux-x64 -o $PWD\publish\linux-x64 --self-contained false @@ -46,8 +45,11 @@ dotnet publish $mcppcsproj -c Release -r win-x64 -o $PWD\publish\win-x64 --self- dotnet publish $mcppcsproj -c Release -r osx-x64 -o $PWD\publish\osx-x64 --self-contained false # Create MCCL zip files for different OS +# Create release folder if it doesn't exist $releasedir = ".\release" -New-Item -Path $PWD -Name $releasedir -ItemType "directory" +if (-not (Test-Path -LiteralPath $releasedir)) { + New-Item -Path $PWD -Name $releasedir -ItemType "directory" +} # Create win-x64 zip $archive = $releasedir + "\MC_v" + $version + "_Win_x64.zip" diff --git a/BuildTestReleaseScripting.ps1 b/BuildTestReleaseScripting.ps1 new file mode 100644 index 000000000..95c096d85 --- /dev/null +++ b/BuildTestReleaseScripting.ps1 @@ -0,0 +1,32 @@ +$version = $args[0]; +if (!$args) { + $version="x.xx.x" + echo "version set to x.xx.x" + .\BuildTestCore.ps1 +} + +$vtslevel = $PWD + +Write-Host "Create Scripting Release version = $version" -ForegroundColor Green +# Create release folder if it doesn't exist +$releasedir = ".\release" +if (-not (Test-Path -LiteralPath $releasedir)) { + New-Item -Path $PWD -Name $releasedir -ItemType "directory" +} + +# Create win-x64 zip +$archive="$PWD\release\VTS_Scripting_v" + $version + "_Win_x64.zip" +$source="$vtslevel\publish\win-x64\*" +Compress-Archive -Path $source -DestinationPath $archive -Force + +# Create linux-x64 zip +$archive="$PWD\release\VTS_Scripting_v" + $version + "_Linux_x64.zip" +$source="$vtslevel\publish\linux-x64\*" +Compress-Archive -Path $source -DestinationPath $archive -Force + +# Create osx-x64 zip +$archive="$PWD\release\VTS_Scripting_v" + $version + "_Mac_x64.zip" +$source="$vtslevel\publish\osx-x64\*" +Compress-Archive -Path $source -DestinationPath $archive -Force + +Read-Host -Prompt "Press Enter to exit Scripting release process" diff --git a/RunMATLABUnitTests.ps1 b/RunMATLABUnitTests.ps1 deleted file mode 100644 index 6af111231..000000000 --- a/RunMATLABUnitTests.ps1 +++ /dev/null @@ -1,20 +0,0 @@ -Write-Host "Run vts_wrapper tests" -ForegroundColor Green -Write-Host "MATLAB not exiting nicely indicates test failure" -ForegroundColor Green -$vtslevel = $PWD - -# Change current dir to vts\matlab\vts_wrapper and get rid of prior build results -cd "$vtslevel\matlab\vts_wrapper" -$matlablibdir = "$vtslevel\matlab\vts_wrapper\vts_libraries" -Remove-Item $matlablibdir -Recurse -ErrorAction Ignore -New-Item $matlablibdir -ItemType "directory" - -# put supporting libraries into vts_libraries folder -$vtsdesktop = "$vtslevel\publish\local" -Copy-Item -Path "$vtsdesktop\*" -Destination "$matlablibdir" - -# UNCOMMENT NEXT LINE WHEN FILES IN vts_libraries -matlab -wait -r "vts_tests; quit" -#matlab -r "mc_tests; structures_tests; quit" # to only run unit tests - -# return to vts level -cd $vtslevel