Skip to content

Commit d9bdd27

Browse files
committed
git-artifacts: validate the installers as part of the workflow
We already do that in the `git-artifacts` workflows in the `git-sdk-*` repositories, so it is only logical to do the same in the `git-artifacts` workflow in `git-for-windows-automation`. Note: I copy/edited the version from the `git-sdk-arm64` repository's `git-artifacts` workflow because that is quite a bit ahead of the other `git-sdk-*` repositories' versions. There is one notable deviation from that workflow: The `installer.log` file is no longer shown in the workflow run's log. The reason is: it is lengthy, and the grouping does not work due to GitHub's web UI implementation. GitHub's web UI insists on loading only a small chunk of the logs at a time, missing the end of the group, and simply not showing the relevant part (which comes after the log). The `installer.log` file is uploaded as an artifact anyway, so not much is lost. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 9afefbb commit d9bdd27

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

.github/workflows/git-artifacts.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ jobs:
4747
outputs:
4848
artifact_matrix: ${{ steps.artifact-build-matrix.outputs.result }}
4949
msystem: ${{steps.configure-environment.outputs.MSYSTEM}}
50+
mingw-prefix: ${{steps.configure-environment.outputs.MINGW_PREFIX}}
5051
mingw_package_prefix: ${{steps.configure-environment.outputs.MINGW_PACKAGE_PREFIX}}
5152
sdk_repo_arch: ${{steps.configure-environment.outputs.SDK_REPO_ARCH}}
5253
check-run-state: ${{steps.check-run-state.outputs.check-run-state}}
@@ -163,6 +164,7 @@ jobs:
163164
echo "MSYSTEM=$MSYSTEM" >> $GITHUB_ENV
164165
echo "MSYSTEM=$MSYSTEM" >> $GITHUB_OUTPUT
165166
echo "MINGW_PREFIX=$MINGW_PREFIX" >> $GITHUB_ENV
167+
echo "MINGW_PREFIX=$MINGW_PREFIX" >> $GITHUB_OUTPUT
166168
echo "MINGW_PACKAGE_PREFIX=$MINGW_PACKAGE_PREFIX" >> $GITHUB_ENV
167169
echo "MINGW_PACKAGE_PREFIX=$MINGW_PACKAGE_PREFIX" >> $GITHUB_OUTPUT
168170
echo "SDK_REPO_ARCH=$SDK_REPO_ARCH" >> $GITHUB_OUTPUT
@@ -359,6 +361,7 @@ jobs:
359361
needs: pkg
360362
env:
361363
MSYSTEM: ${{ needs.pkg.outputs.msystem }}
364+
MINGW_PREFIX: ${{ needs.pkg.outputs.mingw-prefix }}
362365
MINGW_PACKAGE_PREFIX: ${{ needs.pkg.outputs.mingw_package_prefix }}
363366
SDK_REPO_ARCH: ${{ needs.pkg.outputs.sdk_repo_arch }}
364367
strategy:
@@ -397,6 +400,7 @@ jobs:
397400
git config --global user.name "$USER_NAME" &&
398401
git config --global user.email "$USER_EMAIL"
399402
- name: Clone and update build-extra
403+
id: build-extra
400404
run: |
401405
d=/usr/src/build-extra &&
402406
if test ! -d $d/.git
@@ -406,6 +410,7 @@ jobs:
406410
git -C $d fetch https://github.com/git-for-windows/build-extra main &&
407411
git -C $d switch -C main FETCH_HEAD
408412
fi &&
413+
echo "result=$(cygpath -am "$d")" >> $GITHUB_OUTPUT &&
409414
if test -z "$BUILD_EXTRA_REV_FOR_EXISTING_GIT_TAG"
410415
then
411416
git -C $d -c pull.rebase=false pull "$PWD"/bundle-artifacts/build-extra.bundle main
@@ -480,6 +485,47 @@ jobs:
480485
app-id: ${{ secrets.GH_APP_ID }}
481486
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
482487
append-text: 'Built ${{ matrix.artifact.name }}'
488+
- name: Run the installer
489+
if: matrix.artifact.name == 'installer'
490+
shell: pwsh
491+
run: |
492+
$exePath = Get-ChildItem -Path artifacts/*.exe | %{$_.FullName}
493+
$installer = Start-Process -PassThru -Wait -FilePath "$exePath" -ArgumentList "/SILENT /VERYSILENT /NORESTART /SUPPRESSMSGBOXES /ALLOWDOWNGRADE=1 /LOG=installer.log"
494+
$exitCode = $installer.ExitCode
495+
if ($exitCode -ne 0) {
496+
Write-Host "::error::Installer failed with exit code $exitCode!"
497+
exit 1
498+
}
499+
"$env:ProgramFiles\Git\usr\bin" | Out-File -Encoding ascii -Append $env:GITHUB_PATH
500+
"$env:ProgramFiles\Git\${{env.MINGW_PREFIX}}\bin" | Out-File -Encoding ascii -Append $env:GITHUB_PATH
501+
- name: Publish installer log
502+
if: matrix.artifact.name == 'installer' && (failure() || success())
503+
uses: actions/upload-artifact@v4
504+
with:
505+
name: installer.log
506+
path: installer.log
507+
- name: Validate installer
508+
if: matrix.artifact.name == 'installer'
509+
shell: bash
510+
run: |
511+
set -x &&
512+
grep 'Installation process succeeded' installer.log &&
513+
! grep -iw failed installer.log &&
514+
cygpath -aw / &&
515+
git.exe version --build-options >version &&
516+
cat version &&
517+
grep "$(sed -e 's|^v||' -e 's|-|.|g' <bundle-artifacts/next_version)" version &&
518+
checklist=${{ toJSON(steps.build-extra.outputs.result) }}/installer/run-checklist.sh &&
519+
# cannot test SSH keys in read-only mode, skip test for now
520+
sed -i 's|[email protected]:v3/git-for-windows/git/git|https://github.com/git/git|' $checklist &&
521+
sh -x $checklist
522+
- name: update check-run
523+
if: needs.pkg.outputs.check-run-state != '' && matrix.artifact.name == 'installer'
524+
uses: ./.github/actions/check-run-action
525+
with:
526+
app-id: ${{ secrets.GH_APP_ID }}
527+
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
528+
append-text: 'Validated the installer'
483529
- name: update check-run if failed or canceled
484530
if: needs.pkg.outputs.check-run-state != '' && (failure() || cancelled())
485531
uses: ./.github/actions/check-run-action

0 commit comments

Comments
 (0)