elimination of redundant mappers #68
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: Backend CI | |
| on: | |
| push: | |
| branches: [main, dev] | |
| paths: | |
| - 'backend/**' | |
| - '.github/workflows/backend-ci.yml' | |
| - 'docker-compose.ci.yaml' | |
| pull_request: | |
| branches: [main, dev] | |
| paths: | |
| - 'backend/**' | |
| - '.github/workflows/backend-ci.yml' | |
| - 'docker-compose.ci.yaml' | |
| workflow_dispatch: | |
| jobs: | |
| integration: | |
| name: Integration Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: "backend/uv.lock" | |
| - name: Install Python dependencies | |
| run: | | |
| cd backend | |
| uv python install 3.12 | |
| uv sync --frozen | |
| - name: Setup Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Setup Kubernetes (k3s) | |
| run: | | |
| curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--disable=traefik --tls-san host.docker.internal" sh - | |
| mkdir -p /home/runner/.kube | |
| sudo k3s kubectl config view --raw > /home/runner/.kube/config | |
| sudo chmod 600 /home/runner/.kube/config | |
| export KUBECONFIG=/home/runner/.kube/config | |
| timeout 90 bash -c 'until sudo k3s kubectl cluster-info; do sleep 5; done' | |
| - name: Create kubeconfig for CI Docker containers | |
| run: | | |
| # Copy real k3s kubeconfig with valid credentials, but change server address | |
| # from 127.0.0.1 to host.docker.internal for Docker container networking | |
| # (k3s was started with --tls-san host.docker.internal so the cert is valid) | |
| sed 's|https://127.0.0.1:6443|https://host.docker.internal:6443|g' \ | |
| /home/runner/.kube/config > backend/kubeconfig.yaml | |
| chmod 644 backend/kubeconfig.yaml | |
| - name: Setup CI Compose | |
| uses: ./.github/actions/setup-ci-compose | |
| with: | |
| kubeconfig-path: /home/runner/.kube/config | |
| - name: Build services | |
| uses: docker/bake-action@v6 | |
| with: | |
| source: . | |
| files: docker-compose.ci.yaml | |
| load: true | |
| set: | | |
| *.cache-from=type=gha,scope=buildkit-${{ github.repository }}-${{ github.ref_name }} | |
| *.cache-from=type=gha,scope=buildkit-${{ github.repository }}-main | |
| *.cache-to=type=gha,mode=max,scope=buildkit-${{ github.repository }}-${{ github.ref_name }} | |
| *.pull=true | |
| env: | |
| BUILDKIT_PROGRESS: plain | |
| - name: Start services | |
| run: | | |
| docker compose -f docker-compose.ci.yaml up -d --remove-orphans | |
| docker compose -f docker-compose.ci.yaml ps | |
| - name: Wait for backend | |
| run: | | |
| curl --retry 60 --retry-delay 5 --retry-all-errors -ksf https://127.0.0.1:443/api/v1/health/live | |
| docker compose -f docker-compose.ci.yaml ps | |
| kubectl get pods -A -o wide | |
| - name: Run integration tests | |
| timeout-minutes: 10 | |
| env: | |
| BACKEND_BASE_URL: https://127.0.0.1:443 | |
| MONGO_ROOT_USER: root | |
| MONGO_ROOT_PASSWORD: rootpassword | |
| MONGODB_HOST: 127.0.0.1 | |
| MONGODB_PORT: 27017 | |
| MONGODB_URL: mongodb://root:[email protected]:27017/?authSource=admin | |
| SCHEMA_SUBJECT_PREFIX: "ci.${{ github.run_id }}." | |
| run: | | |
| cd backend | |
| uv run pytest tests/integration -v -rs --cov=app --cov-branch --cov-report=xml --cov-report=term | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| if: always() | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: backend/coverage.xml | |
| flags: backend | |
| name: backend-coverage | |
| fail_ci_if_error: false | |
| verbose: true | |
| - name: Collect logs | |
| if: failure() | |
| run: | | |
| mkdir -p logs | |
| docker compose -f docker-compose.ci.yaml logs > logs/docker-compose.log | |
| docker compose -f docker-compose.ci.yaml logs backend > logs/backend.log | |
| docker compose -f docker-compose.ci.yaml logs mongo > logs/mongo.log | |
| kubectl get events --sort-by='.metadata.creationTimestamp' > logs/k8s-events.log 2>&1 || true | |
| kubectl describe pods -A > logs/k8s-describe-pods.log 2>&1 || true | |
| - name: Upload logs | |
| if: failure() | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: backend-logs | |
| path: logs/ |