mirror of
https://github.com/ScoopInstaller/Scoop.git
synced 2025-12-11 10:35:44 +00:00
tests(bucket): Use BuildHelpers EnvVars (#5226)
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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) {
|
||||
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user