feat(spring-prometheus-grafana-example): add base #1
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: spring-prometheus-grafana-example CI Build | |
| on: | |
| pull_request: | |
| branches: [master] | |
| paths: | |
| - "spring-prometheus-grafana-example/**" | |
| types: | |
| - opened | |
| - synchronize | |
| - reopened | |
| jobs: | |
| integration-tests: | |
| name: Run Unit & Integration Tests | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: spring-prometheus-grafana-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-prometheus-grafana-example/compose.yaml' | |
| services: | | |
| app | |
| 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") | |
| echo "Status do app: $APP_STATUS" | |
| if [ "$APP_STATUS" != "true" ]; then | |
| echo "::error ::An error occurred while executing the containers." | |
| exit 1 | |
| fi | |
| # Se chegou aqui, ambos estão ativos | |
| - name: Success message | |
| run: echo "Container testing completed successfully!" |