Skip to content

Commit

Permalink
Build workflow improvements
Browse files Browse the repository at this point in the history
- Broke out environment prep and build into its own action
- Some additional switches added to the msbuild command for slightly better operation and more verbose logging
- Multilingual app toolkit installation added to build action, installed and enabled by default.
- Debug build workflow applies to translation file changes as well.
  • Loading branch information
gbakeman committed Jan 18, 2025
1 parent 7959f5e commit d6cf9da
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 50 deletions.
32 changes: 32 additions & 0 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Prepare environment and build

description: Prepares the environment for building, and builds the solution with the given parameters.

inputs:
multilingualBuild:
description: "Installs the Multilingual App Toolkit to enable language compiling."
default: true
required: false
type: boolean

buildConfig:
description: "What configuration MSBuild will build for."
required: false
default: "Debug"
type: string

runs:
using: "composite"
steps:
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2

- name: Install Multilingual App Toolkit extension
if: ${{ inputs.multilingualBuild }}
uses: ./.github/actions/test-vsix-installer
with:
packagename: 'dts-publisher.mat2022'

- name: Build solution
shell: pwsh
run: msbuild -nologo -restore -t:build -p:Configuration=${{ inputs.buildConfig }} WinNUT_V2/WinNUT_V2.sln
72 changes: 72 additions & 0 deletions .github/actions/test-vsix-installer/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: 'Install a Visual Studio Extension'
description: 'Download the latest extension version and install in Visual Studio'
inputs:
packagename:
description: 'Package names from the Visual Studio Marketplace URL itemName parameter'
required: true
outputs:
logfile:
description: "Location on runner of VSIXInstaller's log."
runs:
using: "composite"
steps:
- id: vsix
shell: pwsh
run: |
$baseProtocol = "https:"
$baseHostName = "marketplace.visualstudio.com"
$Uri = "$($baseProtocol)//$($baseHostName)/items?itemName=${{ inputs.packagename }}"
$VsixLocation = "$($env:Temp)\$([guid]::NewGuid()).vsix"
$VSInstallDir = "C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service"
if (-Not $VSInstallDir) {
Write-Error "Visual Studio install directory is missing"
Exit 1
}
Write-Host "Grabbing VSIX extension at $($Uri)"
$HTML = Invoke-WebRequest -Uri $Uri -UseBasicParsing -SessionVariable session
Write-Host "Attempting to download ${{ inputs.packagename }}..."
$anchor = $HTML.Links |
Where-Object { $_.class -eq 'install-button-container' } |
Select-Object -ExpandProperty href
if (-Not $anchor) {
Write-Error "Could not find download anchor tag on the Visual Studio Extensions page"
Exit 1
}
Write-Host "Anchor is $($anchor)"
$href = "$($baseProtocol)//$($baseHostName)$($anchor)"
Write-Host "Href is $($href)"
Invoke-WebRequest $href -OutFile $VsixLocation -WebSession $session
if (-Not (Test-Path $VsixLocation)) {
Write-Error "Downloaded VSIX file could not be located"
Exit 1
}
Write-Host "VSInstallDir is $($VSInstallDir)"
Write-Host "VsixLocation is $($VsixLocation)"
Write-Host "Installing ${{ inputs.packagename }}..."
$proc = Start-Process -Filepath "$($VSInstallDir)\VSIXInstaller" -WorkingDirectory $env:ProgramFiles -ArgumentList "/q /l:vsixinst-out.log $($VsixLocation)" -PassThru
while (-Not ($proc.HasExited)) {
Write-Host -NoNewLine "Process Information:"
Write-Host -NoNewLine $proc
Start-Sleep 1
}
Write-Host "Process exited."
Write-Host "Cleanup..."
rm $VsixLocation
if ($proc.ExitCode -ne 0) {
Write-Host "Error(s) Encountered: $($proc.ExitCode)"
Write-Host Select-String -Path $env:temp\vsixinst-out.log -Pattern "^.*Exception.*$"
}
else {
Write-Host "Installation of ${{ inputs.packagename }} complete!"
}
exit $proc.ExitCode
18 changes: 9 additions & 9 deletions .github/workflows/build-debug.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ on:
paths:
- '**.vb'
- '**.vbproj'
- "**.xlf"

