|
1 | | -name: CI |
| 1 | +name: CI tests |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
|
11 | 11 | PGO_VERSION: 5.7.4 |
12 | 12 |
|
13 | 13 | jobs: |
14 | | - validate: |
15 | | - name: Lint checks |
| 14 | + fast-checks: |
| 15 | + name: Simple tests |
16 | 16 | runs-on: ubuntu-latest |
17 | 17 | steps: |
18 | 18 | - uses: actions/checkout@v5 |
|
21 | 21 | with: |
22 | 22 | node-version: '24' |
23 | 23 |
|
24 | | - - name: Install ajv-cli |
25 | | - run: npm install -g ajv-cli ajv-formats |
26 | | - |
27 | 24 | - name: Install Helm |
28 | 25 | uses: azure/setup-helm@v4 |
29 | 26 | with: |
|
32 | 29 | - name: Setup Helm dependencies |
33 | 30 | run: ./scripts/deploy.sh setup |
34 | 31 |
|
| 32 | + - name: Install ajv-cli |
| 33 | + run: npm install -g ajv-cli ajv-formats |
| 34 | + |
35 | 35 | - name: Run linters |
36 | 36 | run: make lint |
37 | 37 |
|
38 | 38 | - name: Validate Helm values schema |
39 | 39 | run: make validate-schema |
| 40 | + |
| 41 | + - name: Run Helm unit tests |
| 42 | + run: make tests |
| 43 | + |
| 44 | + integration-tests: |
| 45 | + name: Integration tests |
| 46 | + needs: fast-checks |
| 47 | + if: github.event.pull_request.head.repo.full_name == github.repository |
| 48 | + runs-on: ubuntu-latest |
| 49 | + steps: |
| 50 | + - uses: actions/checkout@v5 |
| 51 | + |
| 52 | + - name: Start K3s cluster |
| 53 | + uses: jupyterhub/action-k3s-helm@v4 |
| 54 | + with: |
| 55 | + k3s-channel: latest |
| 56 | + helm-version: ${{ env.HELM_VERSION }} |
| 57 | + metrics-enabled: false |
| 58 | + docker-enabled: true |
| 59 | + |
| 60 | + - name: Set release name |
| 61 | + run: echo "RELEASE_NAME=eoapi-$(echo "${{ github.sha }}" | cut -c1-8)" >> "$GITHUB_ENV" |
| 62 | + |
| 63 | + - name: Wait for K3s readiness |
| 64 | + run: | |
| 65 | + echo "=== Waiting for K3s cluster to be ready ===" |
| 66 | +
|
| 67 | + # The action already sets up kubectl context, just verify it works |
| 68 | + kubectl cluster-info |
| 69 | + kubectl get nodes |
| 70 | +
|
| 71 | + # Wait for core components |
| 72 | + kubectl wait --for=condition=Ready pod -l k8s-app=kube-dns -n kube-system --timeout=300s |
| 73 | + kubectl wait --for=condition=Ready pod -l app.kubernetes.io/name=traefik -n kube-system --timeout=300s |
| 74 | +
|
| 75 | + # Verify Traefik CRDs |
| 76 | + timeout=300; counter=0 |
| 77 | + for crd in "middlewares.traefik.io" "ingressroutes.traefik.io"; do |
| 78 | + while [ $counter -lt $timeout ] && ! kubectl get crd "$crd" &>/dev/null; do |
| 79 | + sleep 3; counter=$((counter + 3)) |
| 80 | + done |
| 81 | + [ $counter -ge $timeout ] && { echo "❌ Timeout waiting for $crd"; exit 1; } |
| 82 | + done |
| 83 | +
|
| 84 | + echo "✅ K3s cluster ready" |
| 85 | +
|
| 86 | + - name: Deploy eoAPI |
| 87 | + id: deploy |
| 88 | + run: | |
| 89 | + echo "=== eoAPI Deployment ===" |
| 90 | + export RELEASE_NAME="${RELEASE_NAME}" |
| 91 | + export PGO_VERSION="${{ env.PGO_VERSION }}" |
| 92 | + export CI_MODE=true |
| 93 | +
|
| 94 | + # Deploy using consolidated script with CI mode |
| 95 | + ./scripts/deploy.sh --ci |
| 96 | +
|
| 97 | + - name: Validate deployment |
| 98 | + run: | |
| 99 | + echo "=== Post-deployment validation ===" |
| 100 | + ./scripts/test.sh check-deployment |
| 101 | +
|
| 102 | + - name: Run integration tests |
| 103 | + run: | |
| 104 | + export RELEASE_NAME="$RELEASE_NAME" |
| 105 | + ./scripts/test.sh integration --debug |
| 106 | +
|
| 107 | + - name: Debug failed deployment |
| 108 | + if: failure() |
| 109 | + run: | |
| 110 | + ./scripts/debug-deployment.sh |
| 111 | +
|
| 112 | + - name: Cleanup |
| 113 | + if: always() |
| 114 | + run: | |
| 115 | + helm uninstall "$RELEASE_NAME" -n eoapi || true |
| 116 | + kubectl delete namespace eoapi || true |
0 commit comments