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