jobs:
build-debug:
runs-on: windows-latest
steps:
- name: "Get Short SHA"
run: echo "SHORT_SHA=$("${{ github.sha }}".SubString(0, 8))" >> $env:GITHUB_ENV

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2

- name: Checkout Code
uses: actions/checkout@v4

# msbuild cannot handle .vdproj Installer projects, so only build debug for now.
- name: Build solution
run: msbuild -t:build -restore -p:Configuration=Debug WinNUT_V2/WinNUT_V2.sln
- id: build
name: Run Build
uses: ./.github/actions/build
with:
buildConfig: "Debug"

- name: "Get Short SHA"
run: echo "SHORT_SHA=$("${{ github.sha }}".SubString(0, 8))" >> $env:GITHUB_ENV

- name: Upload Artifact
uses: actions/upload-artifact@v4
Expand Down
25 changes: 0 additions & 25 deletions .github/workflows/build-translation.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -1887,15 +1887,15 @@ Please correct the error, or cancel the upgrade dialog to continue with the defa
<target state="new">Unavailable</target>
<note from="MultilingualBuild" annotates="source" priority="2">Indicate that a variable is unavailable</note>
</trans-unit>
<trans-unit id="RepeatHS" translate="yes" xml:space="preserve" extype="System.Resources.ResXFileRef, System.Windows.Forms">
<trans-unit id="RepeatHS" translate="yes" extype="System.Resources.ResXFileRef, System.Windows.Forms" xml:space="preserve">
<source>..\Resources\RepeatHS.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</source>
<target state="needs-review-translation">..\Resources\RepeatHS.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</target>
</trans-unit>
<trans-unit id="disconnect2" translate="yes" xml:space="preserve" extype="System.Resources.ResXFileRef, System.Windows.Forms">
<trans-unit id="disconnect2" translate="yes" extype="System.Resources.ResXFileRef, System.Windows.Forms" xml:space="preserve">
<source>..\Resources\disconnect2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</source>
<target state="needs-review-translation">..\Resources\disconnect2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</target>
</trans-unit>
<trans-unit id="internetconnection" translate="yes" xml:space="preserve" extype="System.Resources.ResXFileRef, System.Windows.Forms">
<trans-unit id="internetconnection" translate="yes" extype="System.Resources.ResXFileRef, System.Windows.Forms" xml:space="preserve">
<source>..\Resources\internetconnection.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</source>
<target state="needs-review-translation">..\Resources\internetconnection.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</target>
</trans-unit>
Expand Down Expand Up @@ -3185,59 +3185,59 @@ Please correct the error, or cancel the upgrade dialog to continue with the defa
<source></source>
<target state="new"></target>
</trans-unit>
<trans-unit id="Menu_Connect.Size" translate="yes" xml:space="preserve" extype="System.Drawing.Size, System.Drawing">
<trans-unit id="Menu_Connect.Size" translate="yes" extype="System.Drawing.Size, System.Drawing" xml:space="preserve">
<source>180, 22</source>
<target state="needs-review-translation">180, 22</target>
</trans-unit>
<trans-unit id="Menu_Connect.Text" translate="yes" xml:space="preserve">
<source>Connect</source>
<target state="new">Connect</target>
</trans-unit>
<trans-unit id="AG_InV.Text" translate="yes" xml:space="preserve" extype="System.Resources.ResXNullRef, System.Windows.Forms">
<trans-unit id="AG_InV.Text" translate="yes" extype="System.Resources.ResXNullRef, System.Windows.Forms" xml:space="preserve">
<source></source>
<target state="needs-review-translation"></target>
</trans-unit>
<trans-unit id="AG_OutV.Text" translate="yes" xml:space="preserve" extype="System.Resources.ResXNullRef, System.Windows.Forms">
<trans-unit id="AG_OutV.Text" translate="yes" extype="System.Resources.ResXNullRef, System.Windows.Forms" xml:space="preserve">
<source></source>
<target state="needs-review-translation"></target>
</trans-unit>
<trans-unit id="AG_BattCh.Text" translate="yes" xml:space="preserve" extype="System.Resources.ResXNullRef, System.Windows.Forms">
<trans-unit id="AG_BattCh.Text" translate="yes" extype="System.Resources.ResXNullRef, System.Windows.Forms" xml:space="preserve">
<source></source>
<target state="needs-review-translation"></target>
</trans-unit>
<trans-unit id="AG_Load.Text" translate="yes" xml:space="preserve" extype="System.Resources.ResXNullRef, System.Windows.Forms">
<trans-unit id="AG_Load.Text" translate="yes" extype="System.Resources.ResXNullRef, System.Windows.Forms" xml:space="preserve">
<source></source>
<target state="needs-review-translation"></target>
</trans-unit>
<trans-unit id="AG_BattV.Text" translate="yes" xml:space="preserve" extype="System.Resources.ResXNullRef, System.Windows.Forms">
<trans-unit id="AG_BattV.Text" translate="yes" extype="System.Resources.ResXNullRef, System.Windows.Forms" xml:space="preserve">
<source></source>
<target state="needs-review-translation"></target>
</trans-unit>
<trans-unit id="AG_InF.Text" translate="yes" xml:space="preserve" extype="System.Resources.ResXNullRef, System.Windows.Forms">
<trans-unit id="AG_InF.Text" translate="yes" extype="System.Resources.ResXNullRef, System.Windows.Forms" xml:space="preserve">
<source></source>
<target state="needs-review-translation"></target>
</trans-unit>
<trans-unit id="ToolStripSeparator1.Size" translate="yes" xml:space="preserve" extype="System.Drawing.Size, System.Drawing">
<trans-unit id="ToolStripSeparator1.Size" translate="yes" extype="System.Drawing.Size, System.Drawing" xml:space="preserve">
<source>177, 6</source>
<target state="needs-review-translation">177, 6</target>
</trans-unit>
<trans-unit id="Menu_Persist.Size" translate="yes" xml:space="preserve" extype="System.Drawing.Size, System.Drawing">
<trans-unit id="Menu_Persist.Size" translate="yes" extype="System.Drawing.Size, System.Drawing" xml:space="preserve">
<source>180, 22</source>
<target state="needs-review-translation">180, 22</target>
</trans-unit>
<trans-unit id="Menu_Persist.Text" translate="yes" xml:space="preserve">
<source>Persist</source>
<target state="new">Persist</target>
</trans-unit>
<trans-unit id="Menu_Disconnect.Enabled" translate="yes" xml:space="preserve" extype="System.Boolean, mscorlib">
<trans-unit id="Menu_Disconnect.Enabled" translate="yes" extype="System.Boolean, mscorlib" xml:space="preserve">
<source>False</source>
<target state="needs-review-translation">False</target>
</trans-unit>
<trans-unit id="$this.ImeMode" translate="yes" xml:space="preserve" extype="System.Windows.Forms.ImeMode, System.Windows.Forms">
<trans-unit id="$this.ImeMode" translate="yes" extype="System.Windows.Forms.ImeMode, System.Windows.Forms" xml:space="preserve">
<source>NoControl</source>
<target state="needs-review-translation">NoControl</target>
</trans-unit>
<trans-unit id="Menu_UPS_Var.Enabled" translate="yes" xml:space="preserve" extype="System.Boolean, mscorlib">
<trans-unit id="Menu_UPS_Var.Enabled" translate="yes" extype="System.Boolean, mscorlib" xml:space="preserve">
<source>False</source>
<target state="needs-review-translation">False</target>
</trans-unit>
Expand Down Expand Up @@ -4171,7 +4171,7 @@ Remaining Time : {WinNUT.Lbl_VRTime.Text}</source>
</trans-unit>
<trans-unit id="$this.ImeMode" translate="yes" extype="System.Windows.Forms.ImeMode, System.Windows.Forms" xml:space="preserve">
<source>NoControl</source>
<target state="needs-review-translation">NoControl</target>
<target state="translated">NoControl3</target>
</trans-unit>
</group>
</body>
Expand Down

0 comments on commit d6cf9da

Please sign in to comment.