mirror of
https://github.com/git-for-windows/git.git
synced 2026-03-17 13:23:05 -05:00
git-artifacts: cache the build-installers artifact
It is a bit expensive to fetch just the git-sdk-64-build-installers artifact from Azure Pipelines and then to unpack it (takes some 6-7 minutes, typically). Let's cache it if possible. Signed-off-by: Dennis Ameling <dennis@dennisameling.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
committed by
Johannes Schindelin
parent
075f57a285
commit
21aa8b5a28
89
.github/workflows/git-artifacts.yml
vendored
89
.github/workflows/git-artifacts.yml
vendored
@@ -24,6 +24,8 @@ env:
|
||||
jobs:
|
||||
bundle-artifacts:
|
||||
runs-on: windows-latest
|
||||
outputs:
|
||||
latest-sdk64-extra-build-id: ${{ steps.determine-latest-sdk64-extra-build-id.outputs.id }}
|
||||
steps:
|
||||
- name: Configure user
|
||||
shell: bash
|
||||
@@ -34,15 +36,31 @@ jobs:
|
||||
git config --global user.name "$USER_NAME" &&
|
||||
git config --global user.email "$USER_EMAIL" &&
|
||||
echo "PACKAGER=$USER_NAME <$USER_EMAIL>" >>$GITHUB_ENV
|
||||
- name: Determine latest git-sdk-64-extra-artifacts build ID
|
||||
id: determine-latest-sdk64-extra-build-id
|
||||
shell: bash
|
||||
run: |
|
||||
urlbase=https://dev.azure.com/git-for-windows/git/_apis/build/builds
|
||||
id=$(curl "$urlbase?definitions=29&statusFilter=completed&resultFilter=succeeded&\$top=1" |
|
||||
jq -r '.value[0].id')
|
||||
|
||||
echo "Latest ID is ${id}"
|
||||
echo "::set-output name=id::$id"
|
||||
- name: Cache git-sdk-64-build-installers
|
||||
id: cache-sdk-build-installers
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: git-sdk-64-build-installers
|
||||
key: build-installers-64-${{ steps.determine-latest-sdk64-extra-build-id.outputs.id }}
|
||||
- name: Download git-sdk-64-build-installers
|
||||
if: steps.cache-sdk-build-installers.outputs.cache-hit != 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
# Use Git Bash to download and unpack the artifact
|
||||
|
||||
## Get artifact
|
||||
urlbase=https://dev.azure.com/git-for-windows/git/_apis/build/builds
|
||||
id=$(curl "$urlbase?definitions=29&statusFilter=completed&resultFilter=succeeded&\$top=1" |
|
||||
jq -r '.value[0].id')
|
||||
id=${{ steps.determine-latest-sdk64-extra-build-id.outputs.id }}
|
||||
download_url=$(curl "$urlbase/$id/artifacts" |
|
||||
jq -r '.value[] | select(.name == "git-sdk-64-build-installers").resource.downloadUrl')
|
||||
|
||||
@@ -54,7 +72,13 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
d=git-sdk-64-build-installers/usr/src/build-extra &&
|
||||
git clone --single-branch -b main https://github.com/git-for-windows/build-extra $d
|
||||
if test ! -d $d/.git
|
||||
then
|
||||
git clone --single-branch -b main https://github.com/git-for-windows/build-extra $d
|
||||
else
|
||||
git -C $d fetch https://github.com/git-for-windows/build-extra main &&
|
||||
git -C $d switch -C main FETCH_HEAD
|
||||
fi
|
||||
- name: Prepare home directory for GPG signing
|
||||
if: env.GPGKEY != ''
|
||||
shell: bash
|
||||
@@ -104,6 +128,8 @@ jobs:
|
||||
pkg:
|
||||
runs-on: windows-latest
|
||||
needs: bundle-artifacts
|
||||
outputs:
|
||||
latest-sdk64-extra-build-id: ${{ needs.bundle-artifacts.outputs.latest-sdk64-extra-build-id }}
|
||||
strategy:
|
||||
matrix:
|
||||
arch:
|
||||
@@ -264,8 +290,15 @@ jobs:
|
||||
with:
|
||||
name: bundle-artifacts
|
||||
path: bundle-artifacts
|
||||
- name: Download git-sdk-64-build-installers
|
||||
- name: Cache git-sdk-64-build-installers
|
||||
if: env.SKIP != 'true' && matrix.arch.bitness == '64'
|
||||
id: cache-sdk64-build-installers
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: git-sdk-64-build-installers
|
||||
key: build-installers-64-${{ needs.pkg.outputs.latest-sdk64-extra-build-id }}
|
||||
- name: Download git-sdk-64-build-installers
|
||||
if: env.SKIP != 'true' && matrix.arch.bitness == '64' && steps.cache-sdk64-build-installers.outputs.cache-hit != 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
# Use Git Bash to download and unpack the artifact
|
||||
@@ -280,16 +313,33 @@ jobs:
|
||||
|
||||
## Unpack artifact
|
||||
unzip artifacts.zip
|
||||
- name: Download git-sdk-32-build-installers
|
||||
- name: Determine latest git-sdk-32-extra-artifacts build ID
|
||||
if: env.SKIP != 'true' && matrix.arch.bitness == '32'
|
||||
id: determine-latest-sdk32-extra-build-id
|
||||
shell: bash
|
||||
run: |
|
||||
urlbase=https://dev.azure.com/git-for-windows/git/_apis/build/builds
|
||||
id=$(curl "$urlbase?definitions=30&statusFilter=completed&resultFilter=succeeded&\$top=1" |
|
||||
jq -r '.value[0].id')
|
||||
|
||||
echo "Latest ID is ${id}"
|
||||
echo "::set-output name=id::$id"
|
||||
- name: Cache git-sdk-32-build-installers
|
||||
if: env.SKIP != 'true' && matrix.arch.bitness == '32'
|
||||
id: cache-sdk32-build-installers
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: git-sdk-32-build-installers
|
||||
key: build-installers-32-${{ steps.determine-latest-sdk32-extra-build-id.outputs.id }}
|
||||
- name: Download git-sdk-32-build-installers
|
||||
if: env.SKIP != 'true' && matrix.arch.bitness == '32' && steps.cache-sdk32-build-installers.outputs.cache-hit != 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
# Use Git Bash to download and unpack the artifact
|
||||
|
||||
## Get artifact
|
||||
urlbase=https://dev.azure.com/git-for-windows/git/_apis/build/builds
|
||||
id=$(curl "$urlbase?definitions=30&statusFilter=completed&resultFilter=succeeded&\$top=1" |
|
||||
jq -r '.value[0].id')
|
||||
id=${{ steps.determine-latest-sdk32-extra-build-id.outputs.id }}
|
||||
download_url=$(curl "$urlbase/$id/artifacts" |
|
||||
jq -r '.value[] | select(.name == "git-sdk-32-build-installers").resource.downloadUrl')
|
||||
|
||||
@@ -302,7 +352,13 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
d=git-sdk-${{matrix.arch.bitness}}-build-installers/usr/src/build-extra &&
|
||||
git clone --single-branch -b main https://github.com/git-for-windows/build-extra $d &&
|
||||
if test ! -d $d/.git
|
||||
then
|
||||
git clone --single-branch -b main https://github.com/git-for-windows/build-extra $d
|
||||
else
|
||||
git -C $d fetch https://github.com/git-for-windows/build-extra main &&
|
||||
git -C $d switch -C main FETCH_HEAD
|
||||
fi &&
|
||||
git -C $d pull "$PWD"/bundle-artifacts/build-extra.bundle main
|
||||
- name: Prepare home directory for code-signing
|
||||
env:
|
||||
@@ -376,8 +432,15 @@ jobs:
|
||||
with:
|
||||
name: bundle-artifacts
|
||||
path: bundle-artifacts
|
||||
- name: Download git-sdk-64-build-installers
|
||||
- name: Cache git-sdk-64-build-installers
|
||||
if: env.SKIP != 'true'
|
||||
id: cache-sdk-build-installers
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: git-sdk-64-build-installers
|
||||
key: build-installers-64-${{ needs.pkg.outputs.latest-sdk64-extra-build-id }}
|
||||
- name: Download git-sdk-64-build-installers
|
||||
if: env.SKIP != 'true' && steps.cache-sdk-build-installers.outputs.cache-hit != 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
# Use Git Bash to download and unpack the artifact
|
||||
@@ -397,7 +460,13 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
d=git-sdk-64-build-installers/usr/src/build-extra &&
|
||||
git clone --single-branch -b main https://github.com/git-for-windows/build-extra $d &&
|
||||
if test ! -d $d/.git
|
||||
then
|
||||
git clone --single-branch -b main https://github.com/git-for-windows/build-extra $d
|
||||
else
|
||||
git -C $d fetch https://github.com/git-for-windows/build-extra main &&
|
||||
git -C $d switch -C main FETCH_HEAD
|
||||
fi &&
|
||||
git -C $d pull "$PWD"/bundle-artifacts/build-extra.bundle main
|
||||
- uses: nuget/setup-nuget@v1
|
||||
if: env.SKIP != 'true'
|
||||
|
||||
Reference in New Issue
Block a user