Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Garnet.Worker to win-x64-based-readytorun #1084

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .azure/pipelines/azure-pipelines-external-release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
######################################
# NOTE: Before running this pipeline to generate a the GitHub Release and new nuget packages, update the VersionPrefix value in Version.props file
# NOTE: When Version.props file is modified, this pipeline will automatically get triggered
# NOTE: If this pipeline is ran against a branch that isn't main, the GitHub Release task and NuGet push task will be skipped
# NOTE: If this pipeline is manually started, a "Proof of Presence" (from a SAW machine) will be required before this pipeline can proceed.
######################################
trigger:
branches:
Expand All @@ -15,12 +17,16 @@ resources:
type: git
ref: refs/heads/main

pool:
vmImage: 'windows-latest'

jobs:
- job: Phase_1
displayName: Assessment
cancelTimeoutInMinutes: 1
pool:
name: Azure Pipelines
vmImage: 'windows-latest'
steps:
- checkout: self
clean: False
Expand Down Expand Up @@ -167,7 +173,8 @@ jobs:

- task: GitHubRelease@1
displayName: 'Create the GitHub release'
inputs:
condition: eq(variables['Build.SourceBranchName'], 'main')
inputs:
action: 'create'
gitHubConnection: ADO_to_Github_ServiceConnection
tagSource: userSpecifiedTag
Expand All @@ -192,6 +199,7 @@ jobs:

- task: NuGetCommand@2
displayName: 'Push both packages to NuGet.org'
condition: eq(variables['Build.SourceBranchName'], 'main')
inputs:
command: push
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg'
Expand Down
33 changes: 11 additions & 22 deletions .azure/pipelines/createbinaries.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,42 +35,30 @@ param (
#
######################################################
function CleanUpFiles {
param ($publishFolder, $platform)
param ($publishFolder, $platform, $deleteRunTimes = $true)

$publishPath = "$basePath/main/GarnetServer/bin/Release/net8.0/publish/$publishFolder"
$garnetServerEXE = "$publishPath/GarnetServer.exe"
$excludeGarnetServerPDB = 'GarnetServer.pdb'

# Native binary is different based on OS by default
$nativeFile = "libnative_device.so"
$garnetServerEXE = "$publishPath/GarnetServer"

if ($platform -match "win-x64") {
$nativeFile = "native_device.dll"
$garnetServerEXE = "$publishPath/GarnetServer.exe"
}

$nativeRuntimePathFile = "$publishPath/runtimes/$platform/native/$nativeFile"

if (Test-Path $garnetServerEXE) {
Get-ChildItem -Path $publishPath -Filter '*.xml' | Remove-Item -Force
Get-ChildItem -Path $publishPath -Filter '*.pfx' | Remove-Item -Force
Get-ChildItem -Path $publishPath -Filter *.pdb | Where-Object { $_.Name -ne $excludeGarnetServerPDB } | Remove-Item
Get-ChildItem -Path $publishPath -Filter '*.xml' | Remove-Item -Force
Get-ChildItem -Path $publishPath -Filter '*.pfx' | Remove-Item -Force
Get-ChildItem -Path $publishPath -Filter '*.pdb' | Where-Object { $_.Name -ne $excludeGarnetServerPDB } | Remove-Item

# Copy proper native run time to publish directory
Copy-Item -Path $nativeRuntimePathFile -Destination $publishPath
# Copy proper native run time to publish directory
Copy-Item -Path $nativeRuntimePathFile -Destination $publishPath

# Confirm the files are there
if (Test-Path "$publishPath/$nativeFile") {

# Delete RunTimes folder
Remove-Item -Path "$publishPath/runtimes" -Recurse -Force

} else {
Write-Error "$publishPath/$nativeFile does not exist."
}
} else {
Write-Error "$garnetServerEXE was not found."
# Delete the runtimes folder
if ($deleteRunTimes -eq $true) {
Remove-Item -Path "$publishPath/runtimes" -Recurse -Force
}
}

Expand Down Expand Up @@ -99,6 +87,7 @@ if ($mode -eq 0 -or $mode -eq 1) {
CleanUpFiles "osx-x64" "linux-x64"
#CleanUpFiles "portable" "win-x64" # don't clean up all files for portable ... leave as is
CleanUpFiles "win-x64" "win-x64"
CleanUpFiles "win-x64\Service" "win-x64" $false
CleanUpFiles "win-arm64" "win-x64"
}

Expand Down Expand Up @@ -133,4 +122,4 @@ if ($mode -eq 0 -or $mode -eq 2) {
}

Write-Host "** DONE! **"
Set-Location $lastPwd
Set-Location $lastPwd
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,32 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PublishSingleFile>true</PublishSingleFile>
<PublishReadyToRun>true</PublishReadyToRun>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\hosting\Windows\Garnet.worker\Garnet.worker.csproj" />
</ItemGroup>
<Target Name="CopyWorkerDll" AfterTargets="Publish">
<ItemGroup>
<DependantDLLFiles Include="..\..\hosting\Windows\Garnet.worker\bin\$(Configuration)\net8.0\*.dll" />
<DependantXMLFiles Include="..\..\hosting\Windows\Garnet.worker\bin\$(Configuration)\net8.0\*.xml" />
<RuntimeFilesWinx64 Include="..\..\hosting\Windows\Garnet.worker\bin\$(Configuration)\net8.0\runtimes\win-x64\native\*" />
<RuntimeFilesWin Include="..\..\hosting\Windows\Garnet.worker\bin\$(Configuration)\net8.0\runtimes\win\lib\net8.0\*" />
<GWRunTimeConfigFiles Include="..\..\hosting\Windows\Garnet.worker\bin\$(Configuration)\net8.0\Garnet.worker.runtimeconfig.json" />
<GWDepsFiles Include="..\..\hosting\Windows\Garnet.worker\bin\$(Configuration)\net8.0\Garnet.worker.deps.json" />
<GWEXEFiles Include="..\..\hosting\Windows\Garnet.worker\bin\$(Configuration)\net8.0\Garnet.worker.exe" />
</ItemGroup>
<Copy SourceFiles="@(GWRunTimeConfigFiles)" DestinationFolder="$(PublishDir)Service" />
<Copy SourceFiles="@(DependantDLLFiles)" DestinationFolder="$(PublishDir)Service" />
<Copy SourceFiles="@(DependantXMLFiles)" DestinationFolder="$(PublishDir)Service" />
<Copy SourceFiles="@(RuntimeFilesWinx64)" DestinationFolder="$(PublishDir)Service\runtimes\win-x64\native" />
<Copy SourceFiles="@(RuntimeFilesWin)" DestinationFolder="$(PublishDir)Service\runtimes\win\lib\net8.0" />
<Copy SourceFiles="@(GWDepsFiles)" DestinationFolder="$(PublishDir)Service" />
<Copy SourceFiles="@(GWEXEFiles)" DestinationFolder="$(PublishDir)Service" />
<Copy SourceFiles="@(GWRunTimeConfigFiles)" DestinationFolder="$(PublishDir)Service" />
</Target>
<Target Name="DeleteWorkerFiles" AfterTargets="CopyWorkerDll">
<Delete Files="$(PublishDir)Garnet.worker.exe" />
<Delete Files="$(PublishDir)Garnet.worker.deps.json" />
<Delete Files="$(PublishDir)Garnet.worker.runtimeconfig.json" />
</Target>

</Project>