TO-291: Add notifications model #1520
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
| # Copyright 2025 Canonical Ltd. | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| # | |
| # SPDX-FileCopyrightText: Copyright 2025 Canonical Ltd. | |
| # SPDX-License-Identifier: Apache-2.0 | |
| name: Test Docker Compose | |
| on: | |
| pull_request: | |
| paths: | |
| - 'docker-compose.yml' | |
| - 'backend/**' | |
| - 'frontend/**' | |
| - '.github/workflows/test_docker_compose.yml' | |
| # Cancel in-progress runs if new commit pushed | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: {} | |
| jobs: | |
| test-docker-compose: | |
| name: Test Docker Compose | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0 | |
| - name: Build and start services | |
| env: | |
| SEED_DATA: "true" # Enable seeding to test full application setup | |
| DISABLE_PERIODIC_TASKS: "true" # Disable external API calls in CI | |
| run: | | |
| docker compose build | |
| # Use --wait flag to wait for services to be healthy before returning | |
| docker compose up -d --wait --wait-timeout 300 | |
| - name: Show service status | |
| run: | | |
| echo "All services are up and healthy!" | |
| docker compose ps | |
| - name: Test API endpoint | |
| run: | | |
| echo "Testing API version endpoint..." | |
| curl -f http://localhost:30000/v1/version || (echo "API test failed" && exit 1) | |
| - name: Test Frontend | |
| run: | | |
| echo "Testing frontend HTTP response..." | |
| curl -f -I http://localhost:30001 || (echo "Frontend test failed" && exit 1) | |
| - name: Test Database connectivity | |
| run: | | |
| echo "Testing database connectivity through API..." | |
| # The API health check already verifies DB connectivity | |
| # but we can also check if migrations ran successfully | |
| docker compose exec -T test-observer-api uv run alembic current || (echo "Database migration check failed" && exit 1) | |
| - name: Show service logs on failure | |
| if: failure() | |
| run: | | |
| echo "=== Docker Compose Status ===" | |
| docker compose ps | |
| echo -e "\n=== Docker Compose Logs ===" | |
| docker compose logs | |
| - name: Clean up | |
| if: always() | |
| run: | | |
| docker compose down -v |