-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (65 loc) · 2.04 KB
/
spring-kafka-example.yml
File metadata and controls
77 lines (65 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: spring-kafka-example CI Build
on:
pull_request:
branches: [master]
paths:
- "spring-kafka-example/**"
types:
- opened
- synchronize
- reopened
jobs:
integration-tests:
name: Run Unit & Integration Tests
runs-on: ubuntu-latest
defaults:
run:
working-directory: spring-kafka-example
strategy:
matrix:
distribution: [ 'temurin' ]
java: [ '21' ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v4.7.1
with:
java-version: ${{ matrix.java }}
distribution: ${{ matrix.distribution }}
cache: 'maven'
- name: Build and analyze
run: ./mvnw clean verify
health-check:
runs-on: ubuntu-latest
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v4
with:
submodules: true
- name: Start containers with Compose Action
uses: hoverkraft-tech/compose-action@v2.3.0
with:
compose-file: './spring-kafka-example/compose.yaml'
services: |
app
kafka
up-flags: '--build'
down-flags: '--volumes'
- name: Wait for containers to initialize
run: sleep 10
- name: Check container health
run: |
echo "Verificando saúde dos containers..."
APP_STATUS=$(docker inspect -f '{{.State.Running}}' app || echo "false")
KAFKA_STATUS=$(docker inspect -f '{{.State.Running}}' kafka || echo "false")
echo "Status do app: $APP_STATUS"
echo "Status do kafka: $KAFKA_STATUS"
if [ "$APP_STATUS" != "true" ] || [ "$KAFKA_STATUS" != "true" ]; then
echo "::error ::Um ou ambos os containers estão inativos. PR não deve ser autorizado!"
exit 1
fi
# Se chegou aqui, ambos estão ativos
- name: Success message
run: echo "✅ Todos os containers estão rodando com sucesso!"