Skip to content

Commit e7815c4

Browse files
Add patch build workflow
1 parent 001dd61 commit e7815c4

3 files changed

Lines changed: 272 additions & 5 deletions

File tree

.github/workflows/base-installer-cd.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,16 +222,24 @@ jobs:
222222
[System.IO.Compression.CompressionLevel]::Optimal,
223223
$false
224224
)
225+
[System.IO.Compression.ZipFile]::CreateFromDirectory(
226+
"$pwd\PatchableInstaller\ProcRunner\ProcRunner\bin\Release\net48",
227+
"$pwd\ProcRunner.zip",
228+
[System.IO.Compression.CompressionLevel]::Optimal,
229+
$false
230+
)
225231
226232
- name: Create Release and Upload artifacts
233+
if: ${{ inputs.make_release == 'true' }}
227234
uses: softprops/action-gh-release@v1
228235
with:
229-
tag_name: build-${{ github.run_number }}
230-
name: "FieldWorks Base Build #${{ github.run_number }}"
236+
tag_name: build-${{ env.RELEASE_BASE_BUILD_NUMBER }}
237+
name: "FieldWorks Base Build #${{ env.RELEASE_BASE_BUILD_NUMBER }}"
231238
draft: false
232239
prerelease: true
233240
files: |
234-
${{ github.workspace }}\BuildDir.zip
241+
${{ github.workspace }}/BuildDir.zip
242+
${{ github.workspace }}/ProcRunner.zip
235243
${{ steps.stage_installers.outputs.offline_exe }}
236244
${{ steps.stage_installers.outputs.online_exe }}
237245
Lines changed: 254 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,254 @@
1+
name: Patch Installer
2+
on:
3+
push:
4+
branches: ["release/9.3", "feature/gha-cd"]
5+
workflow_dispatch:
6+
inputs:
7+
fw_ref:
8+
description: 'Commit-ish (branch, tag, SHA) to checkout for the main repository'
9+
required: false
10+
default: ''
11+
helps_ref:
12+
description: 'Commit-ish for helps repository'
13+
required: false
14+
default: 'develop'
15+
installer_ref:
16+
description: 'Commit-ish for PatchableInstaller repository'
17+
required: false
18+
default: 'master'
19+
localizations_ref:
20+
description: 'Commit-ish for localization repository'
21+
required: false
22+
default: 'develop'
23+
lcm_ref:
24+
description: 'Commit-ish for liblcm repository'
25+
required: false
26+
default: 'master'
27+
base_release:
28+
description: 'The github release for the base build artifacts'
29+
default: 'FieldWorks9.3.0'
30+
make_release:
31+
description: 'Should the build archive a release, false by default, should be set to true on a release build.'
32+
required: false
33+
default: 'false'
34+
35+
concurrency:
36+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
37+
cancel-in-progress: true
38+
39+
jobs:
40+
debug_build_and_test:
41+
permissions:
42+
contents: read
43+
env:
44+
CROWDIN_API_KEY: ${{ secrets.FLEX_CROWDIN_API }}
45+
LcmRootDir: ${{ github.workspace }}/Localizations/LCM
46+
FILESTOSIGNLATER: ./signExternally
47+
GH_TOKEN: ${{ github.token }}
48+
name: Build Debug and run Tests
49+
runs-on: windows-latest
50+
steps:
51+
- name: Compute build number for archival
52+
id: build_number
53+
run: |
54+
$lastJenkins = 1976 # The last patch build from jenkins
55+
$githubRun = $env:GITHUB_RUN_NUMBER
56+
$combined = $lastJenkins + $githubRun
57+
echo "Last Jenkins build: $lastJenkins"
58+
echo "GitHub run number: $githubRun"
59+
echo "Combined build number: $combined"
60+
echo "RELEASE_BASE_BUILD_NUMBER=$combined" >> $env:GITHUB_ENV
61+
62+
- name: Checkout Files
63+
uses: actions/checkout@v4
64+
id: checkout
65+
with:
66+
ref: ${{ github.event.inputs.fw_ref || github.ref }}
67+
fetch-depth: 0
68+
69+
- name: Checkout Helps
70+
uses: actions/checkout@v4
71+
id: helps-checkout
72+
with:
73+
repository: 'sillsdev/FwHelps'
74+
ref: ${{ github.event.inputs.helps_ref || 'develop' }}
75+
fetch-depth: 0
76+
path: 'DistFiles/Helps'
77+
78+
- name: Checkout PatchableInstaller
79+
uses: actions/checkout@v4
80+
id: installer-checkout
81+
with:
82+
repository: 'sillsdev/genericinstaller'
83+
ref: ${{ github.event.inputs.installer_ref || 'master' }}
84+
fetch-depth: 0
85+
path: 'PatchableInstaller'
86+
87+
- name: Checkout Localizations
88+
uses: actions/checkout@v4
89+
id: loc-checkout
90+
with:
91+
repository: 'sillsdev/FwLocalizations'
92+
ref: ${{ github.event.inputs.localizations_ref || 'develop' }}
93+
fetch-depth: 0
94+
path: 'Localizations'
95+
- name: Checkout liblcm
96+
uses: actions/checkout@v4
97+
id: liblcm-checkout
98+
with:
99+
repository: 'sillsdev/liblcm'
100+
ref: ${{ github.event.inputs.lcm_ref || 'master' }}
101+
fetch-depth: 0
102+
path: 'Localizations/LCM'
103+
104+
- name: Download 461 targeting pack
105+
uses: suisei-cn/actions-download-file@818d6b7dc8fe73f2f924b6241f2b1134ca1377d9 # 1.6.0
106+
id: downloadfile # Remember to give an ID if you need the output filename
107+
with:
108+
url: "https://download.microsoft.com/download/F/1/D/F1DEB8DB-D277-4EF9-9F48-3A65D4D8F965/NDP461-DevPack-KB3105179-ENU.exe"
109+
target: public/
110+
111+
- name: Install targeting pack
112+
shell: cmd
113+
working-directory: public
114+
run: NDP461-DevPack-KB3105179-ENU.exe /q
115+
116+
- name: Setup dotnet
117+
uses: actions/setup-dotnet@v4
118+
with:
119+
dotnet-version: |
120+
3.1.x
121+
5.0.x
122+
123+
- name: Install Overcrowdin
124+
shell: cmd
125+
run: |
126+
dotnet tool update -g overcrowdin || dotnet tool install -g overcrowdin
127+
128+
- name: Downgrade Wix Toolset - remove when runner has 3.14.2
129+
run: |
130+
choco uninstall wixtoolset
131+
choco install wixtoolset --version 3.11.2 --allow-downgrade --force
132+
echo "C:\Program Files (x86)\WiX Toolset v3.11\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
133+
if: github.event_name != 'pull_request'
134+
135+
- name: Import Base Build Artifacts
136+
shell: pwsh
137+
run: |
138+
$release = "${{ inputs.base_release || 'FieldWorks9.3.0' }}"
139+
$repo = "${{ github.repository }}"
140+
141+
Write-Host "Downloading artifacts for release $release from $repo"
142+
143+
# Download BuildDir.zip
144+
gh release download $release --repo $repo --pattern "BuildDir.zip" --dir base-artifacts
145+
if (-not (Test-Path "base-artifacts/BuildDir.zip")) {
146+
throw "BuildDir.zip not found in release '$release'."
147+
}
148+
149+
# Download ProcRunner.zip
150+
gh release download $release --repo $repo --pattern "ProcRunner.zip" --dir base-artifacts
151+
if (-not (Test-Path "base-artifacts/ProcRunner.zip")) {
152+
throw "ProcRunner.zip not found in release '$release'."
153+
}
154+
155+
# Expand BuildDir.zip into BuildDir
156+
Expand-Archive -Path "base-artifacts/BuildDir.zip" -DestinationPath "BuildDir" -Force
157+
Write-Host "Expanded BuildDir.zip -> ./BuildDir"
158+
159+
# Ensure ProcRunner target path exists
160+
$procTarget = "PatchableInstaller/ProcRunner/ProcRunner/bin/Release/net48"
161+
if (-not (Test-Path $procTarget)) {
162+
New-Item -ItemType Directory -Path $procTarget -Force | Out-Null
163+
}
164+
165+
# Expand ProcRunner.zip into the exact net48 folder
166+
Expand-Archive -Path "base-artifacts/ProcRunner.zip" -DestinationPath $procTarget -Force
167+
Write-Host "Expanded ProcRunner.zip -> $procTarget"
168+
169+
# Write out the properties file (a first build on a system requires a prompt response otherwise)
170+
# and set an OS feature in the registry that will allow Wix v3 to use temporary files without error
171+
- name: Prepare for build
172+
working-directory: Build
173+
run: |
174+
# Define paths and the key/value to set
175+
$regPaths = @(
176+
"HKLM:\SOFTWARE\Microsoft\.NETFramework\AppContext",
177+
"HKLM:\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\AppContext"
178+
)
179+
$valueName = "Switch.System.DisableTempFileCollectionDirectoryFeature"
180+
$expectedValue = "true"
181+
182+
foreach ($path in $regPaths) {
183+
Write-Host "Adding or updating registry value in $path..."
184+
if (-not (Test-Path $path)) {
185+
New-Item -Path $path -Force | Out-Null
186+
}
187+
New-ItemProperty -Path $path -Name $valueName -Value $expectedValue -Type String -Force
188+
}
189+
190+
.\build64.bat /t:WriteNonlocalDevelopmentPropertiesFile
191+
192+
- name: Build Debug and run tests
193+
id: build_installer
194+
shell: powershell
195+
run: |
196+
Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\.NETFramework\AppContext"
197+
cd Build
198+
.\build64.bat /t:BuildPatchInstaller "/property:config=release;action=test;desktopNotAvailable=true" /v:d /bl ^| tee-object -FilePath build.log
199+
cd ..
200+
cd BuildDir
201+
202+
- name: Scan Debug Build Output
203+
shell: powershell
204+
working-directory: Build
205+
run: |
206+
$results = Select-String -Path "build.log" -Pattern "^\s*[1-9][0-9]* Error\(s\)"
207+
if ($results) {
208+
foreach ($result in $results) {
209+
Write-Host "Found errors in build.log $($result.LineNumber): $($result.Line)" -ForegroundColor red
210+
}
211+
exit 1
212+
} else {
213+
Write-Host "No errors found" -ForegroundColor green
214+
exit 0
215+
}
216+
- name: Find patch installer
217+
id: find_patch
218+
shell: pwsh
219+
run: |
220+
$patch = Get-ChildItem -Path BuildDir -Filter "FieldWorks_*.msp" | Select-Object -First 1
221+
if (-not $patch) { throw "Patch (.msp) file not found in BuildDir" }
222+
223+
$patchPath = $patch.FullName
224+
"patch_file=$patchPath" >> $env:GITHUB_OUTPUT
225+
226+
- name: Sign Patch
227+
if: github.event_name != 'pull_request'
228+
uses: sillsdev/codesign/trusted-signing-action@v3
229+
with:
230+
credentials: ${{ secrets.TRUSTED_SIGNING_CREDENTIALS }}
231+
files-folder: BuildDir
232+
files-folder-filter: '*.msp'
233+
description: 'FieldWorks Patch Installer'
234+
description-url: 'https://software.sil.org/fieldworks/'
235+
236+
- name: Create Release and Upload artifacts
237+
uses: softprops/action-gh-release@v1
238+
if: github.event.inputs.installer_ref == 'true'
239+
with:
240+
tag_name: build-${{ github.run_number }}
241+
name: "FieldWorks Patch #${{ github.run_number }}"
242+
draft: false
243+
prerelease: true
244+
files: ${{ steps.find_patch.outputs.patch_file }}
245+
246+
- name: Upload Build Logs
247+
uses: actions/upload-artifact@v4
248+
if: always()
249+
with:
250+
if-no-files-found: warn
251+
name: build-logs
252+
path: |
253+
Build/*.log
254+
Build/*.binlog

Build/Installer.targets

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@
111111
<RemovedSinceLastBase Include="$(dir-outputBase)/Helps/WW-ConceptualIntro/wasin-wasin.png" />
112112
<RemovedSinceLastBase Include="$(dir-outputBase)/NHunspell.dll" />
113113
<RemovedSinceLastBase Include="$(dir-outputBase)/Hunspellx64.dll" />
114+
<!-- These two files were included in the jenkins build, but not present in a local build or gha -->
115+
<RemovedSinceLastBase Include="$(dir-outputBase)/stdole.dll" />
116+
<RemovedSinceLastBase Include="$(dir-outputBase)/System.Text.Encoding.CodePages.dll" />
114117
</ItemGroup>
115118
<WriteLinesToFile File="%(RemovedSinceLastBase.FullPath)" Lines="" />
116119
</Target>
@@ -154,7 +157,8 @@
154157
<OutputDirForConfig>$(fwrt)\Output\$(Configuration)</OutputDirForConfig>
155158
</PropertyGroup>
156159
<ItemGroup>
157-
<DeveloperFiles Include="$(fwrt)\DistFiles\CommonLocalizations\.gitignore"/>
160+
<DeveloperFiles Include="$(fwrt)\**\.gitignore"/>
161+
<DeveloperFiles Include="$(fwrt)\**\*~"/>
158162
<DeveloperFiles Include="$(fwrt)\DistFiles\CommonLocalizations\README.md"/>
159163
<DeveloperFiles Include="$(fwrt)\DistFiles\DropTEC.exe"/>
160164
<DeveloperFiles Include="$(fwrt)\DistFiles\Fonts\Raw\**\*"/>
@@ -480,7 +484,8 @@
480484
<PatchArgs>"$(ApplicationName)" $(SafeApplicationName) $(BaseVersion) $(BuildVersion) "$(AppBuildMasterDir)/$(BinDirSuffix)" "$(AppBuildDir)/$(BinDirSuffix)" "$(AppBuildMasterDir)/$(DataDirSuffix)" "$(AppBuildDir)/$(DataDirSuffix)" $(ProductIdGuid) $(UpgradeCodeGuid) $(CompGGS) "$(Manufacturer)" $(SafeManufacturer) $(Arch)</PatchArgs>
481485
</PropertyGroup>
482486

483-
<Exec WorkingDirectory="$(PatchDir)" Command="buildPatch.bat $(PatchArgs)"/>
487+
<!-- Suppress ICE30 because we and Encoding Converters MM both install Geckofx, resulting in an ICE warning for double ref counting -->
488+
<Exec WorkingDirectory="$(PatchDir)" Command="buildPatch.bat $(PatchArgs)" EnvironmentVariables="SuppressICE=-sice:ICE30" />
484489

485490
<ItemGroup>
486491
<PatchFiles Include="$(PatchDir)/**/*.msp"/>

0 commit comments

Comments
 (0)