Skip to content

Commit

Permalink
git-artifacts: cache the build-installers artifact
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
  • Loading branch information
dennisameling authored and dscho committed Aug 4, 2021
1 parent a6833de commit a21a90a
Showing 1 changed file with 79 additions and 10 deletions.
89 changes: 79 additions & 10 deletions .github/workflows/git-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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')
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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')
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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'
Expand Down

0 comments on commit a21a90a

Please sign in to comment.