Skip to content

Commit

Permalink
ci: preserve Windows .pdb files (#817)
Browse files Browse the repository at this point in the history
  • Loading branch information
thenextman authored Apr 18, 2024
1 parent 66e7ce2 commit 301c499
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 18 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,12 @@ jobs:
if: matrix.os == 'windows' || matrix.os == 'macos'
shell: pwsh
run: |
$Pattern = switch ('${{ matrix.project }}') {
$IncludePattern = switch ('${{ matrix.project }}') {
'devolutions-gateway' { 'DevolutionsGateway_*.exe' }
'jetsocat' { 'jetsocat_*' }
}
Get-ChildItem -Path ${{ runner.temp }} -Recurse -Include "$Pattern" | % {
$ExcludePattern = "*.pdb"
Get-ChildItem -Path ${{ runner.temp }} -Recurse -Include "$IncludePattern" -Exclude $ExcludePattern | % {
if ('${{ matrix.os }}' -Eq 'windows') {
$Params = @('sign',
'-kvt', '${{ secrets.AZURE_TENANT_ID }}',
Expand Down Expand Up @@ -413,9 +414,9 @@ jobs:
Get-ChildItem -Directory -Recurse "x86_64" | Rename-Item -NewName "x64"
# Remove version number and architecture from binary name
Get-ChildItem -File -Recurse | Rename-Item -NewName "jetsocat"
Get-ChildItem -File -Recurse -Exclude "*.pdb" | Rename-Item -NewName "jetsocat"
cd windows
Get-ChildItem -File -Recurse | Rename-Item -NewName "jetsocat.exe"
Get-ChildItem -File -Recurse -Exclude "*.pdb" | Rename-Item -NewName "jetsocat.exe"
- name: Set package metadata
shell: pwsh
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ jobs:
run: |
$Version = "${{ needs.preflight.outputs.version }}"
$HashPath = 'checksums'
$Files = Get-ChildItem -Recurse -File -Exclude 'CHANGELOG.md' | % { Get-FileHash -Algorithm SHA256 $_.FullName }
$Files = Get-ChildItem -Recurse -File -Exclude 'CHANGELOG.md','*.pdb' | % { Get-FileHash -Algorithm SHA256 $_.FullName }
$Files | % { "$($_.Hash) $(Split-Path $_.Path -leaf)" } | Out-File -FilePath $HashPath -Append -Encoding ASCII
echo "::group::checksums"
Expand Down Expand Up @@ -327,15 +327,17 @@ jobs:
run: |
$destinationFolder = "${{ runner.temp }}/artifacts"
$version="${{ needs.preflight.outputs.version }}"
# Note that ".0" is appended here (required by release tooling downstream)
echo "version=${version}.0" >> $Env:GITHUB_OUTPUT
$versionFull="$version.0"
echo "version=${versionFull}" >> $Env:GITHUB_OUTPUT
echo "files-to-upload=$destinationFolder" >> $Env:GITHUB_OUTPUT
New-Item -Path "$destinationFolder" -ItemType "directory"
Move-Item -Path "./windows/x86_64/DevolutionsGateway-x86_64-${version}.msi" -Destination "$destinationFolder/DevolutionsGateway-x86_64-${version}.0.msi"
Move-Item -Path "./windows/x86_64/DevolutionsGateway-x86_64-${version}.msi" -Destination "$destinationFolder/DevolutionsGateway-x86_64-${versionFull}.msi"
Move-Item -Path "./windows/x86_64/DevolutionsGateway_Windows_${version}_x86_64.pdb" -Destination "$destinationFolder/DevolutionsGateway-x86_64-${versionFull}.pdb"
# Note that at this point the deb package is already named using the ".0" suffix, so we don’t rename.
Move-Item -Path "./linux/x86_64/devolutions-gateway_${version}_amd64.deb" -Destination "$destinationFolder/devolutions-gateway_${version}_amd64.deb"
Move-Item -Path "./linux/x86_64/devolutions-gateway_${versionFull}_amd64.deb" -Destination "$destinationFolder/devolutions-gateway_${versionFull}_amd64.deb"
- name: Upload to OneDrive
uses: ./.github/workflows/onedrive-upload
Expand Down
28 changes: 19 additions & 9 deletions ci/tlk.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ class TlkTarget
[string] $Architecture
[string] $CargoProfile
[string] $ExecutableExtension
[string] $SymbolsExtension

TlkTarget() {
$this.Init()
Expand All @@ -161,8 +162,10 @@ class TlkTarget

if ($this.IsWindows()) {
$this.ExecutableExtension = 'exe'
$this.SymbolsExtension = 'pdb'
} else {
$this.ExecutableExtension = ''
$this.SymbolsExtension = ''
}
}

Expand Down Expand Up @@ -307,15 +310,6 @@ class TlkRecipe
$SrcExecutableName = $CargoPackage, $this.Target.ExecutableExtension -ne '' -Join '.'
$SrcExecutablePath = "$($this.SourcePath)/target/${CargoTarget}/${CargoProfile}/${SrcExecutableName}"

if (-Not $this.Target.IsWindows()) {
$StripExecutable = 'strip'
if (Test-Path Env:STRIP_EXECUTABLE) {
$StripExecutable = $Env:STRIP_EXECUTABLE
}

& $StripExecutable $SrcExecutablePath | Out-Host
}

if (Test-Path Env:DGATEWAY_EXECUTABLE) {
$DGatewayExecutable = $Env:DGATEWAY_EXECUTABLE
$DestinationExecutable = $DGatewayExecutable
Expand All @@ -326,6 +320,22 @@ class TlkRecipe
$DestinationExecutable = $null
}

if ($this.Target.IsWindows() -And $DestinationExecutable) {
$SrcSymbolsName = $CargoPackage.Replace('-','_')
$SrcSymbolsName = $SrcSymbolsName, $this.Target.SymbolsExtension -ne '' -Join '.'
$SrcSymbolsPath = "$($this.SourcePath)/target/${CargoTarget}/${CargoProfile}/${SrcSymbolsName}"
$DestinationSymbolsName = $(Split-Path $DestinationExecutable -Leaf).Replace(".$($this.Target.ExecutableExtension)", ".$($this.Target.SymbolsExtension)")
$DestinationDirectory = Split-Path $DestinationExecutable -Parent
Copy-Item $SrcSymbolsPath -Destination $(Join-Path $DestinationDirectory $DestinationSymbolsName)
} elseif (!$this.Target.IsWindows()) {
$StripExecutable = 'strip'
if (Test-Path Env:STRIP_EXECUTABLE) {
$StripExecutable = $Env:STRIP_EXECUTABLE
}

& $StripExecutable $SrcExecutablePath | Out-Host
}

if ($DestinationExecutable) {
Copy-Item -Path $SrcExecutablePath -Destination $DestinationExecutable
}
Expand Down

0 comments on commit 301c499

Please sign in to comment.