mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-20 06:29:50 +00:00
[macOS] cache most used GitHub actions
* Download actions/action_versions latest release on macOS and set ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE. * Feedback.
This commit is contained in:
@@ -12,6 +12,7 @@ export NUNIT3_PATH=/Library/Developer/nunit/3.6.0
|
|||||||
|
|
||||||
export AGENT_TOOLSDIRECTORY=$HOME/hostedtoolcache
|
export AGENT_TOOLSDIRECTORY=$HOME/hostedtoolcache
|
||||||
export RUNNER_TOOL_CACHE=$HOME/hostedtoolcache
|
export RUNNER_TOOL_CACHE=$HOME/hostedtoolcache
|
||||||
|
export ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE=$HOME/actionarchivecache
|
||||||
|
|
||||||
export PATH=/Library/Frameworks/Mono.framework/Versions/Current/Commands:$PATH
|
export PATH=/Library/Frameworks/Mono.framework/Versions/Current/Commands:$PATH
|
||||||
export PATH=/Library/Frameworks/Python.framework/Versions/Current/bin:$PATH
|
export PATH=/Library/Frameworks/Python.framework/Versions/Current/bin:$PATH
|
||||||
|
|||||||
22
images/macos/provision/core/action-archive-cache.sh
Executable file
22
images/macos/provision/core/action-archive-cache.sh
Executable file
@@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/bash -e -o pipefail
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
## File: action-archive-cache.sh
|
||||||
|
## Desc: Download latest release from https://github.com/actions/action-verions
|
||||||
|
## and un-tar to $HOME/actionarchivecache
|
||||||
|
## Maintainer: #actions-runtime and @TingluoHuang
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
source ~/utils/utils.sh
|
||||||
|
|
||||||
|
echo "Check if ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE folder exist..."
|
||||||
|
if [ ! -d $ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE ]; then
|
||||||
|
mkdir -p $ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE
|
||||||
|
fi
|
||||||
|
|
||||||
|
downloadUrl=$(get_github_package_download_url "actions/action-versions" "contains(\"action-versions.tar.gz\")" "latest")
|
||||||
|
echo "Downloading action-versions $downloadUrl"
|
||||||
|
download_with_retries "$downloadUrl" "/tmp" action-versions.tar.gz
|
||||||
|
tar -xzf /tmp/action-versions.tar.gz -C $ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE
|
||||||
|
|
||||||
|
invoke_tests "ActionArchiveCache"
|
||||||
@@ -183,6 +183,7 @@
|
|||||||
"type": "shell",
|
"type": "shell",
|
||||||
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}",
|
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}",
|
||||||
"scripts": [
|
"scripts": [
|
||||||
|
"./provision/core/action-archive-cache.sh",
|
||||||
"./provision/core/commonutils.sh",
|
"./provision/core/commonutils.sh",
|
||||||
"./provision/core/llvm.sh",
|
"./provision/core/llvm.sh",
|
||||||
"./provision/core/golang.sh",
|
"./provision/core/golang.sh",
|
||||||
|
|||||||
@@ -198,6 +198,7 @@ build {
|
|||||||
}
|
}
|
||||||
provisioner "shell" {
|
provisioner "shell" {
|
||||||
scripts = [
|
scripts = [
|
||||||
|
"./provision/core/action-archive-cache.sh",
|
||||||
"./provision/core/llvm.sh",
|
"./provision/core/llvm.sh",
|
||||||
"./provision/core/golang.sh",
|
"./provision/core/golang.sh",
|
||||||
"./provision/core/swiftlint.sh",
|
"./provision/core/swiftlint.sh",
|
||||||
|
|||||||
@@ -185,6 +185,7 @@
|
|||||||
"type": "shell",
|
"type": "shell",
|
||||||
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}",
|
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}",
|
||||||
"scripts": [
|
"scripts": [
|
||||||
|
"./provision/core/action-archive-cache.sh",
|
||||||
"./provision/core/llvm.sh",
|
"./provision/core/llvm.sh",
|
||||||
"./provision/core/golang.sh",
|
"./provision/core/golang.sh",
|
||||||
"./provision/core/swiftlint.sh",
|
"./provision/core/swiftlint.sh",
|
||||||
|
|||||||
@@ -194,6 +194,7 @@ build {
|
|||||||
}
|
}
|
||||||
provisioner "shell" {
|
provisioner "shell" {
|
||||||
scripts = [
|
scripts = [
|
||||||
|
"./provision/core/action-archive-cache.sh",
|
||||||
"./provision/core/llvm.sh",
|
"./provision/core/llvm.sh",
|
||||||
"./provision/core/swiftlint.sh",
|
"./provision/core/swiftlint.sh",
|
||||||
"./provision/core/openjdk.sh",
|
"./provision/core/openjdk.sh",
|
||||||
|
|||||||
@@ -194,6 +194,7 @@ build {
|
|||||||
}
|
}
|
||||||
provisioner "shell" {
|
provisioner "shell" {
|
||||||
scripts = [
|
scripts = [
|
||||||
|
"./provision/core/action-archive-cache.sh",
|
||||||
"./provision/core/llvm.sh",
|
"./provision/core/llvm.sh",
|
||||||
"./provision/core/openjdk.sh",
|
"./provision/core/openjdk.sh",
|
||||||
"./provision/core/rust.sh",
|
"./provision/core/rust.sh",
|
||||||
|
|||||||
15
images/macos/tests/ActionArchiveCache.Tests.ps1
Normal file
15
images/macos/tests/ActionArchiveCache.Tests.ps1
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
Describe "ActionArchiveCache" {
|
||||||
|
Context "Action archive cache directory not empty" {
|
||||||
|
It "$HOME/actionarchivecache not empty" {
|
||||||
|
(Get-ChildItem -Path "$env:HOME/actionarchivecache/*.tar.gz" -Recurse).Count | Should -BeGreaterThan 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Context "Action tarball not empty" {
|
||||||
|
$testCases = Get-ChildItem -Path "$env:HOME/actionarchivecache/*.tar.gz" -Recurse | ForEach-Object { @{ ActionTarball = $_.FullName } }
|
||||||
|
It "<ActionTarball>" -TestCases $testCases {
|
||||||
|
param ([string] $ActionTarball)
|
||||||
|
(Get-Item "$ActionTarball").Length | Should -BeGreaterThan 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user