Git fork

ci: create script to set up Git for Windows SDK

In order to build and test Git, we have to first set up the Git for
Windows SDK, which contains various required tools and libraries. The
SDK is basically a clone of [1], but that repository is quite large due
to all the binaries it contains. We thus use both shallow clones and
sparse checkouts to speed up the setup. To handle this complexity we use
a GitHub action that is hosted externally at [2].

Unfortunately, this makes it rather hard to reuse the logic for CI
platforms other than GitHub Actions. After chatting with Johannes
Schindelin we came to the conclusion that it would be nice if the Git
for Windows SDK would regularly publish releases that one can easily
download and extract, thus moving all of the complexity into that single
step. Like this, all that a CI job needs to do is to fetch and extract
the resulting archive. This published release comes in the form of a new
"ci-artifacts" tag that gets updated regularly [3].

Implement a new script that knows how to fetch and extract that script
and convert GitHub Actions to use it.

[1]: https://github.com/git-for-windows/git-sdk-64/
[2]: https://github.com/git-for-windows/setup-git-for-windows-sdk/
[3]: https://github.com/git-for-windows/git-sdk-64/releases/tag/ci-artifacts/

Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Patrick Steinhardt and committed by
Junio C Hamano
91839a88 106834e3

+22 -6
+10 -6
.github/workflows/main.yml
··· 113 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }} 114 steps: 115 - uses: actions/checkout@v4 116 - - uses: git-for-windows/setup-git-for-windows-sdk@v1 117 - name: build 118 - shell: bash 119 env: 120 HOME: ${{runner.workspace}} 121 NO_PERL: 1 122 - run: . /etc/profile && ci/make-test-artifacts.sh artifacts 123 - name: zip up tracked files 124 run: git archive -o artifacts/tracked.tar.gz HEAD 125 - name: upload tracked files and build artifacts ··· 147 - name: extract tracked files and build artifacts 148 shell: bash 149 run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz 150 - - uses: git-for-windows/setup-git-for-windows-sdk@v1 151 - name: test 152 - shell: bash 153 - run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10 154 - name: print test failures 155 if: failure() && env.FAILED_TEST_ARTIFACTS != '' 156 shell: bash
··· 113 cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }} 114 steps: 115 - uses: actions/checkout@v4 116 + - name: setup SDK 117 + shell: powershell 118 + run: ci/install-sdk.ps1 119 - name: build 120 + shell: powershell 121 env: 122 HOME: ${{runner.workspace}} 123 NO_PERL: 1 124 + run: git-sdk/usr/bin/bash.exe -l -c 'ci/make-test-artifacts.sh artifacts' 125 - name: zip up tracked files 126 run: git archive -o artifacts/tracked.tar.gz HEAD 127 - name: upload tracked files and build artifacts ··· 149 - name: extract tracked files and build artifacts 150 shell: bash 151 run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz 152 + - name: setup SDK 153 + shell: powershell 154 + run: ci/install-sdk.ps1 155 - name: test 156 + shell: powershell 157 + run: git-sdk/usr/bin/bash.exe -l -c 'ci/run-test-slice.sh ${{matrix.nr}} 10' 158 - name: print test failures 159 if: failure() && env.FAILED_TEST_ARTIFACTS != '' 160 shell: bash
+12
ci/install-sdk.ps1
···
··· 1 + param( 2 + [string]$directory='git-sdk', 3 + [string]$url='https://github.com/git-for-windows/git-sdk-64/releases/download/ci-artifacts/git-sdk-x86_64-minimal.zip' 4 + ) 5 + 6 + Invoke-WebRequest "$url" -OutFile git-sdk.zip 7 + Expand-Archive -LiteralPath git-sdk.zip -DestinationPath "$directory" 8 + Remove-Item -Path git-sdk.zip 9 + 10 + New-Item -Path .git/info -ItemType Directory -Force 11 + New-Item -Path .git/info/exclude -ItemType File -Force 12 + Add-Content -Path .git/info/exclude -Value "/$directory"