Refactor Web UI into Apps Pattern #16
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: Integration Tests | |
| # TODO: remove the add-docker branch before merging to main | |
| on: | |
| push: | |
| branches: [ main, add-docker ] | |
| pull_request: | |
| branches: [ main, add-docker ] | |
| workflow_dispatch: {} | |
| jobs: | |
| integration: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Build and start stack | |
| run: | | |
| docker compose up -d --build | |
| - name: Wait for services to become healthy | |
| run: | | |
| set -euo pipefail | |
| tiled_id=$(docker compose ps -q tiled) | |
| agent_id=$(docker compose ps -q agent) | |
| for i in $(seq 1 30); do | |
| th=$(docker inspect --format '{{.State.Health.Status}}' "$tiled_id") || true | |
| ah=$(docker inspect --format '{{.State.Health.Status}}' "$agent_id") || true | |
| if [ "$th" = "healthy" ] && [ "$ah" = "healthy" ]; then | |
| echo "Services healthy"; exit 0 | |
| fi | |
| sleep 2 | |
| done | |
| echo "Services did not become healthy" >&2 | |
| docker compose ps | |
| exit 1 | |
| - name: Smoke test Tiled API | |
| run: | | |
| set -euo pipefail | |
| code=$(curl -s -o /dev/null -w "%{http_code}" -H "X-Tiled-Api-Key: devkey" http://localhost:8000/api/v1/metadata/) | |
| if [ "$code" != "200" ] && [ "$code" != "401" ]; then | |
| echo "Unexpected Tiled status: $code" >&2 | |
| exit 1 | |
| fi | |
| - name: Smoke test Agent driver status | |
| run: | | |
| set -euo pipefail | |
| code=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:5003/driver_status) | |
| body=$(curl -s http://localhost:5003/driver_status) | |
| if [ "$code" != "200" ]; then | |
| echo "Unexpected agent status: $code" >&2 | |
| exit 1 | |
| fi | |
| echo "$body" | grep -q "mock_mode" | |
| - name: Teardown | |
| if: always() | |
| run: docker compose down -v |