Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(ci): Use cache in GitHub Actions #4671

Merged
merged 3 commits into from
Mar 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -34,6 +34,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