Skip to content

Commit b2e5058

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

1 file changed

Lines changed: 209 additions & 0 deletions

File tree

Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
name: Base 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: 'build-1065'
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+
env:
42+
CROWDIN_API_KEY: ${{ secrets.FLEX_CROWDIN_API }}
43+
LcmRootDir: ${{ github.workspace }}/Localizations/LCM
44+
FILESTOSIGNLATER: ./signExternally
45+
name: Build Debug and run Tests
46+
runs-on: windows-latest
47+
steps:
48+
- name: Compute build number for archival
49+
id: build_number
50+
run: |
51+
$lastJenkins = 1976 # The last patch build from jenkins
52+
$githubRun = $env:GITHUB_RUN_NUMBER
53+
$combined = $lastJenkins + $githubRun
54+
echo "Last Jenkins build: $lastJenkins"
55+
echo "GitHub run number: $githubRun"
56+
echo "Combined build number: $combined"
57+
echo "RELEASE_BASE_BUILD_NUMBER=$combined" >> $env:GITHUB_ENV
58+
59+
- name: Checkout Files
60+
uses: actions/checkout@v4
61+
id: checkout
62+
with:
63+
ref: ${{ github.event.inputs.fw_ref || github.ref }}
64+
fetch-depth: 0
65+
66+
- name: Checkout Helps
67+
uses: actions/checkout@v4
68+
id: helps-checkout
69+
with:
70+
repository: 'sillsdev/FwHelps'
71+
ref: ${{ github.event.inputs.helps_ref || 'develop' }}
72+
fetch-depth: 0
73+
path: 'DistFiles/Helps'
74+
75+
- name: Checkout PatchableInstaller
76+
uses: actions/checkout@v4
77+
id: installer-checkout
78+
with:
79+
repository: 'sillsdev/genericinstaller'
80+
ref: ${{ github.event.inputs.installer_ref || 'master' }}
81+
fetch-depth: 0
82+
path: 'PatchableInstaller'
83+
84+
- name: Checkout Localizations
85+
uses: actions/checkout@v4
86+
id: loc-checkout
87+
with:
88+
repository: 'sillsdev/FwLocalizations'
89+
ref: ${{ github.event.inputs.localizations_ref || 'develop' }}
90+
fetch-depth: 0
91+
path: 'Localizations'
92+
- name: Checkout liblcm
93+
uses: actions/checkout@v4
94+
id: liblcm-checkout
95+
with:
96+
repository: 'sillsdev/liblcm'
97+
ref: ${{ github.event.inputs.installer_ref || 'master' }}
98+
fetch-depth: 0
99+
path: 'Localizations/LCM'
100+
101+
- name: Download 461 targeting pack
102+
uses: suisei-cn/actions-download-file@818d6b7dc8fe73f2f924b6241f2b1134ca1377d9 # 1.6.0
103+
id: downloadfile # Remember to give an ID if you need the output filename
104+
with:
105+
url: "https://download.microsoft.com/download/F/1/D/F1DEB8DB-D277-4EF9-9F48-3A65D4D8F965/NDP461-DevPack-KB3105179-ENU.exe"
106+
target: public/
107+
108+
- name: Install targeting pack
109+
shell: cmd
110+
working-directory: public
111+
run: NDP461-DevPack-KB3105179-ENU.exe /q
112+
113+
- name: Setup dotnet
114+
uses: actions/setup-dotnet@v4
115+
with:
116+
dotnet-version: |
117+
3.1.x
118+
5.0.x
119+
120+
- name: Install Overcrowdin
121+
shell: cmd
122+
run: |
123+
dotnet tool update -g overcrowdin || dotnet tool install -g overcrowdin
124+
125+
- name: Downgrade Wix Toolset - remove when runner has 3.14.2
126+
run: |
127+
choco uninstall wixtoolset
128+
choco install wixtoolset --version 3.11.2 --allow-downgrade --force
129+
echo "C:\Program Files (x86)\WiX Toolset v3.11\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
130+
if: github.event_name != 'pull_request'
131+
132+
- name: Import Base Build Artifacts
133+
shell: pwsh
134+
run: |
135+
# Ensure gh is available (it usually is on GitHub-hosted runners)
136+
gh release download "build-${{ github.run_number }}" `
137+
--repo ${{ github.repository }} `
138+
--pattern "BuildDir.zip" `
139+
--dir base-artifacts
140+
141+
Expand-Archive -Path "base-artifacts/BuildDir.zip" -DestinationPath "BuildDir" -Force
142+
143+
- name: Prepare for build
144+
shell: cmd
145+
working-directory: Build
146+
run: build64.bat /t:WriteNonlocalDevelopmentPropertiesFile
147+
148+
- name: Build Debug and run tests
149+
id: build_installer
150+
shell: powershell
151+
run: |
152+
cd Build
153+
.\build64.bat /t:BuildPatchInstaller "/property:config=release;action=test;desktopNotAvailable=true" /v:d /bl ^| tee-object -FilePath build.log
154+
cd ..
155+
cd BuildDir
156+
md5sum *.exe > md5.txt
157+
158+
- name: Scan Debug Build Output
159+
shell: powershell
160+
working-directory: Build
161+
run: |
162+
$results = Select-String -Path "build.log" -Pattern "^\s*[1-9][0-9]* Error\(s\)"
163+
if ($results) {
164+
foreach ($result in $results) {
165+
Write-Host "Found errors in build.log $($result.LineNumber): $($result.Line)" -ForegroundColor red
166+
}
167+
exit 1
168+
} else {
169+
Write-Host "No errors found" -ForegroundColor green
170+
exit 0
171+
}
172+
- name: Find patch installer
173+
id: find_patch
174+
shell: pwsh
175+
run: |
176+
$patch = Get-ChildItem -Path BuildDir -Filter "FieldWorks_*.msp" | Select-Object -First 1
177+
if (-not $patch) { throw "Patch (.msp) file not found in BuildDir" }
178+
179+
$patchPath = $patch.FullName
180+
"patch_file=$patchPath" >> $env:GITHUB_OUTPUT
181+
182+
- name: Sign Patch
183+
if: github.event_name != 'pull_request'
184+
uses: sillsdev/codesign/trusted-signing-action@v3
185+
with:
186+
credentials: ${{ secrets.TRUSTED_SIGNING_CREDENTIALS }}
187+
files-folder: BuildDir
188+
files-folder-filter: '*.msp'
189+
description: 'FieldWorks Patch Installer'
190+
description-url: 'https://software.sil.org/fieldworks/'
191+
192+
- name: Create Release and Upload artifacts
193+
uses: softprops/action-gh-release@v1
194+
with:
195+
tag_name: build-${{ github.run_number }}
196+
name: "FieldWorks Patch #${{ github.run_number }}"
197+
draft: false
198+
prerelease: true
199+
files: ${{ steps.find_patch.outputs.patch_file }}
200+
201+
- name: Upload Build Logs
202+
uses: actions/upload-artifact@v4
203+
if: always()
204+
with:
205+
if-no-files-found: warn
206+
name: build-logs
207+
path: |
208+
Build/*.log
209+
Build/*.binlog

0 commit comments

Comments
 (0)