fixed styles in header and home svelte components #8
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 | |
| on: | |
| push: | |
| branches: [ main, dev ] | |
| pull_request: | |
| branches: [ main, dev ] | |
| workflow_dispatch: | |
| jobs: | |
| tests: | |
| name: Backend Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Install yq | |
| run: | | |
| sudo wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/local/bin/yq | |
| sudo chmod +x /usr/local/bin/yq | |
| - name: Setup Kubernetes (k3s) and Kubeconfig | |
| run: | | |
| curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--disable=traefik --tls-san host.docker.internal" sh - | |
| mkdir -p $HOME/.kube | |
| sudo k3s kubectl config view --raw > $HOME/.kube/config | |
| sudo chmod 600 $HOME/.kube/config | |
| timeout 90 bash -c 'until sudo k3s kubectl cluster-info; do sleep 5; done' | |
| kubectl version | |
| kubectl get nodes | |
| - name: Modify Docker Compose for CI | |
| run: | | |
| cp docker-compose.yaml docker-compose.ci.yaml | |
| # For the backend service | |
| yq eval '.services.backend.extra_hosts += ["host.docker.internal:host-gateway"]' -i docker-compose.ci.yaml | |
| yq eval '.services.backend.environment += ["TESTING=true"]' -i docker-compose.ci.yaml | |
| # For the cert-generator service | |
| yq eval '.services.cert-generator.extra_hosts += ["host.docker.internal:host-gateway"]' -i docker-compose.ci.yaml | |
| yq eval '.services.cert-generator.environment += ["CI=true"]' -i docker-compose.ci.yaml | |
| yq eval '.services.cert-generator.volumes += ["$HOME/.kube/config:/root/.kube/config:ro"]' -i docker-compose.ci.yaml | |
| echo "--- Modified docker-compose.ci.yaml ---" | |
| cat docker-compose.ci.yaml | |
| echo "------------------------------------" | |
| - name: Start services and check status | |
| run: | | |
| echo "Attempting to start services..." | |
| # Try to start services. If the command fails... | |
| docker compose -f docker-compose.ci.yaml up --build -d --remove-orphans || \ | |
| ( | |
| # ...then execute this block of code. | |
| echo "::error::Docker Compose failed to start. Dumping all logs..." | |
| docker compose -f docker-compose.ci.yaml logs | |
| exit 1 # Ensure the job fails | |
| ) | |
| echo "Services started. Waiting for stabilization..." | |
| sleep 45 | |
| echo "Final status of all containers:" | |
| docker compose -f docker-compose.ci.yaml ps | |
| # Explicitly check for containers that have exited | |
| if docker compose -f docker-compose.ci.yaml ps | grep -q 'Exit'; then | |
| echo "::error::One or more containers have exited unexpectedly. See logs above." | |
| docker compose -f docker-compose.ci.yaml logs --no-color | |
| exit 1 | |
| fi | |
| - name: Wait for backend to be healthy | |
| run: | | |
| timeout 300 bash -c 'until curl -k https://localhost:443/api/v1/health -o /dev/null; do \ | |
| echo "Retrying backend health check..."; \ | |
| sleep 5; \ | |
| done' | |
| echo "Backend is healthy!" | |
| - name: Wait for frontend to be ready | |
| run: | | |
| timeout 120 bash -c 'until curl -k https://localhost:5001 -o /dev/null; do \ | |
| echo "Retrying frontend check..."; \ | |
| sleep 5; \ | |
| done' | |
| echo "Frontend is ready!" | |
| - name: Check K8s setup status after startup | |
| run: | | |
| kubectl get pods -A -o wide | |
| kubectl get services -A -o wide | |
| kubectl get sa -n default | |
| kubectl get roles -n default | |
| kubectl get rolebindings -n default | |
| - name: Set up Python for Tests | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.9' | |
| - name: Install Python test dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y python3 python3-pip | |
| cd backend | |
| pip3 install -r requirements.txt | |
| pip3 install -r requirements-dev.txt | |
| - name: Run backend tests with coverage | |
| run: | | |
| cd backend | |
| python -m pytest tests/integration -v --cov=app --cov-report=xml --cov-report=term | |
| - name: Collect logs | |
| if: always() | |
| run: | | |
| mkdir -p logs | |
| docker compose -f docker-compose.ci.yaml logs > logs/docker-compose.log | |
| docker compose -f docker-compose.ci.yaml logs cert-generator > logs/cert-generator.log | |
| docker compose -f docker-compose.ci.yaml logs backend > logs/backend.log | |
| docker compose -f docker-compose.ci.yaml logs frontend > logs/frontend.log | |
| docker compose -f docker-compose.ci.yaml logs mongo > logs/mongo.log | |
| kubectl get events --sort-by='.metadata.creationTimestamp' > logs/k8s-events.log | |
| kubectl get pods -A -o wide > logs/k8s-pods-final.log | |
| kubectl describe pods -A > logs/k8s-describe-pods-final.log | |
| - name: Upload logs | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: integration-test-logs | |
| path: logs/ |