-
Notifications
You must be signed in to change notification settings - Fork 0
Update spring-kafka-example.yml #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,11 +1,8 @@ | ||||||||||||||||||
| name: spring-kafka-example CI Build | ||||||||||||||||||
|
|
||||||||||||||||||
| on: | ||||||||||||||||||
| push: | ||||||||||||||||||
| paths: | ||||||||||||||||||
| - "spring-kafka-example/**" | ||||||||||||||||||
| branches: [master] | ||||||||||||||||||
| pull_request: | ||||||||||||||||||
| branches: [master] | ||||||||||||||||||
| paths: | ||||||||||||||||||
| - "spring-kafka-example/**" | ||||||||||||||||||
| types: | ||||||||||||||||||
|
|
@@ -14,7 +11,8 @@ on: | |||||||||||||||||
| - reopened | ||||||||||||||||||
|
|
||||||||||||||||||
| jobs: | ||||||||||||||||||
| build: | ||||||||||||||||||
|
|
||||||||||||||||||
| integration-tests: | ||||||||||||||||||
| name: Run Unit & Integration Tests | ||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||
| defaults: | ||||||||||||||||||
|
|
@@ -27,7 +25,7 @@ jobs: | |||||||||||||||||
| steps: | ||||||||||||||||||
| - uses: actions/checkout@v4 | ||||||||||||||||||
| with: | ||||||||||||||||||
| fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | ||||||||||||||||||
| fetch-depth: 0 | ||||||||||||||||||
|
|
||||||||||||||||||
| - name: Set up JDK ${{ matrix.java }} | ||||||||||||||||||
| uses: actions/[email protected] | ||||||||||||||||||
|
|
@@ -36,4 +34,44 @@ jobs: | |||||||||||||||||
| distribution: ${{ matrix.distribution }} | ||||||||||||||||||
| cache: 'maven' | ||||||||||||||||||
| - name: Build and analyze | ||||||||||||||||||
| run: ./mvnw clean verify | ||||||||||||||||||
| run: ./mvnw clean verify | ||||||||||||||||||
|
|
||||||||||||||||||
| health-check: | ||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||
| steps: | ||||||||||||||||||
| - name: Checkout repository and submodules | ||||||||||||||||||
| uses: actions/checkout@v3 | ||||||||||||||||||
| with: | ||||||||||||||||||
| submodules: true | ||||||||||||||||||
|
Comment on lines
+42
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bump
- - name: Checkout repository and submodules
- uses: actions/checkout@v3
+ - name: Checkout repository and submodules
+ uses: actions/checkout@v4📝 Committable suggestion
Suggested change
🧰 Tools🪛 actionlint (1.7.7)43-43: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue (action) 🤖 Prompt for AI Agents |
||||||||||||||||||
|
|
||||||||||||||||||
| - name: Start containers with Compose Action | ||||||||||||||||||
| uses: hoverkraft-tech/[email protected] | ||||||||||||||||||
| 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 | ||||||||||||||||||
|
|
||||||||||||||||||
igorcampos-dev marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||
| # Se chegou aqui, ambos estão ativos | ||||||||||||||||||
| - name: Success message | ||||||||||||||||||
| run: echo "✅ Todos os containers estão rodando com sucesso!" | ||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick (assertive)
Run health-check only after tests finish
Unless there is a strong reason to run both jobs in parallel, chaining them makes the pipeline shorter (containers are started only if the Maven build succeeded) and surfaces failures earlier.
📝 Committable suggestion
🤖 Prompt for AI Agents