Skip to content

Commit

Permalink
Merge pull request #149 from VirtualPhotonics/feature/148-updates-to-…
Browse files Browse the repository at this point in the history
…powershell-scripts-for-building-zip-files

Feature 148 Updates to PowerShell Scripts
  • Loading branch information
Lisa Glover authored May 30, 2024
2 parents 9dd57b4 + 815afeb commit 0bca741
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 30 deletions.
6 changes: 4 additions & 2 deletions BuildTestCore.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
11 changes: 9 additions & 2 deletions BuildTestRelease.ps1
Original file line number Diff line number Diff line change
@@ -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"
22 changes: 20 additions & 2 deletions BuildTestReleaseMATLAB.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions BuildTestReleaseMCCL.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -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"
Expand Down
32 changes: 32 additions & 0 deletions BuildTestReleaseScripting.ps1
Original file line number Diff line number Diff line change
@@ -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"
20 changes: 0 additions & 20 deletions RunMATLABUnitTests.ps1

This file was deleted.

0 comments on commit 0bca741

Please sign in to comment.