Skip to content

Commit 3b49614

Browse files
authored
Merge branch 'develop' into feat/support-spicedb
2 parents c481674 + c8ff7dd commit 3b49614

File tree

266 files changed

+4451
-518
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

266 files changed

+4451
-518
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"ghcr.io/devcontainers/features/docker-in-docker:2": {
1414
"moby": true
1515
},
16-
"ghcr.io/devcontainers/features/dotnet:2.2.2": {
16+
"ghcr.io/devcontainers/features/dotnet:2.4.0": {
1717
"version": "9.0",
1818
"installUsingApt": false
1919
}

.gitattributes

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,15 @@
88
# Shell scripts
99
*.sh text eol=lf
1010

11-
# Git lfs
12-
*.crt filter=lfs diff=lfs merge=lfs -text
11+
# Treat all SSL-related files as binary
12+
*.crt binary
13+
*.key binary
14+
*.pem binary
15+
*.pfx binary
16+
17+
# Git LFS
1318
*.ico filter=lfs diff=lfs merge=lfs -text
19+
*.pfx filter=lfs diff=lfs merge=lfs -text
1420
*.png filter=lfs diff=lfs merge=lfs -text
1521
*.snk filter=lfs diff=lfs merge=lfs -text
1622

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ blank_issues_enabled: false
22
contact_links:
33
- name: Need help?
44
url: https://slack.testcontainers.org/
5-
about: Visit our Slack workspace.
5+
about: Visit our Slack Workspace.
66
- name: Have a question or want to drive a community conversation?
77
url: https://github.com/testcontainers/testcontainers-dotnet/discussions/
88
about: Visit our Discussions page.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<#
2+
.SYNOPSIS
3+
Retrieves the GitHub Actions 'runs-on' configuration for each test project
4+
and ensures all test projects have a valid configuration.
5+
6+
.DESCRIPTION
7+
Scans all test projects under 'tests', reads '.runs-on' for CI runner configuration,
8+
throws an error if missing, and outputs filtered projects as compressed JSON.
9+
#>
10+
11+
# Get 'runs-on' configuration for each test project.
12+
$testProjects = Get-ChildItem -Path 'tests' -Directory `
13+
| ? { $_.Name -Match '\.Tests$' } `
14+
| % { $testProject = $_.Name; Join-Path -Path $_.FullName -ChildPath '.runs-on' } `
15+
| % { If (Test-Path -LiteralPath $_) { Get-Content -LiteralPath $_ } Else { $Null } } `
16+
| % { [PSCustomObject]@{ 'name' = ($testProject -Replace '\.Tests$', ''); 'runs-on' = [string]$_ } }
17+
18+
# Validate that all projects have a '.runs-on' configuration.
19+
$runsOnNotFound = $testProjects `
20+
| Where-Object 'runs-on' -Eq '' `
21+
| Select-Object -ExpandProperty 'name'
22+
23+
If ($runsOnNotFound) {
24+
Write-Error "Please add a '.runs-on' configuration file to the test project:`n $($runsOnNotFound -Join "`n ")"
25+
Exit 1
26+
}
27+
28+
# Filter projects and output as compressed JSON.
29+
$filteredTestProjects = $testProjects | & (Join-Path $PSScriptRoot 'Filter-TestProjects.ps1') | ConvertTo-Json -AsArray -Compress
30+
$filteredTestProjects ?? "[]"
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
<#
2+
.SYNOPSIS
3+
Filters test projects based on changed files to optimize CI workflow execution.
4+
5+
.DESCRIPTION
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.
9+
10+
.EXAMPLE
11+
# Test protected branch (runs all tests):
12+
$env:GITHUB_REF_NAME="main"; $env:ALL_CHANGED_FILES="README.md"; $input | Filter-TestProjects
13+
14+
.EXAMPLE
15+
# Test core library changes (runs all tests):
16+
$env:GITHUB_REF_NAME="1/merge"; $env:ALL_CHANGED_FILES="src/Testcontainers/Testcontainers.csproj"; $input | Filter-TestProjects
17+
18+
.EXAMPLE
19+
# Test module-specific changes (runs only affected module):
20+
$env:GITHUB_REF_NAME="2/merge"; $env:ALL_CHANGED_FILES="src/Testcontainers.Redis/RedisBuilder.cs"; $input | Filter-TestProjects
21+
#>
22+
23+
$PROTECTED_BRANCHES = @(
24+
"main",
25+
"develop"
26+
)
27+
28+
$GLOBAL_PATTERNS = @(
29+
"^\.github/scripts/",
30+
"^\.github/workflows/",
31+
"^build/",
32+
"^Directory\.Build\.props$",
33+
"^Directory\.Packages\.props$",
34+
"^src/Testcontainers/"
35+
)
36+
37+
$DATABASE_MODULES = @(
38+
"Testcontainers.Cassandra",
39+
"Testcontainers.ClickHouse",
40+
"Testcontainers.CockroachDb",
41+
"Testcontainers.Db2",
42+
"Testcontainers.FirebirdSql",
43+
"Testcontainers.MariaDb",
44+
"Testcontainers.MsSql",
45+
"Testcontainers.MySql",
46+
"Testcontainers.Oracle",
47+
"Testcontainers.PostgreSql",
48+
"Testcontainers.Xunit",
49+
"Testcontainers.XunitV3"
50+
)
51+
52+
$ORACLE_MODULES = @(
53+
"Testcontainers.Oracle",
54+
"Testcontainers.Oracle11",
55+
"Testcontainers.Oracle18",
56+
"Testcontainers.Oracle21",
57+
"Testcontainers.Oracle23"
58+
)
59+
60+
$XUNIT_MODULES = @(
61+
"Testcontainers.Xunit",
62+
"Testcontainers.XunitV3"
63+
)
64+
65+
function Should-RunTests {
66+
param ([string]$ModuleName)
67+
68+
# Rule 1: Protected branches always run all tests.
69+
# Ensures main/develop branches have full test coverage.
70+
If ($script:branch -In $PROTECTED_BRANCHES) {
71+
Write-Host "Running '$ModuleName': protected branch '$script:branch'."
72+
return $True
73+
}
74+
75+
# Rule 2: Global changes affect all modules.
76+
ForEach ($pattern In $GLOBAL_PATTERNS) {
77+
If ($script:allChangedFiles | Where-Object { $_ -Match $pattern }) {
78+
Write-Host "Running '$ModuleName': global changes detected ($pattern)."
79+
return $True
80+
}
81+
}
82+
83+
# Rule 3: Module-specific changes.
84+
If ($script:allChangedFiles | Where-Object { $_ -Match "^(src|tests)/$ModuleName" }) {
85+
Write-Host "Running '$ModuleName': module-specific changes detected."
86+
return $True
87+
}
88+
89+
# Rule 4: Shared database tests for ADO.NET compatible modules.
90+
If ($ModuleName -In $DATABASE_MODULES -And ($script:allChangedFiles | Where-Object { $_ -Match '^tests/Testcontainers\.Databases\.Tests' })) {
91+
Write-Host "Running '$ModuleName': database test changes detected."
92+
return $True
93+
}
94+
95+
# Rule 5: Oracle integration variants.
96+
If ($ModuleName -In $ORACLE_MODULES -And ($script:allChangedFiles | Where-Object { $_ -Match '^(src|tests)/Testcontainers\.Oracle' })) {
97+
Write-Host "Running '$ModuleName': Oracle module changes detected."
98+
return $True
99+
}
100+
101+
# Rule 6: xUnit integration variants.
102+
If ($ModuleName -In $XUNIT_MODULES -And ($script:allChangedFiles | Where-Object { $_ -Match '^(src|tests)/Testcontainers\.Xunit(V3)?' })) {
103+
Write-Host "Running '$ModuleName': xUnit module changes detected."
104+
return $True
105+
}
106+
107+
Write-Host "Skipping '$ModuleName': no relevant changes detected."
108+
return $False
109+
}
110+
111+
function Filter-TestProjects {
112+
[CmdletBinding()]
113+
Param (
114+
[Parameter(ValueFromPipeline = $True)]
115+
$TestProject
116+
)
117+
118+
Begin {
119+
$script:branch = $env:GITHUB_REF_NAME
120+
$script:allChangedFiles = $env:ALL_CHANGED_FILES -Split "[\s\t\n]"
121+
$script:filteredModules = @()
122+
123+
Write-Host "Filtering test projects for branch '$script:branch'."
124+
Write-Host "Analyzing $($script:allChangedFiles.Count) changed file(s)."
125+
}
126+
127+
Process {
128+
If (Should-RunTests $TestProject.name) {
129+
$script:filteredModules += $TestProject
130+
}
131+
}
132+
133+
End {
134+
Write-Host "Filtered $($script:filteredModules.Count) module(s) will run."
135+
$script:filteredModules
136+
}
137+
}
138+
139+
$input | Filter-TestProjects

.github/settings.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ labels:
106106

107107
- name: question
108108
color: '#8ba7f4'
109-
description: Have you tried our Slack workspace (https://testcontainers.slack.com)?
109+
description: Have you tried our Slack Workspace (https://testcontainers.slack.com)?
110110

111111
- name: security
112112
color: '#d93f0b'

0 commit comments

Comments
 (0)