File tree Expand file tree Collapse file tree 5 files changed +43
-2
lines changed Expand file tree Collapse file tree 5 files changed +43
-2
lines changed Original file line number Diff line number Diff line change 1+ # ###############################################################################
2+ # # File: Install-ActionArchiveCache.ps1
3+ # # Desc: Download latest release from https://github.com/actions/action-versions
4+ # # and un-zip to C:\actionarchivecache
5+ # # Maintainer: #actions-runtime and @TingluoHuang
6+ # ###############################################################################
7+
8+ if (-not (Test-Path $env: ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE ))
9+ {
10+ Write-Host " Creating action archive cache folder"
11+ New-Item - ItemType Directory - Path $env: ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE | Out-Null
12+ }
13+
14+ $downloadUrl = Get-GitHubPackageDownloadUrl - RepoOwner " actions" - RepoName " action-versions" - Version " latest" - UrlFilter " */v{Version}/action-versions.zip"
15+ Write-Host " Download Latest action-versions archive from $downloadUrl "
16+ $actionVersionsArchivePath = Start-DownloadWithRetry - Url $downloadUrl - Name " action-versions.zip"
17+
18+ Write-Host " Expand action-versions archive"
19+ Extract- 7Zip - Path $actionVersionsArchivePath - DestinationPath $env: ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE
20+
21+ Invoke-PesterTests - TestFile " ActionArchiveCache"
Original file line number Diff line number Diff line change @@ -41,4 +41,5 @@ $json | Out-File -FilePath $imageDataFile
4141# Set static env vars
4242setx ImageVersion $env: IMAGE_VERSION / m
4343setx ImageOS $env: IMAGE_OS / m
44- setx AGENT_TOOLSDIRECTORY $env: AGENT_TOOLSDIRECTORY / m
44+ setx AGENT_TOOLSDIRECTORY $env: AGENT_TOOLSDIRECTORY / m
45+ setx ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE $env: ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE / m
Original file line number Diff line number Diff line change 1+ Describe " ActionArchiveCache" {
2+ Context " Action archive cache directory not empty" {
3+ It " C:\actionarchivecache not empty" {
4+ (Get-ChildItem - Path " C:\actionarchivecache\*.zip" - Recurse).Count | Should - BeGreaterThan 0
5+ }
6+ }
7+
8+ Context " Action zipball not empty" {
9+ $testCases = Get-ChildItem - Path " C:\actionarchivecache\*.zip" - Recurse | ForEach-Object { @ { ActionZipball = $_.FullName } }
10+ It " <ActionZipball>" - TestCases $testCases {
11+ param ([string ] $ActionZipball )
12+ (Get-Item " $ActionZipball " ).Length | Should - BeGreaterThan 0
13+ }
14+ }
15+ }
Original file line number Diff line number Diff line change 146146 " IMAGE_VERSION={{user `image_version`}}" ,
147147 " IMAGE_OS={{user `image_os`}}" ,
148148 " AGENT_TOOLSDIRECTORY={{user `agent_tools_directory`}}" ,
149+ " ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE=C:\\ actionarchivecache\\ " ,
149150 " IMAGEDATA_FILE={{user `imagedata_file`}}"
150151 ],
151152 "scripts" : [
225226 {
226227 "type" : " powershell" ,
227228 "scripts" : [
229+ " {{ template_dir }}/scripts/Installers/Install-ActionArchiveCache.ps1" ,
228230 " {{ template_dir }}/scripts/Installers/Install-Ruby.ps1" ,
229231 " {{ template_dir }}/scripts/Installers/Install-PyPy.ps1" ,
230232 " {{ template_dir }}/scripts/Installers/Install-Toolset.ps1" ,
362364 ]
363365 }
364366 ]
365- }
367+ }
Original file line number Diff line number Diff line change 130130 " IMAGE_VERSION={{user `image_version`}}" ,
131131 " IMAGE_OS={{user `image_os`}}" ,
132132 " AGENT_TOOLSDIRECTORY={{user `agent_tools_directory`}}" ,
133+ " ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE=C:\\ actionarchivecache\\ " ,
133134 " IMAGEDATA_FILE={{user `imagedata_file`}}"
134135 ],
135136 "scripts" : [
215216 {
216217 "type" : " powershell" ,
217218 "scripts" : [
219+ " {{ template_dir }}/scripts/Installers/Install-ActionArchiveCache.ps1" ,
218220 " {{ template_dir }}/scripts/Installers/Install-Ruby.ps1" ,
219221 " {{ template_dir }}/scripts/Installers/Install-PyPy.ps1" ,
220222 " {{ template_dir }}/scripts/Installers/Install-Toolset.ps1" ,
You can’t perform that action at this time.
0 commit comments