Skip to content

Commit

Permalink
build(ci): Use cache in GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
niheaven committed Jan 18, 2022
1 parent 81b7aaf commit 362bf2d
Show file tree
Hide file tree
Showing 3 changed files with 37 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 @@ -14,11 +14,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 @@ -27,8 +30,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
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 362bf2d

Please sign in to comment.