From: Patrick Steinhardt <ps@pks.im>
To: git@vger.kernel.org
Cc: Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: [PATCH 2/5] ci: create script to set up Git for Windows SDK
Date: Wed, 9 Oct 2024 15:25:21 +0200 [thread overview]
Message-ID: <9f36f2125f0f17b173aa0cf9ed2e7df66cd8e76f.1728480039.git.ps@pks.im> (raw)
In-Reply-To: <cover.1728480039.git.ps@pks.im>
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>
---
.github/workflows/main.yml | 16 ++++++++++------
ci/install-sdk.ps1 | 12 ++++++++++++
2 files changed, 22 insertions(+), 6 deletions(-)
create mode 100755 ci/install-sdk.ps1
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 916a64b673..9301a1edd6 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -113,13 +113,15 @@ jobs:
cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
steps:
- uses: actions/checkout@v4
- - uses: git-for-windows/setup-git-for-windows-sdk@v1
+ - name: setup SDK
+ shell: powershell
+ run: ci/install-sdk.ps1
- name: build
- shell: bash
+ shell: powershell
env:
HOME: ${{runner.workspace}}
NO_PERL: 1
- run: . /etc/profile && ci/make-test-artifacts.sh artifacts
+ run: git-sdk/usr/bin/bash.exe -l -c 'ci/make-test-artifacts.sh artifacts'
- name: zip up tracked files
run: git archive -o artifacts/tracked.tar.gz HEAD
- name: upload tracked files and build artifacts
@@ -147,10 +149,12 @@ jobs:
- name: extract tracked files and build artifacts
shell: bash
run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz
- - uses: git-for-windows/setup-git-for-windows-sdk@v1
+ - name: setup SDK
+ shell: powershell
+ run: ci/install-sdk.ps1
- name: test
- shell: bash
- run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10
+ shell: powershell
+ run: git-sdk/usr/bin/bash.exe -l -c 'ci/run-test-slice.sh ${{matrix.nr}} 10'
- name: print test failures
if: failure() && env.FAILED_TEST_ARTIFACTS != ''
shell: bash
diff --git a/ci/install-sdk.ps1 b/ci/install-sdk.ps1
new file mode 100755
index 0000000000..66f24838a4
--- /dev/null
+++ b/ci/install-sdk.ps1
@@ -0,0 +1,12 @@
+param(
+ [string]$directory='git-sdk',
+ [string]$url='https://github.com/git-for-windows/git-sdk-64/releases/download/ci-artifacts/git-sdk-x86_64-minimal.zip'
+)
+
+Invoke-WebRequest "$url" -OutFile git-sdk.zip
+Expand-Archive -LiteralPath git-sdk.zip -DestinationPath "$directory"
+Remove-Item -Path git-sdk.zip
+
+New-Item -Path .git/info -ItemType Directory -Force
+New-Item -Path .git/info/exclude -ItemType File -Force
+Add-Content -Path .git/info/exclude -Value "/$directory"
--
2.47.0.rc1.33.g90fe3800b9.dirty
next prev parent reply other threads:[~2024-10-09 13:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-09 13:25 [PATCH 0/5] Wire up Windows-based jobs in GitLab CI Patrick Steinhardt
2024-10-09 13:25 ` [PATCH 1/5] t7300: work around platform-specific behaviour with long paths on MinGW Patrick Steinhardt
2024-10-09 18:31 ` Junio C Hamano
2024-10-10 5:56 ` Patrick Steinhardt
2024-10-09 13:25 ` Patrick Steinhardt [this message]
2024-10-09 13:25 ` [PATCH 3/5] ci: handle Windows-based CI jobs in GitLab CI Patrick Steinhardt
2024-10-09 13:25 ` [PATCH 4/5] gitlab-ci: introduce stages and dependencies Patrick Steinhardt
2024-10-09 13:25 ` [PATCH 5/5] gitlab-ci: exercise Git on Windows Patrick Steinhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9f36f2125f0f17b173aa0cf9ed2e7df66cd8e76f.1728480039.git.ps@pks.im \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--cc=johannes.schindelin@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).