Skip to content

Commit bb7932d

Browse files
authored
[macOS] Add actions/runner cache (#11713)
1 parent 0f4b96d commit bb7932d

8 files changed

+34
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash -e -o pipefail
2+
################################################################################
3+
## File: install-runner-package.sh
4+
## Desc: Download and Install runner package
5+
################################################################################
6+
7+
# Source the helpers for use with the script
8+
source ~/utils/utils.sh
9+
10+
AGENT_PATH="/opt/runner-cache"
11+
arch=$(get_arch)
12+
download_url=$(resolve_github_release_asset_url "actions/runner" 'test("actions-runner-osx-'"$arch"'-[0-9]+\\.[0-9]{3}\\.[0-9]+\\.tar\\.gz$")' "latest")
13+
archive_name="${download_url##*/}"
14+
archive_path=$(download_with_retry "$download_url")
15+
16+
if [[ ! -d $AGENT_PATH ]]; then
17+
sudo mkdir -p -m 775 $AGENT_PATH
18+
sudo chown $USER:admin $AGENT_PATH
19+
fi
20+
21+
sudo mv "$archive_path" "$AGENT_PATH/$archive_name"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Describe "RunnerCache" {
2+
Context "runner cache directory not empty" {
3+
It "<RunnerCachePath> not empty" -TestCases @{ RunnerCachePath = "/opt/runner-cache" } {
4+
(Get-ChildItem -Path "$RunnerCachePath/*.tar.gz" -Recurse).Count | Should -BeGreaterThan 0
5+
}
6+
}
7+
}

images/macos/templates/macOS-13.anka.pkr.hcl

+1
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ build {
236236
execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}"
237237
scripts = [
238238
"${path.root}/../scripts/build/install-actions-cache.sh",
239+
"${path.root}/../scripts/build/install-runner-package.sh",
239240
"${path.root}/../scripts/build/install-llvm.sh",
240241
"${path.root}/../scripts/build/install-swiftlint.sh",
241242
"${path.root}/../scripts/build/install-openjdk.sh",

images/macos/templates/macOS-13.arm64.anka.pkr.hcl

+1
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ build {
237237
execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}"
238238
scripts = [
239239
"${path.root}/../scripts/build/install-actions-cache.sh",
240+
"${path.root}/../scripts/build/install-runner-package.sh",
240241
"${path.root}/../scripts/build/install-llvm.sh",
241242
"${path.root}/../scripts/build/install-openjdk.sh",
242243
"${path.root}/../scripts/build/install-aws-tools.sh",

images/macos/templates/macOS-14.anka.pkr.hcl

+1
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ build {
235235
execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}"
236236
scripts = [
237237
"${path.root}/../scripts/build/install-actions-cache.sh",
238+
"${path.root}/../scripts/build/install-runner-package.sh",
238239
"${path.root}/../scripts/build/install-llvm.sh",
239240
"${path.root}/../scripts/build/install-swiftlint.sh",
240241
"${path.root}/../scripts/build/install-openjdk.sh",

images/macos/templates/macOS-14.arm64.anka.pkr.hcl

+1
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ build {
236236
execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}"
237237
scripts = [
238238
"${path.root}/../scripts/build/install-actions-cache.sh",
239+
"${path.root}/../scripts/build/install-runner-package.sh",
239240
"${path.root}/../scripts/build/install-llvm.sh",
240241
"${path.root}/../scripts/build/install-openjdk.sh",
241242
"${path.root}/../scripts/build/install-aws-tools.sh",

images/macos/templates/macOS-15.anka.pkr.hcl

+1
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ build {
233233
execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}"
234234
scripts = [
235235
"${path.root}/../scripts/build/install-actions-cache.sh",
236+
"${path.root}/../scripts/build/install-runner-package.sh",
236237
"${path.root}/../scripts/build/install-llvm.sh",
237238
"${path.root}/../scripts/build/install-swiftlint.sh",
238239
"${path.root}/../scripts/build/install-openjdk.sh",

images/macos/templates/macOS-15.arm64.anka.pkr.hcl

+1
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ build {
235235
execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}"
236236
scripts = [
237237
"${path.root}/../scripts/build/install-actions-cache.sh",
238+
"${path.root}/../scripts/build/install-runner-package.sh",
238239
"${path.root}/../scripts/build/install-llvm.sh",
239240
"${path.root}/../scripts/build/install-openjdk.sh",
240241
"${path.root}/../scripts/build/install-aws-tools.sh",

0 commit comments

Comments
 (0)