github workflow: make use of caches for nuget, gradle & xamarin

Speeds job by up to ~3-5 minutes
This commit is contained in:
tenzap
2022-12-11 17:30:40 +01:00
parent a74b162e37
commit 3483654830

View File

@@ -13,6 +13,24 @@ jobs:
- name: Fetch submodules
run: git submodule init && git submodule update
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Cache NuGet packages
uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('src/**/*.csproj', 'src/**/packages.config') }}
restore-keys: |
${{ runner.os }}-nuget-
# As per https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md#visual-studio-for-mac
- name: Switch to Visual Studio 2019
if: ${{ false }} # Not needed. We stay with the default 'Visual Studio 2022' of macos-12 runner.
@@ -107,12 +125,52 @@ jobs:
runs-on: ubuntu-22.04
env:
# Build Artifact of xamarin.android-oss dated 2021-02-02, master branch (= version 11.2.99) - *.deb cannot be installed because "lxd" package is not anymore shipped in current ubuntu version
#xamarin_url: https://artprodcus3.artifacts.visualstudio.com/Ad0adf05a-e7d7-4b65-96fe-3f3884d42038/6fd3d886-57a5-4e31-8db7-52a1b47c07a8/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL3hhbWFyaW4vcHJvamVjdElkLzZmZDNkODg2LTU3YTUtNGUzMS04ZGI3LTUyYTFiNDdjMDdhOC9idWlsZElkLzM0NTE3L2FydGlmYWN0TmFtZS9JbnN0YWxsZXJzKy0rTGludXg1/content?format=zip
# Build Artifact of xamarin.android-oss dated 2021-03-23, d16-9 branch (= version 11.2.2) - *.deb cannot be installed because "lxd" package is not anymore shipped in current ubuntu version
#xamarin_url: https://artprodcus3.artifacts.visualstudio.com/Ad0adf05a-e7d7-4b65-96fe-3f3884d42038/6fd3d886-57a5-4e31-8db7-52a1b47c07a8/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL3hhbWFyaW4vcHJvamVjdElkLzZmZDNkODg2LTU3YTUtNGUzMS04ZGI3LTUyYTFiNDdjMDdhOC9idWlsZElkLzM3Njg0L2FydGlmYWN0TmFtZS9JbnN0YWxsZXJzKy0rTGludXg1/content?format=zip
# Build Artifact of xamarin.android-oss dated 2021-07-21, master branch (= version 11.4.99)
xamarin_url: https://artprodcus3.artifacts.visualstudio.com/Ad0adf05a-e7d7-4b65-96fe-3f3884d42038/6fd3d886-57a5-4e31-8db7-52a1b47c07a8/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL3hhbWFyaW4vcHJvamVjdElkLzZmZDNkODg2LTU3YTUtNGUzMS04ZGI3LTUyYTFiNDdjMDdhOC9idWlsZElkLzQzNjU5L2FydGlmYWN0TmFtZS9pbnN0YWxsZXJzLXVuc2lnbmVkKy0rTGludXg1/content?format=zip
# Build Artifact of xamarin.android-oss dated 2022-02-16, master branch (= version 12.2.99) - Build fails with this version as of 2022-12-02 because there is some issue with SamsungPass. Removing SamsungPass would make the build succeed.
#xamarin_url: https://artprodcus3.artifacts.visualstudio.com/Ad0adf05a-e7d7-4b65-96fe-3f3884d42038/6fd3d886-57a5-4e31-8db7-52a1b47c07a8/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL3hhbWFyaW4vcHJvamVjdElkLzZmZDNkODg2LTU3YTUtNGUzMS04ZGI3LTUyYTFiNDdjMDdhOC9idWlsZElkLzU0OTUzL2FydGlmYWN0TmFtZS9pbnN0YWxsZXJzLXVuc2lnbmVkKy0rTGludXg1/content?format=zip
steps:
- uses: actions/checkout@v3
- name: Fetch submodules
run: git submodule init && git submodule update
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Cache NuGet packages
uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('src/**/*.csproj', 'src/**/packages.config') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Cache Xamarin.Android packages
id: xamarin_cache
uses: actions/cache@v3
with:
path: ~/xamarin.android-oss
key: ${{ runner.os }}-xamarin.android-oss-${{ env.xamarin_url }}
restore-keys: |
${{ runner.os }}-xamarin.android-oss-${{ env.xamarin_url }}
- name: Install Mono
if: ${{ false }} # disable for now since it is already installed on the runner which uses the same repo https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md#language-and-runtime
run: |
@@ -122,29 +180,22 @@ jobs:
sudo apt update &&
sudo apt-get -y -t stable-focal install mono-complete
- name: Install Xamarin.Android
- name: Download & unpack Xamarin.Android
if: steps.xamarin_cache.outputs.cache-hit != 'true'
run: |
set -x
cd $HOME
# Build Artifact of xamarin.android-oss dated 2021-02-02, master branch (= version 11.2.99) - *.deb cannot be installed because "lxd" package is not anymore shipped in current ubuntu version
#wget -O "installers-unsigned - Linux.zip" https://artprodcus3.artifacts.visualstudio.com/Ad0adf05a-e7d7-4b65-96fe-3f3884d42038/6fd3d886-57a5-4e31-8db7-52a1b47c07a8/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL3hhbWFyaW4vcHJvamVjdElkLzZmZDNkODg2LTU3YTUtNGUzMS04ZGI3LTUyYTFiNDdjMDdhOC9idWlsZElkLzM0NTE3L2FydGlmYWN0TmFtZS9JbnN0YWxsZXJzKy0rTGludXg1/content?format=zip &&
# Build Artifact of xamarin.android-oss dated 2021-03-23, d16-9 branch (= version 11.2.2) - *.deb cannot be installed because "lxd" package is not anymore shipped in current ubuntu version
#wget -O "installers-unsigned - Linux.zip" https://artprodcus3.artifacts.visualstudio.com/Ad0adf05a-e7d7-4b65-96fe-3f3884d42038/6fd3d886-57a5-4e31-8db7-52a1b47c07a8/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL3hhbWFyaW4vcHJvamVjdElkLzZmZDNkODg2LTU3YTUtNGUzMS04ZGI3LTUyYTFiNDdjMDdhOC9idWlsZElkLzM3Njg0L2FydGlmYWN0TmFtZS9JbnN0YWxsZXJzKy0rTGludXg1/content?format=zip &&
# Build Artifact of xamarin.android-oss dated 2021-07-21, master branch (= version 11.4.99)
wget -O "installers-unsigned - Linux.zip" https://artprodcus3.artifacts.visualstudio.com/Ad0adf05a-e7d7-4b65-96fe-3f3884d42038/6fd3d886-57a5-4e31-8db7-52a1b47c07a8/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL3hhbWFyaW4vcHJvamVjdElkLzZmZDNkODg2LTU3YTUtNGUzMS04ZGI3LTUyYTFiNDdjMDdhOC9idWlsZElkLzQzNjU5L2FydGlmYWN0TmFtZS9pbnN0YWxsZXJzLXVuc2lnbmVkKy0rTGludXg1/content?format=zip &&
# Build Artifact of xamarin.android-oss dated 2022-02-16, master branch (= version 12.2.99) - Build fails with this version as of 2022-12-02 because there is some issue with SamsungPass. Removing SamsungPass would make the build succeed.
#wget -O "installers-unsigned - Linux.zip" https://artprodcus3.artifacts.visualstudio.com/Ad0adf05a-e7d7-4b65-96fe-3f3884d42038/6fd3d886-57a5-4e31-8db7-52a1b47c07a8/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL3hhbWFyaW4vcHJvamVjdElkLzZmZDNkODg2LTU3YTUtNGUzMS04ZGI3LTUyYTFiNDdjMDdhOC9idWlsZElkLzU0OTUzL2FydGlmYWN0TmFtZS9pbnN0YWxsZXJzLXVuc2lnbmVkKy0rTGludXg1/content?format=zip &&
cd $HOME &&
wget -O "installers-unsigned - Linux.zip" ${{ env.xamarin_url }} &&
unzip "installers-unsigned - Linux.zip" &&
mkdir -p xamarin.android-oss &&
DIR=$(unzip -Z -1 installers-unsigned\ -\ Linux.zip | cut -d '/' -f1 | sort -u) &&
tar -xvf "$DIR"/xamarin.android-oss-*.tar.* --strip-components=1 -C xamarin.android-oss &&
sudo apt install -y ./"$DIR"/*.deb
mv "$DIR"/*.deb xamarin.android-oss
- name: Setup Xamarin.Android
run: |
cd $HOME &&
sudo apt install -y ./xamarin.android-oss/*.deb &&
echo "$HOME/xamarin.android-oss/bin/Release/bin" >> $GITHUB_PATH
- name: Switch to JDK-8
@@ -237,6 +288,24 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Cache NuGet packages
uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('src/**/*.csproj', 'src/**/packages.config') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Fetch submodules
run: git submodule init && git submodule update
@@ -308,3 +377,20 @@ jobs:
- name: Perform "make distclean"
run: make distclean
# Stop gradle daemon so as to be able to save the Gradle cache
# Otherwise, error is: tar.exe: Couldn't open C:/Users/runneradmin/.gradle/caches/transforms-2/transforms-2.lock: Permission denied
- name: Stop gradle daemon
shell: cmd
run: |
echo on
call src\java\JavaFileStorageTest-AS\gradlew.bat --stop
echo on
call src\java\KP2ASoftkeyboard_AS\gradlew.bat --stop
echo on
call src\java\Keepass2AndroidPluginSDK2\gradlew.bat --stop
echo on
call src\java\KP2AKdbLibrary\gradlew.bat --stop
echo on
call src\java\PluginQR\gradlew.bat --stop
echo on