Skip to content

Commit 58a31fe

Browse files
committed
feat: Enhance CI workflow with coverage results directory and update Dockerfile for health checks
Signed-off-by: Soeren Magnus Olesen <soeren@molesen.ch>
1 parent 164407c commit 58a31fe

3 files changed

Lines changed: 41 additions & 19 deletions

File tree

.github/workflows/ci.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,22 @@ jobs:
4242

4343
- name: Test (unit)
4444
run: |
45-
dotnet test --no-build --configuration Release --verbosity normal --collect:"XPlat Code Coverage" tests/Odin.Core.Tests/Odin.Core.Tests.csproj
46-
dotnet test --no-build --configuration Release --verbosity normal tests/Odin.ExecutionEngine.Tests/Odin.ExecutionEngine.Tests.csproj
47-
dotnet test --no-build --configuration Release --verbosity normal tests/Odin.Sdk.Tests/Odin.Sdk.Tests.csproj
45+
mkdir -p TestResults
46+
dotnet test --no-build --configuration Release --verbosity normal --results-directory TestResults --collect:"XPlat Code Coverage" tests/Odin.Core.Tests/Odin.Core.Tests.csproj
47+
dotnet test --no-build --configuration Release --verbosity normal --results-directory TestResults --collect:"XPlat Code Coverage" tests/Odin.ExecutionEngine.Tests/Odin.ExecutionEngine.Tests.csproj
48+
dotnet test --no-build --configuration Release --verbosity normal --results-directory TestResults --collect:"XPlat Code Coverage" tests/Odin.Persistence.Tests/Odin.Persistence.Tests.csproj
49+
dotnet test --no-build --configuration Release --verbosity normal --results-directory TestResults --collect:"XPlat Code Coverage" tests/Odin.Sdk.Tests/Odin.Sdk.Tests.csproj
50+
dotnet test --no-build --configuration Release --verbosity normal --results-directory TestResults --collect:"XPlat Code Coverage" tests/Odin.ControlPlane.Grpc.Tests/Odin.ControlPlane.Grpc.Tests.csproj
4851
4952
- name: Test (integration)
50-
run: dotnet test --no-build --configuration Release --verbosity normal tests/Odin.Integration.Tests/Odin.Integration.Tests.csproj
53+
run: dotnet test --no-build --configuration Release --verbosity normal --results-directory TestResults --collect:"XPlat Code Coverage" tests/Odin.Integration.Tests/Odin.Integration.Tests.csproj
5154
env:
5255
DOCKER_HOST: unix:///var/run/docker.sock
5356

5457
- name: Upload coverage reports
5558
uses: codecov/codecov-action@v3
5659
with:
57-
files: '**/coverage.cobertura.xml'
60+
files: 'TestResults/**/coverage.cobertura.xml'
5861
fail_ci_if_error: false
5962

