|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + |
| 6 | +jobs: |
| 7 | + image-build: |
| 8 | + name: Image Build |
| 9 | + runs-on: ubuntu-latest |
| 10 | + steps: |
| 11 | + - name: Checkout |
| 12 | + uses: actions/checkout@v4 |
| 13 | + - name: Set up QEMU |
| 14 | + uses: docker/setup-qemu-action@v3 |
| 15 | + - name: Set up Docker Buildx |
| 16 | + uses: docker/setup-buildx-action@v3 |
| 17 | + with: |
| 18 | + platforms: linux/amd64,linux/arm64 |
| 19 | + - name: Login to GitHub Container Registry |
| 20 | + uses: docker/login-action@v3 |
| 21 | + with: |
| 22 | + registry: ghcr.io |
| 23 | + username: ${{ github.actor }} |
| 24 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 25 | + - name: Setup Skaffold |
| 26 | + uses: heypigeonhq/setup-skaffold@v1.0.0 |
| 27 | + with: |
| 28 | + version: 2.14.1 |
| 29 | + - name: Build images |
| 30 | + run: | |
| 31 | + mkdir build |
| 32 | + skaffold build --file-output=build/images.json |
| 33 | + - name: Archive image tags |
| 34 | + uses: actions/upload-artifact@v4 |
| 35 | + with: |
| 36 | + name: images |
| 37 | + path: build/images.json |
| 38 | + |
| 39 | + verify: |
| 40 | + name: Verify |
| 41 | + runs-on: ubuntu-latest |
| 42 | + env: |
| 43 | + CODECOV_FILE: build/coverage.xml |
| 44 | + steps: |
| 45 | + - name: Checkout |
| 46 | + uses: actions/checkout@v4 |
| 47 | + - name: Setup Go |
| 48 | + uses: actions/setup-go@v5 |
| 49 | + with: |
| 50 | + go-version: '1.24' |
| 51 | + - name: Generate |
| 52 | + run: make generate format |
| 53 | + - name: No changed files |
| 54 | + run: git diff --name-status --exit-code |
| 55 | + - name: Lint |
| 56 | + run: make lint |
| 57 | + - name: Integration test |
| 58 | + run: make integration-test coverage |
| 59 | + - name: Archive coverage report |
| 60 | + uses: actions/upload-artifact@v4 |
| 61 | + with: |
| 62 | + name: coverage |
| 63 | + path: ${{ env.CODECOV_FILE }} |
| 64 | + |
| 65 | + e2e: |
| 66 | + name: E2E Test |
| 67 | + if: github.actor!= 'dependabot-preview[bot]' |
| 68 | + needs: |
| 69 | + - verify |
| 70 | + - image-build |
| 71 | + runs-on: ubuntu-latest |
| 72 | + env: |
| 73 | + CODECOV_FILE: build/coverage.e2e.xml |
| 74 | + SKAFFOLD_NAMESPACE: sandbox |
| 75 | + SKAFFOLD_RUN_ID: e2e-test |
| 76 | + steps: |
| 77 | + - name: Checkout |
| 78 | + uses: actions/checkout@v4 |
| 79 | + - name: Setup Skaffold |
| 80 | + uses: heypigeonhq/setup-skaffold@v1.0.0 |
| 81 | + with: |
| 82 | + version: 2.14.1 |
| 83 | + - name: Create Kind cluster |
| 84 | + uses: helm/kind-action@v1 |
| 85 | + - name: Bootstrap |
| 86 | + run: | |
| 87 | + kustomize build --enable-helm config/bootstrap | kubectl apply -f - |
| 88 | + kubectl wait deployment/cert-manager-webhook \ |
| 89 | + --namespace cert-manager \ |
| 90 | + --for=condition=Available \ |
| 91 | + --timeout=5m |
| 92 | + kubectl get namespace sandbox 2>/dev/null || kubectl create namespace sandbox |
| 93 | + mkdir build/ |
| 94 | + skaffold config set kind-disable-load true |
| 95 | + - name: Download image tags |
| 96 | + uses: actions/download-artifact@v4 |
| 97 | + with: |
| 98 | + name: images |
| 99 | + path: build |
| 100 | + - name: Deploy |
| 101 | + run: skaffold deploy --profile e2e --build-artifacts=build/images.json |
| 102 | + - name: Run E2E tests |
| 103 | + run: skaffold verify --namespace sandbox --build-artifacts=build/images.json |
| 104 | + - name: Fetch coverage |
| 105 | + run: make fetch-coverage |
| 106 | + - name: Archive coverage report |
| 107 | + uses: actions/upload-artifact@v4 |
| 108 | + with: |
| 109 | + name: coverage-e2e |
| 110 | + path: ${{ env.CODECOV_FILE }} |
| 111 | + |
| 112 | + coverage: |
| 113 | + name: Coverage Report |
| 114 | + if: github.actor!= 'dependabot-preview[bot]' |
| 115 | + needs: |
| 116 | + - verify |
| 117 | + - e2e |
| 118 | + runs-on: ubuntu-latest |
| 119 | + steps: |
| 120 | + - name: Download coverage report |
| 121 | + uses: actions/download-artifact@v4 |
| 122 | + with: |
| 123 | + name: coverage |
| 124 | + - name: Download E2E coverage report |
| 125 | + uses: actions/download-artifact@v4 |
| 126 | + with: |
| 127 | + name: coverage-e2e |
| 128 | + - name: Upload coverage reports to Codecov |
| 129 | + uses: codecov/codecov-action@v5 |
| 130 | + with: |
| 131 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 132 | + files: coverage.xml,coverage.e2e.xml |
0 commit comments