Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

- **unix:** Fix tests in Linux and macOS ([#5179](https://github.com/ScoopInstaller/Scoop/issues/5179))
- **pester:** Update to Pester 5 ([#5222](https://github.com/ScoopInstaller/Scoop/issues/5222))
- **bucket:** Use BuildHelpers' EnvVars ([#5226](https://github.com/ScoopInstaller/Scoop/issues/5226))

### Documentation

Expand Down
15 changes: 3 additions & 12 deletions test/Import-Bucket-Tests.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#Requires -Version 5.1
#Requires -Modules @{ ModuleName = 'BuildHelpers'; ModuleVersion = '2.0.1' }
#Requires -Modules @{ ModuleName = 'Pester'; ModuleVersion = '5.2.0' }
param(
[String] $BucketPath = $MyInvocation.PSScriptRoot
Expand All @@ -14,18 +15,8 @@ Describe 'Manifest validates against the schema' {
$BucketPath
}
if ($env:CI -eq $true) {
$commit = if ($env:GITHUB_SHA) {
# GitHub Actions
$env:GITHUB_SHA
} elseif ($env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT) {
# AppVeyor
$env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT
} else {
$env:APPVEYOR_REPO_COMMIT
}
if ($commit) {
$changedManifests = @(Get-GitChangedFile -Path $bucketDir -Include '*.json' -Commit $commit)
}
Set-BuildEnvironment -Force
$changedManifests = @(Get-GitChangedFile -Path $bucketDir -Include '*.json' -Commit $env:BHCommitHash)
}
$manifestFiles = (Get-ChildItem $bucketDir -Filter '*.json' -Recurse).FullName
if ($changedManifests) {
Expand Down
7 changes: 2 additions & 5 deletions test/bin/test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,14 @@ if ($env:CI -eq $true) {
Write-Host "Load 'BuildHelpers' environment variables ..."
Set-BuildEnvironment -Force

$commit = $env:BHCommitHash
$commitMessage = $env:BHCommitMessage

# Check if tests are called from the Core itself, if so, adding excludes
if ($TestPath -eq (Convert-Path "$PSScriptRoot\..")) {
if ($commitMessage -match '!linter') {
if ($env:BHCommitMessage -match '!linter') {
Write-Warning "Skipping code linting per commit flag '!linter'"
$excludes += 'Linter'
}

$changedScripts = (Get-GitChangedFile -Include '*.ps1', '*.psd1', '*.psm1' -Commit $commit)
$changedScripts = (Get-GitChangedFile -Include '*.ps1', '*.psd1', '*.psm1' -Commit $env:BHCommitHash)
if (!$changedScripts) {
Write-Warning "Skipping tests and code linting for PowerShell scripts because they didn't change"
$excludes += 'Linter'
Expand Down