-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c1ff558
commit ef6efcb
Showing
2 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Build SLCommand Script | ||
|
||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: 8.0.x | ||
|
||
- name: Prepare for tests | ||
shell: pwsh | ||
run: | | ||
${{ github.workspace }}/build_test.ps1 -pluginName SLCommandScript -workspacePath ${{ github.workspace }} -referencesVariable SL_REFERENCES -dependencies SLCommandScript.Core,SLCommandScript.FileScriptsLoader | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: SLCommand Script | ||
path: D:/plugin/Artifacts |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
param( | ||
[Parameter(Mandatory = $true)] | ||
[string] $pluginName, | ||
|
||
[Parameter(Mandatory = $true)] | ||
[string] $workspacePath, | ||
|
||
[Parameter(Mandatory = $false)] | ||
[string] $referencesVariable = $null, | ||
|
||
[Parameter(Mandatory = $false)] | ||
[string] $depotDownloaderVersion = "2.5.0", | ||
|
||
[Parameter(Mandatory = $false)] | ||
[bool] $runTests = $true, | ||
|
||
[Parameter(Mandatory = $false)] | ||
[Int32] $initialTestRuns = 3, | ||
|
||
[Parameter(Mandatory = $false)] | ||
[string[]] $dependencies = @() | ||
) | ||
|
||
if (-not [string]::IsNullOrWhiteSpace($referencesVariable)) { | ||
Set-Item "Env:\$referencesVariable" -Value "D:/plugin/SCPSL_REFERENCES/SCPSL_Data/Managed" | ||
} | ||
|
||
New-Item -ItemType Directory -Force -Path D:/plugin | ||
New-Item -ItemType Directory -Force -Path D:/plugin/DepotDownloader | ||
Invoke-WebRequest -Uri "https://github.com/SteamRE/DepotDownloader/releases/download/DepotDownloader_$depotDownloaderVersion/depotdownloader-$depotDownloaderVersion.zip" -OutFile "D:/plugin/depotdownloader.zip" | ||
Expand-Archive -Path D:/plugin/depotdownloader.zip -PassThru -DestinationPath D:/plugin/DepotDownloader | ||
|
||
New-Item -ItemType Directory -Force -Path D:/plugin/SCPSL_REFERENCES | ||
Start-Process -NoNewWindow -Wait -FilePath "D:/plugin/DepotDownloader/DepotDownloader.exe" -WorkingDirectory "D:/plugin/DepotDownloader" -ArgumentList "-app 996560","-dir D:/plugin/SCPSL_REFERENCES" | ||
|
||
dotnet restore | ||
dotnet build --no-restore --configuration Release | ||
|
||
if ($runTests -and $initialTestRuns -gt 0) { | ||
$psi = New-Object System.Diagnostics.ProcessStartInfo | ||
$psi.FileName = "D:/plugin/SCPSL_REFERENCES/LocalAdmin.exe" | ||
$psi.Arguments = "7777" | ||
$psi.WorkingDirectory = "D:/plugin/SCPSL_REFERENCES/" | ||
$psi.UseShellExecute = $false | ||
$psi.RedirectStandardInput = $true | ||
|
||
$pr = [System.Diagnostics.Process]::Start($psi) | ||
Start-Sleep -s 5 | ||
$pr.StandardInput.WriteLine("yes") | ||
Start-Sleep -s 2 | ||
$pr.StandardInput.WriteLine("keep") | ||
Start-Sleep -s 2 | ||
$pr.StandardInput.WriteLine("global") | ||
Start-Sleep -s 60 | ||
$pr.StandardInput.WriteLine("exit") | ||
Start-Sleep -s 2 | ||
|
||
for ($i = 0; $i -lt $initialTestRuns; $i++) { | ||
dotnet test --no-build --verbosity quiet | ||
Start-Sleep -s 2 | ||
} | ||
} | ||
|
||
if ($runTests) { | ||
dotnet test --no-build --verbosity normal | ||
} | ||
|
||
New-Item -ItemType Directory -Force -Path D:/plugin/Artifacts | ||
Copy-Item "$workspacePath/$pluginName/bin/Release/net48/$pluginName.dll" -Destination D:/plugin/Artifacts | ||
|
||
if ($dependencies.Length -gt 0) { | ||
$assemblies = $dependencies | ForEach-Object -Process { "$workspacePath/$_/bin/Release/net48/$_.dll" } | ||
Compress-Archive $assemblies -DestinationPath D:/plugin/Artifacts/dependencies.zip | ||
} |