Skip to content

Commit e10603c

Browse files
authored
Make sure non-Windows CI fails when a test fails (PowerShell#9303)
Make sure non-Windows CI fails when a test fails ## PR Context We discovered that some tests were failing after a PR and the CI was not failing
1 parent 6118c37 commit e10603c

File tree

1 file changed

+1
-51
lines changed

1 file changed

+1
-51
lines changed

tools/ci.psm1

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ function Invoke-CIInstall
122122
)
123123
# Make sure we have all the tags
124124
Sync-PSTags -AddRemoteIfMissing
125-
$releaseTag = Get-ReleaseTag
126125

127126
if(Test-DailyBuild)
128127
{
@@ -588,8 +587,6 @@ function Invoke-LinuxTestsCore
588587
'ExcludeTag' = $testExcludeTag
589588
'OutputFile' = $testResultsNoSudo
590589
}
591-
# create packages if it is a full build
592-
$isFullBuild = Test-DailyBuild
593590

594591
# Get the experimental feature names and the tests associated with them
595592
$ExperimentalFeatureTests = Get-ExperimentalFeatureTests
@@ -662,7 +659,7 @@ function Invoke-LinuxTestsCore
662659
# Determine whether the build passed
663660
try {
664661
$allTestResultsWithNoExpFeature = @($pesterPassThruNoSudoObject, $pesterPassThruSudoObject)
665-
$allTestResultsWithExpFeatures = $noSudoResultsWithExpFeatures + $sudoResultsWithExpFeatures
662+
$allTestResultsWithExpFeatures = @($noSudoResultsWithExpFeatures, $sudoResultsWithExpFeatures)
666663
# This throws if there was an error:
667664
$allTestResultsWithNoExpFeature | ForEach-Object { Test-PSPesterResults -ResultObject $_ }
668665
$allTestResultsWithExpFeatures | ForEach-Object { Test-PSPesterResults -ResultObject $_ -CanHaveNoResult }
@@ -672,53 +669,6 @@ function Invoke-LinuxTestsCore
672669
$resultError = $_
673670
$result = "FAIL"
674671
}
675-
}
676-
677-
# Build and test script for Linux and macOS:
678-
function Invoke-LinuxTests
679-
{
680-
param(
681-
[switch]
682-
$SkipBuild
683-
)
684-
685-
if(!$SkipBuild.IsPresent)
686-
{
687-
$releaseTag = Get-ReleaseTag
688-
Write-Log -Message "Executing ci.psm1 build and test on a Linux based operating system."
689-
$originalProgressPreference = $ProgressPreference
690-
$ProgressPreference = 'SilentlyContinue'
691-
try {
692-
# We use CrossGen build to run tests only if it's the daily build.
693-
Start-PSBuild -CrossGen -PSModuleRestore -CI -ReleaseTag $releaseTag -Configuration 'Release'
694-
}
695-
finally
696-
{
697-
$ProgressPreference = $originalProgressPreference
698-
}
699-
}
700-
701-
Invoke-LinuxTestsCore
702-
703-
try {
704-
$xUnitTestResultsFile = "$pwd/xUnitTestResults.xml"
705-
Start-PSxUnit -xUnitTestResultsFile $xUnitTestResultsFile
706-
# If there are failures, Test-XUnitTestResults throws
707-
Test-XUnitTestResults -TestResultsFile $xUnitTestResultsFile
708-
} catch {
709-
$result = "FAIL"
710-
if (!$resultError)
711-
{
712-
$resultError = $_
713-
}
714-
}
715-
716-
$createPackages = $isFullBuild
717-
718-
if ($createPackages)
719-
{
720-
New-LinuxPackage -NugetKey $env:NugetKey
721-
}
722672

723673
# If the tests did not pass, throw the reason why
724674
if ( $result -eq "FAIL" )

0 commit comments

Comments
 (0)