Skip to content

Commit

Permalink
build(ci): Use cache in GitHub Actions (ScoopInstaller#4671)
Browse files Browse the repository at this point in the history
  • Loading branch information
niheaven authored Mar 2, 2022
1 parent b740e98 commit 765d3aa
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 15 deletions.
24 changes: 15 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests
name: Scoop Core CI Tests

on:
pull_request:
Expand All @@ -13,11 +13,14 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Init and Test
- name: Init Test Suite
uses: potatoqualitee/psmodulecache@v4
with:
modules-to-cache: PSScriptAnalyzer, BuildHelpers, Pester:4.10.1
shell: powershell
- name: Test Scoop Core
shell: powershell
run: |
.\test\bin\init.ps1
.\test\bin\test.ps1
run: ./test/bin/test.ps1
test_pwsh:
name: PowerShell
runs-on: windows-latest
Expand All @@ -26,8 +29,11 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Init and Test
- name: Init Test Suite
uses: potatoqualitee/psmodulecache@v4
with:
modules-to-cache: PSScriptAnalyzer, BuildHelpers, Pester:4.10.1
shell: pwsh
- name: Test Scoop Core
shell: pwsh
run: |
.\test\bin\init.ps1
.\test\bin\test.ps1
run: ./test/bin/test.ps1
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
- **schema:** Fix typo ('note' -> 'notes') ([#4678](https://github.com/ScoopInstaller/Scoop/issues/4678))
- **tests:** Support both AppVeyor and GitHub Actions ([#4655](https://github.com/ScoopInstaller/Scoop/issues/4655))
- **tests:** Run GitHub Actions CI on each commit ([#4664](https://github.com/ScoopInstaller/Scoop/issues/4664))
- **tests:** Use cache in GitHub Actions ([#4671](https://github.com/ScoopInstaller/Scoop/issues/4671))
- **tests:** Disable CI test on 'push' ([#4677](https://github.com/ScoopInstaller/Scoop/issues/4677))
- **vscode-settings:** Remove 'formatOnSave' trigger ([#4635](https://github.com/ScoopInstaller/Scoop/issues/4635))

Expand Down
24 changes: 20 additions & 4 deletions test/bin/init.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
#Requires -Version 5.0
#Requires -Version 5.1
Write-Host "PowerShell: $($PSVersionTable.PSVersion)"
Write-Host (7z.exe | Select-String -Pattern '7-Zip').ToString()
Write-Host 'Install testsuite dependencies ...'
Install-Module -Repository PSGallery -Scope CurrentUser -Force -Name Pester -RequiredVersion 4.10.1 -SkipPublisherCheck
Install-Module -Repository PSGallery -Scope CurrentUser -Force -Name PSScriptAnalyzer, BuildHelpers
Write-Host 'Check and install testsuite dependencies ...'
if (Get-InstalledModule -Name Pester -MinimumVersion 4.0 -MaximumVersion 4.99 -ErrorAction SilentlyContinue) {
Write-Host 'Pester 4 is already installed.'
} else {
Write-Host 'Installing Pester 4 ...'
Install-Module -Repository PSGallery -Scope CurrentUser -Force -Name Pester -MinimumVersion 4.0 -MaximumVersion 4.99 -SkipPublisherCheck
}
if (Get-InstalledModule -Name PSScriptAnalyzer -MinimumVersion 1.17 -ErrorAction SilentlyContinue) {
Write-Host 'PSScriptAnalyzer is already installed.'
} else {
Write-Host 'Installing PSScriptAnalyzer ...'
Install-Module -Repository PSGallery -Scope CurrentUser -Force -Name PSScriptAnalyzer -SkipPublisherCheck
}
if (Get-InstalledModule -Name BuildHelpers -MinimumVersion 2.0 -ErrorAction SilentlyContinue) {
Write-Host 'BuildHelpers is already installed.'
} else {
Write-Host 'Installing BuildHelpers ...'
Install-Module -Repository PSGallery -Scope CurrentUser -Force -Name BuildHelpers -SkipPublisherCheck
}
4 changes: 2 additions & 2 deletions test/bin/test.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Requires -Version 5.0
#Requires -Version 5.1
#Requires -Modules @{ ModuleName = 'BuildHelpers'; ModuleVersion = '2.0.1' }
#Requires -Modules @{ ModuleName = 'Pester'; RequiredVersion = '4.10.1' }
#Requires -Modules @{ ModuleName = 'Pester'; MaximumVersion = '4.99' }
#Requires -Modules @{ ModuleName = 'PSScriptAnalyzer'; ModuleVersion = '1.17.1' }
param(
[String] $TestPath = $(Resolve-Path "$PSScriptRoot\..\")
Expand Down

0 comments on commit 765d3aa

Please sign in to comment.