Skip to content

Commit 4e10bda

Browse files
committed
chore: Update docs
1 parent f5ca8d1 commit 4e10bda

File tree

1 file changed

+39
-40
lines changed

1 file changed

+39
-40
lines changed

.github/scripts/Filter-TestProjects.ps1

Lines changed: 39 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,99 +1,98 @@
11
<#
22
.SYNOPSIS
3-
Filters test projects for CI workflows.
3+
Filters test projects based on changed files to optimize CI workflow execution.
44
55
.DESCRIPTION
6-
Receives test project objects from the pipeline and returns them.
7-
Currently, all projects are passed through unchanged.
6+
Analyzes changed files and determines which test projects need to run. Protected
7+
branches and global repository changes run all tests. Other branches run only
8+
affected modules.
89
#>
910

1011
$PROTECTED_BRANCHES = @(
11-
'main',
12-
'develop'
12+
"main",
13+
"develop"
1314
)
1415

1516
$GLOBAL_PATTERNS = @(
16-
'^\.github/scripts/',
17-
'^\.github/workflows/',
18-
'^build/',
19-
'^Directory\.Build\.props$',
20-
'^Directory\.Packages\.props$',
21-
'^src/Testcontainers/'
17+
"^\.github/scripts/",
18+
"^\.github/workflows/",
19+
"^build/",
20+
"^Directory\.Build\.props$",
21+
"^Directory\.Packages\.props$",
22+
"^src/Testcontainers/"
2223
)
2324

2425
$DATABASE_MODULES = @(
25-
'Testcontainers.Cassandra',
26-
'Testcontainers.ClickHouse',
27-
'Testcontainers.CockroachDb',
28-
'Testcontainers.Db2',
29-
'Testcontainers.FirebirdSql',
30-
'Testcontainers.MariaDb',
31-
'Testcontainers.MsSql',
32-
'Testcontainers.MySql',
33-
'Testcontainers.Oracle',
34-
'Testcontainers.PostgreSql',
35-
'Testcontainers.Xunit',
36-
'Testcontainers.XunitV3'
26+
"Testcontainers.Cassandra",
27+
"Testcontainers.ClickHouse",
28+
"Testcontainers.CockroachDb",
29+
"Testcontainers.Db2",
30+
"Testcontainers.FirebirdSql",
31+
"Testcontainers.MariaDb",
32+
"Testcontainers.MsSql",
33+
"Testcontainers.MySql",
34+
"Testcontainers.Oracle",
35+
"Testcontainers.PostgreSql",
36+
"Testcontainers.Xunit",
37+
"Testcontainers.XunitV3"
3738
)
3839

3940
$ORACLE_MODULES = @(
40-
'Testcontainers.Oracle',
41-
'Testcontainers.Oracle11',
42-
'Testcontainers.Oracle18',
43-
'Testcontainers.Oracle21',
44-
'Testcontainers.Oracle23'
41+
"Testcontainers.Oracle",
42+
"Testcontainers.Oracle11",
43+
"Testcontainers.Oracle18",
44+
"Testcontainers.Oracle21",
45+
"Testcontainers.Oracle23"
4546
)
4647

4748
$XUNIT_MODULES = @(
48-
'Testcontainers.Xunit',
49-
'Testcontainers.XunitV3'
49+
"Testcontainers.Xunit",
50+
"Testcontainers.XunitV3"
5051
)
5152

5253
function Should-RunTests {
5354
param ([string]$ModuleName)
5455

55-
return $false
56-
5756
If ($script:branch -In $PROTECTED_BRANCHES) {
5857
Write-Host "Running '$ModuleName': protected branch '$script:branch'."
59-
return $true
58+
return $True
6059
}
6160

6261
ForEach ($pattern In $GLOBAL_PATTERNS) {
6362
If ($script:allChangedFiles | Where-Object { $_ -Match $pattern }) {
6463
Write-Host "Running '$ModuleName': global changes detected ($pattern)."
65-
return $true
64+
return $True
6665
}
6766
}
6867

6968
If ($script:allChangedFiles | Where-Object { $_ -Match "^(src|tests)/$ModuleName" }) {
7069
Write-Host "Running '$ModuleName': module-specific changes detected."
71-
return $true
70+
return $True
7271
}
7372

7473
If ($ModuleName -In $DATABASE_MODULES -And ($script:allChangedFiles | Where-Object { $_ -Match '^tests/Testcontainers\.Databases\.Tests' })) {
7574
Write-Host "Running '$ModuleName': database test changes detected."
76-
return $true
75+
return $True
7776
}
7877

7978
If ($ModuleName -In $ORACLE_MODULES -And ($script:allChangedFiles | Where-Object { $_ -Match '^(src|tests)/Testcontainers\.Oracle' })) {
8079
Write-Host "Running '$ModuleName': Oracle module changes detected."
81-
return $true
80+
return $True
8281
}
8382

8483
If ($ModuleName -In $XUNIT_MODULES -And ($script:allChangedFiles | Where-Object { $_ -Match '^(src|tests)/Testcontainers\.Xunit(V3)?' })) {
8584
Write-Host "Running '$ModuleName': xUnit module changes detected."
86-
return $true
85+
return $True
8786
}
8887

8988
Write-Host "Skipping '$ModuleName': no relevant changes detected."
90-
return $false
89+
return $False
9190
}
9291

9392
function Filter-TestProjects {
9493
[CmdletBinding()]
9594
Param (
96-
[Parameter(ValueFromPipeline = $true)]
95+
[Parameter(ValueFromPipeline = $True)]
9796
$TestProject
9897
)
9998

0 commit comments

Comments
 (0)