forked from actions/runner-images
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Windows] cache most used GitHub actions
* Download actions/action_versions latest release on Windows and set ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE. * feedback * fix get latest package on Windows. * invoke test
- Loading branch information
1 parent
a80012b
commit c7517ab
Showing
5 changed files
with
43 additions
and
2 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
images/win/scripts/Installers/Install-ActionArchiveCache.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
################################################################################ | ||
## File: Install-ActionArchiveCache.ps1 | ||
## Desc: Download latest release from https://github.com/actions/action-versions | ||
## and un-zip to C:\actionarchivecache | ||
## Maintainer: #actions-runtime and @TingluoHuang | ||
################################################################################ | ||
|
||
if (-not (Test-Path $env:ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE)) | ||
{ | ||
Write-Host "Creating action archive cache folder" | ||
New-Item -ItemType Directory -Path $env:ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE | Out-Null | ||
} | ||
|
||
$downloadUrl = Get-GitHubPackageDownloadUrl -RepoOwner "actions" -RepoName "action-versions" -Version "latest" -UrlFilter "*/v{Version}/action-versions.zip" | ||
Write-Host "Download Latest action-versions archive from $downloadUrl" | ||
$actionVersionsArchivePath = Start-DownloadWithRetry -Url $downloadUrl -Name "action-versions.zip" | ||
|
||
Write-Host "Expand action-versions archive" | ||
Extract-7Zip -Path $actionVersionsArchivePath -DestinationPath $env:ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE | ||
|
||
Invoke-PesterTests -TestFile "ActionArchiveCache" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Describe "ActionArchiveCache" { | ||
Context "Action archive cache directory not empty" { | ||
It "C:\actionarchivecache not empty" { | ||
(Get-ChildItem -Path "C:\actionarchivecache\*.zip" -Recurse).Count | Should -BeGreaterThan 0 | ||
} | ||
} | ||
|
||
Context "Action zipball not empty" { | ||
$testCases = Get-ChildItem -Path "C:\actionarchivecache\*.zip" -Recurse | ForEach-Object { @{ ActionZipball = $_.FullName } } | ||
It "<ActionZipball>" -TestCases $testCases { | ||
param ([string] $ActionZipball) | ||
(Get-Item "$ActionZipball").Length | Should -BeGreaterThan 0 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters