gitlab.com/jfprevost/gitlab-runner-notlscheck@v11.11.4+incompatible/ci/test_windows.ps1 (about) 1 param( 2 [string]$testsDefinitionsFile = ".\testsdefinitions.txt" 3 ) 4 5 $InformationPreference = "Continue" 6 7 function Get-Line([string]$file) { 8 (Get-Content $file | Measure-Object -Line).Lines 9 } 10 11 $numberOfDefinitions = Get-Line -file $testsDefinitionsFile 12 $executionSize = [int]($numberOfDefinitions / $env:CI_NODE_TOTAL) 13 $nodeIndex = $env:CI_NODE_INDEX - 1 14 $executionOffset = ($nodeIndex * $executionSize) 15 16 Write-Information "Number of definitions: $numberOfDefinitions" 17 Write-Information "Suite size: $env:CI_NODE_TOTAL" 18 Write-Information "Suite index: $env:CI_NODE_INDEX" 19 20 Write-Information "Execution size: $executionSize" 21 Write-Information "Execution offset: $executionOffset" 22 23 $failed = @() 24 Get-Content $testsDefinitionsFile | Select-Object -skip $executionOffset -first $executionSize | ForEach-Object { 25 $pkg, $index, $tests = $_.Split(" ", 3) 26 27 Write-Information "`r`n`r`n--- Starting part $index of go tests of '$pkg' package:`r`n`r`n" 28 29 go test -v $pkg -run "$tests" 30 31 if ($LASTEXITCODE -ne 0) { 32 $failed += "$pkg-$index" 33 } 34 } 35 36 if ($failed.count -ne 0) { 37 Write-Output "" 38 Write-Warning "Failed packages:" 39 $failed | Out-String | Write-Warning 40 41 exit 1 42 }