6063
lint:

Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ RUN dotnet publish src/Odin.Cli/Odin.Cli.csproj -c Release -o /app/publish/cli -
5959
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime-api
6060
WORKDIR /app
6161
COPY --from=publish-api /app/publish/api .
62+
RUN apt-get update && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/*
63+
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 CMD curl -f http://localhost:8080/ || exit 1
6264
EXPOSE 8080
6365
EXPOSE 8081
6466
ENTRYPOINT ["dotnet", "Odin.ControlPlane.Api.dll"]
@@ -67,6 +69,8 @@ ENTRYPOINT ["dotnet", "Odin.ControlPlane.Api.dll"]
6769
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime-grpc
6870
WORKDIR /app
6971
COPY --from=publish-grpc /app/publish/grpc .
72+
RUN apt-get update && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/*
73+
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 CMD curl -f http://localhost:7233/ || exit 1
7074
EXPOSE 7233
7175
ENTRYPOINT ["dotnet", "Odin.ControlPlane.Grpc.dll"]
7276

@@ -83,7 +87,7 @@ COPY --from=publish-workerhost /app/publish/workerhost .
8387
ENTRYPOINT ["dotnet", "Odin.WorkerHost.dll"]
8488

8589
# Runtime stage - CLI
86-
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime-cli
90+
FROM mcr.microsoft.com/dotnet/runtime:10.0 AS runtime-cli
8791
WORKDIR /app
8892
COPY --from=publish-cli /app/publish/cli .
8993
ENTRYPOINT ["dotnet", "Odin.Cli.dll"]

docker-compose.yml

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ version: '3.8'
33
services:
44
# PostgreSQL for persistence
55
postgres:
6+
profiles: ["core"]
67
image: postgres:14
78
container_name: odin-postgres
89
environment:
@@ -21,6 +22,7 @@ services:
2122

2223
# Elasticsearch for visibility (optional)
2324
elasticsearch:
25+
profiles: ["observability"]
2426
image: docker.elastic.co/elasticsearch/elasticsearch:8.11.0
2527
container_name: odin-elasticsearch
2628
environment:
@@ -39,6 +41,7 @@ services:
3941

4042
# OpenTelemetry Collector
4143
otel-collector:
44+
profiles: ["observability"]
4245
image: otel/opentelemetry-collector-contrib:0.91.0
4346
container_name: odin-otel-collector
4447
command: ["--config=/etc/otel-collector-config.yaml"]
@@ -54,6 +57,7 @@ services:
5457

5558
# Jaeger for distributed tracing
5659
jaeger:
60+
profiles: ["observability"]
5761
image: jaegertracing/all-in-one:1.51
5862
container_name: odin-jaeger
5963
ports:
@@ -64,6 +68,7 @@ services:
6468

6569
# Prometheus for metrics
6670
prometheus:
71+
profiles: ["observability"]
6772
image: prom/prometheus:v2.48.0
6873
container_name: odin-prometheus
6974
command:
@@ -79,6 +84,7 @@ services:
7984

8085
# Grafana for visualization
8186
grafana:
87+
profiles: ["observability"]
8288
image: grafana/grafana:10.2.2
8389
container_name: odin-grafana
8490
ports:
@@ -95,6 +101,7 @@ services:
95101

96102
# Odin Control Plane gRPC Service
97103
odin-grpc:
104+
profiles: ["core"]
98105
build:
99106
context: .
100107
dockerfile: Dockerfile
@@ -104,19 +111,24 @@ services:
104111
- "7233:7233"
105112
environment:
106113
- HUGO_ORCHESTRATOR_DB_CONNECTION=Host=postgres;Database=orchestrator;Username=odin;Password=odin_dev_password
107-
- HUGO_ORCHESTRATOR_ELASTICSEARCH_URL=http://elasticsearch:9200
108-
- HUGO_ORCHESTRATOR_OTLP_ENDPOINT=http://otel-collector:4317
114+
- HUGO_ORCHESTRATOR_ELASTICSEARCH_URL=${ELASTICSEARCH_URL:-http://elasticsearch:9200}
115+
- HUGO_ORCHESTRATOR_OTLP_ENDPOINT=${OTLP_ENDPOINT:-http://otel-collector:4317}
109116
- HUGO_ORCHESTRATOR_SHARD_COUNT=512
110117
- HUGO_ORCHESTRATOR_HISTORY_RETENTION_DAYS=30
111118
depends_on:
112119
postgres:
113120
condition: service_healthy
114-
otel-collector:
115-
condition: service_started
116121
restart: unless-stopped
122+
healthcheck:
123+
test: ["CMD", "curl", "-f", "http://localhost:7233/"]
124+
interval: 30s
125+
timeout: 5s
126+
retries: 5
127+
start_period: 30s
117128

118129
# Odin Control Plane REST API
119130
odin-api:
131+
profiles: ["core"]
120132
build:
121133
context: .
122134
dockerfile: Dockerfile
@@ -127,36 +139,39 @@ services:
127139
- "8081:8081"
128140
environment:
129141
- HUGO_ORCHESTRATOR_DB_CONNECTION=Host=postgres;Database=orchestrator;Username=odin;Password=odin_dev_password
130-
- HUGO_ORCHESTRATOR_ELASTICSEARCH_URL=http://elasticsearch:9200
131-
- HUGO_ORCHESTRATOR_OTLP_ENDPOINT=http://otel-collector:4317
132-
- HUGO_ORCHESTRATOR_GRPC_ENDPOINT=http://odin-grpc:7233
142+
- HUGO_ORCHESTRATOR_ELASTICSEARCH_URL=${ELASTICSEARCH_URL:-http://elasticsearch:9200}
143+
- HUGO_ORCHESTRATOR_OTLP_ENDPOINT=${OTLP_ENDPOINT:-http://otel-collector:4317}
144+
- HUGO_ORCHESTRATOR_GRPC_ENDPOINT=${GRPC_ENDPOINT:-http://odin-grpc:7233}
133145
depends_on:
134146
postgres:
135147
condition: service_healthy
136148
odin-grpc:
137149
condition: service_started
138-
otel-collector:
139-
condition: service_started
140150
restart: unless-stopped
151+
healthcheck:
152+
test: ["CMD", "curl", "-f", "http://localhost:8080/"]
153+
interval: 30s
154+
timeout: 5s
155+
retries: 5
156+
start_period: 30s
141157

142158
# Odin System Workers
143159
odin-workers:
160+
profiles: ["core"]
144161
build:
145162
context: .
146163
dockerfile: Dockerfile
147164
target: runtime-workers
148165
container_name: odin-workers
149166
environment:
150167
- HUGO_ORCHESTRATOR_DB_CONNECTION=Host=postgres;Database=orchestrator;Username=odin;Password=odin_dev_password
151-
- HUGO_ORCHESTRATOR_OTLP_ENDPOINT=http://otel-collector:4317
152-
- HUGO_ORCHESTRATOR_GRPC_ENDPOINT=http://odin-grpc:7233
168+
- HUGO_ORCHESTRATOR_OTLP_ENDPOINT=${OTLP_ENDPOINT:-http://otel-collector:4317}
169+
- HUGO_ORCHESTRATOR_GRPC_ENDPOINT=${GRPC_ENDPOINT:-http://odin-grpc:7233}
153170
depends_on:
154171
postgres:
155172
condition: service_healthy
156173
odin-grpc:
157174
condition: service_started
158-
otel-collector:
159-
condition: service_started
160175
restart: unless-stopped
161176

162177
volumes:

0 commit comments

Comments
 (0)