Skip to content

Commit d1d2134

Browse files
authored
chore: Collect test projects at CI runtime (#1543)
1 parent 85cf17e commit d1d2134

File tree

68 files changed

+129
-101
lines changed

Some content is hidden

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

68 files changed

+129
-101
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
$testProjects | & (Join-Path $PSScriptRoot 'Filter-TestProjects.ps1') | ConvertTo-Json -Compress
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<#
2+
.SYNOPSIS
3+
Filters test projects for CI workflows.
4+
5+
.DESCRIPTION
6+
Receives test project objects from the pipeline and returns them.
7+
Currently, all projects are passed through unchanged.
8+
#>
9+
10+
Param (
11+
[Parameter(ValueFromPipeline)]
12+
$InputObject
13+
)
14+
15+
Process {
16+
# Return test projects unchanged.
17+
$InputObject
18+
}

.github/workflows/cicd.yml

Lines changed: 18 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -27,76 +27,28 @@ env:
2727
TZ: CET # https://stackoverflow.com/q/53510011
2828

2929
jobs:
30+
collect-test-projects:
31+
runs-on: ubuntu-22.04
32+
33+
outputs:
34+
test-projects: ${{ steps.set-test-projects.outputs.test-projects }}
35+
36+
steps:
37+
- name: Checkout Repository
38+
uses: actions/checkout@v4
39+
40+
- id: set-test-projects
41+
name: Collect Test Projects
42+
shell: pwsh
43+
run: echo "test-projects=$(.github/scripts/Collect-TestProjects.ps1)" >> $env:GITHUB_OUTPUT
44+
3045
ci:
46+
needs: collect-test-projects
47+
3148
strategy:
3249
max-parallel: 6
3350
matrix:
34-
test-projects: [
35-
{ name: "Testcontainers", runs-on: "ubuntu-22.04" },
36-
{ name: "Testcontainers.Platform.Linux", runs-on: "ubuntu-22.04" },
37-
{ name: "Testcontainers.Platform.Windows", runs-on: "windows-2022" },
38-
{ name: "Testcontainers.Databases", runs-on: "ubuntu-22.04" },
39-
{ name: "Testcontainers.ResourceReaper", runs-on: "ubuntu-22.04" },
40-
{ name: "Testcontainers.ActiveMq", runs-on: "ubuntu-22.04" },
41-
{ name: "Testcontainers.ArangoDb", runs-on: "ubuntu-22.04" },
42-
{ name: "Testcontainers.Azurite", runs-on: "ubuntu-22.04" },
43-
{ name: "Testcontainers.BigQuery", runs-on: "ubuntu-22.04" },
44-
{ name: "Testcontainers.Bigtable", runs-on: "ubuntu-22.04" },
45-
{ name: "Testcontainers.Cassandra", runs-on: "ubuntu-22.04" },
46-
{ name: "Testcontainers.ClickHouse", runs-on: "ubuntu-22.04" },
47-
{ name: "Testcontainers.CockroachDb", runs-on: "ubuntu-22.04" },
48-
{ name: "Testcontainers.Consul", runs-on: "ubuntu-22.04" },
49-
{ name: "Testcontainers.CosmosDb", runs-on: "ubuntu-22.04" },
50-
{ name: "Testcontainers.Couchbase", runs-on: "ubuntu-22.04" },
51-
{ name: "Testcontainers.CouchDb", runs-on: "ubuntu-22.04" },
52-
{ name: "Testcontainers.Db2", runs-on: "ubuntu-22.04" },
53-
{ name: "Testcontainers.DynamoDb", runs-on: "ubuntu-22.04" },
54-
{ name: "Testcontainers.Elasticsearch", runs-on: "ubuntu-22.04" },
55-
{ name: "Testcontainers.EventHubs", runs-on: "ubuntu-22.04" },
56-
{ name: "Testcontainers.EventStoreDb", runs-on: "ubuntu-22.04" },
57-
{ name: "Testcontainers.FakeGcsServer", runs-on: "ubuntu-22.04" },
58-
{ name: "Testcontainers.FirebirdSql", runs-on: "ubuntu-22.04" },
59-
{ name: "Testcontainers.Firestore", runs-on: "ubuntu-22.04" },
60-
{ name: "Testcontainers.InfluxDb", runs-on: "ubuntu-22.04" },
61-
{ name: "Testcontainers.JanusGraph", runs-on: "ubuntu-22.04" },
62-
{ name: "Testcontainers.K3s", runs-on: "ubuntu-22.04" },
63-
{ name: "Testcontainers.Kafka", runs-on: "ubuntu-22.04" },
64-
{ name: "Testcontainers.Keycloak", runs-on: "ubuntu-22.04" },
65-
{ name: "Testcontainers.Kusto", runs-on: "ubuntu-22.04" },
66-
{ name: "Testcontainers.LocalStack", runs-on: "ubuntu-22.04" },
67-
{ name: "Testcontainers.LowkeyVault", runs-on: "ubuntu-22.04" },
68-
{ name: "Testcontainers.MariaDb", runs-on: "ubuntu-22.04" },
69-
{ name: "Testcontainers.Milvus", runs-on: "ubuntu-22.04" },
70-
{ name: "Testcontainers.Minio", runs-on: "ubuntu-22.04" },
71-
{ name: "Testcontainers.MongoDb", runs-on: "ubuntu-22.04" },
72-
{ name: "Testcontainers.MsSql", runs-on: "ubuntu-22.04" },
73-
{ name: "Testcontainers.MySql", runs-on: "ubuntu-22.04" },
74-
{ name: "Testcontainers.Nats", runs-on: "ubuntu-22.04" },
75-
{ name: "Testcontainers.Neo4j", runs-on: "ubuntu-22.04" },
76-
{ name: "Testcontainers.Ollama", runs-on: "ubuntu-22.04" },
77-
{ name: "Testcontainers.OpenSearch", runs-on: "ubuntu-22.04" },
78-
{ name: "Testcontainers.Oracle", runs-on: "ubuntu-22.04" },
79-
{ name: "Testcontainers.Oracle11", runs-on: "ubuntu-22.04" },
80-
{ name: "Testcontainers.Oracle18", runs-on: "ubuntu-22.04" },
81-
{ name: "Testcontainers.Oracle21", runs-on: "ubuntu-22.04" },
82-
{ name: "Testcontainers.Oracle23", runs-on: "ubuntu-22.04" },
83-
{ name: "Testcontainers.Papercut", runs-on: "ubuntu-22.04" },
84-
{ name: "Testcontainers.PostgreSql", runs-on: "ubuntu-22.04" },
85-
{ name: "Testcontainers.PubSub", runs-on: "ubuntu-22.04" },
86-
{ name: "Testcontainers.Pulsar", runs-on: "ubuntu-22.04" },
87-
{ name: "Testcontainers.Qdrant", runs-on: "ubuntu-22.04" },
88-
{ name: "Testcontainers.RabbitMq", runs-on: "ubuntu-22.04" },
89-
{ name: "Testcontainers.RavenDb", runs-on: "ubuntu-22.04" },
90-
{ name: "Testcontainers.Redis", runs-on: "ubuntu-22.04" },
91-
{ name: "Testcontainers.Redpanda", runs-on: "ubuntu-22.04" },
92-
{ name: "Testcontainers.ServiceBus", runs-on: "ubuntu-22.04" },
93-
{ name: "Testcontainers.Sftp", runs-on: "ubuntu-22.04" },
94-
{ name: "Testcontainers.Typesense", runs-on: "ubuntu-22.04" },
95-
{ name: "Testcontainers.Weaviate", runs-on: "ubuntu-22.04" },
96-
{ name: "Testcontainers.WebDriver", runs-on: "ubuntu-22.04" },
97-
{ name: "Testcontainers.Xunit", runs-on: "ubuntu-22.04" },
98-
{ name: "Testcontainers.XunitV3", runs-on: "ubuntu-22.04" }
99-
]
51+
test-projects: ${{ fromJSON(needs.collect-test-projects.outputs.test-projects) }}
10052

10153
runs-on: ${{ matrix.test-projects.runs-on }}
10254

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ubuntu-22.04
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ubuntu-22.04
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ubuntu-22.04
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ubuntu-22.04
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ubuntu-22.04
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ubuntu-22.04
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ubuntu-22.04

0 commit comments

Comments
 (0)