Merge pull request #3 from UCSolarCarTeam/TEL-316-Create-a-Grafana-Da… #28
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: Docker Build and Test | |
| on: | |
| push: | |
| paths: | |
| - 'grafana/**' | |
| - '.github/workflows/workflow.yml' | |
| pull_request: | |
| paths: | |
| - 'grafana/**' | |
| - '.github/workflows/workflow.yml' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Validate docker-compose.yml | |
| run: | | |
| cd grafana | |
| docker compose config | |
| - name: Build Docker images | |
| run: | | |
| cd grafana | |
| docker compose pull | |
| docker compose build | |
| - name: Start services | |
| run: | | |
| cd grafana | |
| docker compose up -d | |
| - name: Wait for Grafana to be ready | |
| run: | | |
| timeout 60 bash -c 'until curl -f http://localhost:3000/api/health; do sleep 2; done' | |
| - name: Check Grafana health | |
| run: | | |
| curl -f http://localhost:3000/api/health | |
| - name: Stop services | |
| if: always() | |
| run: | | |
| cd grafana | |
| docker compose down -v |