From 34b74213ec6f17ab723b3eef09b441838c9ad35c Mon Sep 17 00:00:00 2001 From: Acho Arnold Ewin Date: Tue, 17 Nov 2026 02:45:34 +0200 Subject: [PATCH 1/3] fix(ci): unify pipeline naming and parallelize deployments Build the web artifact alongside API deployment after integration tests, then deploy that artifact to both frontend hosts in parallel. Standardize names, publish one CI/CD badge, pin Ubuntu runners, and configure the Go module cache paths. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a0fd7292-f3aa-4919-929f-d73c2ac0f0c2 --- .github/workflows/api.yml | 135 +++++++++++++++++++++++++++++++------- .github/workflows/web.yml | 90 ------------------------- README.md | 3 +- api/cloudbuild.yaml | 4 +- tests/README.md | 6 ++ web/firebase.json | 2 +- 6 files changed, 122 insertions(+), 118 deletions(-) delete mode 100644 .github/workflows/web.yml diff --git a/.github/workflows/api.yml b/.github/workflows/api.yml index 6c5848361..c58bc265c 100644 --- a/.github/workflows/api.yml +++ b/.github/workflows/api.yml @@ -1,4 +1,4 @@ -name: api +name: CI/CD on: push: @@ -10,34 +10,40 @@ on: permissions: contents: read - id-token: write + +concurrency: + group: ci-cd-${{ github.ref }} + cancel-in-progress: false jobs: - test: - name: Integration Tests - runs-on: ubuntu-latest + integration-tests: + name: Run Integration Tests + runs-on: ubuntu-24.04 steps: - - name: Checkout + - name: Checkout Code uses: actions/checkout@v7 - - name: Set up Go + - name: Set Up Go uses: actions/setup-go@v7 with: go-version: stable + cache-dependency-path: | + api/go.sum + tests/go.sum - - name: Generate Firebase credentials + - name: Generate Firebase Credentials run: | bash tests/generate-firebase-credentials.sh tests/firebase-credentials.json echo "FIREBASE_CREDENTIALS=$(jq -c . tests/firebase-credentials.json)" >> $GITHUB_ENV - - name: Generate adapter certificates + - name: Generate Adapter Certificates run: bash tests/generate-adapter-certificates.sh tests/certs - name: Start Services working-directory: ./tests run: docker compose up -d --build - - name: Wait for services to be healthy + - name: Wait for Healthy Services working-directory: ./tests run: | echo "Waiting for MongoDB to be healthy..." @@ -74,7 +80,7 @@ jobs: working-directory: ./tests run: | echo "Waiting for seed container to finish..." - docker compose wait seed || true + docker compose wait seed sleep 2 - name: Run Handler Integration Tests @@ -83,11 +89,11 @@ jobs: USER_API_KEY: test-user-api-key run: go test -tags integration -v -timeout 60s ./pkg/handlers - - name: Run Integration Tests + - name: Run End-to-End Integration Tests working-directory: ./tests run: go test -v -timeout 300s ./... - - name: Collect Logs on Failure + - name: Collect Service Logs on Failure if: failure() working-directory: ./tests run: | @@ -98,11 +104,15 @@ jobs: working-directory: ./tests run: docker compose down -v - deploy: - name: Deploy - runs-on: ubuntu-latest - needs: test + deploy-api: + name: Deploy API + runs-on: ubuntu-24.04 + needs: integration-tests if: github.event_name == 'push' && github.ref == 'refs/heads/main' + timeout-minutes: 60 + permissions: + contents: read + id-token: write steps: - name: Authenticate to Google Cloud uses: google-github-actions/auth@v3 @@ -110,10 +120,10 @@ jobs: workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }} - - name: Set up Cloud SDK + - name: Set Up Google Cloud SDK uses: google-github-actions/setup-gcloud@v3 - - name: Trigger Cloud Build Deploy + - name: Build and Deploy API run: | BUILD_ID=$(gcloud builds triggers run api-httpsms-com \ --region=global \ @@ -135,12 +145,91 @@ jobs: sleep 30 done + build-web: + name: Build Web + needs: integration-tests + runs-on: ubuntu-24.04 + defaults: + run: + working-directory: ./web + steps: + - name: Checkout Code + uses: actions/checkout@v7 + + - name: Set Up Node.js + uses: actions/setup-node@v7 + with: + node-version: "24.18" + + - name: Set Up pnpm + uses: pnpm/action-setup@v6 + with: + version: 11.11.0 + + - name: Install Web Dependencies + run: pnpm install --trust-lockfile + + - name: Lint Web + run: pnpm lint + + - name: Run Web Tests + run: pnpm test + + - name: Build Web + run: mv .env.production .env && pnpm run generate + + - name: Upload Web Build + uses: actions/upload-artifact@v7 + with: + name: web-build + path: web/.output/public + include-hidden-files: true + if-no-files-found: error + retention-days: 1 + deploy-web: - name: Deploy Web - needs: deploy + name: Deploy Web (${{ matrix.provider }}) + needs: [deploy-api, build-web] + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + runs-on: ubuntu-24.04 permissions: contents: read pull-requests: write deployments: write - uses: ./.github/workflows/web.yml - secrets: inherit + strategy: + fail-fast: false + matrix: + provider: [Cloudflare, Firebase] + steps: + - name: Checkout Code + uses: actions/checkout@v7 + + - name: Set Up Node.js + uses: actions/setup-node@v7 + with: + node-version: "24.18" + + - name: Download Web Build + uses: actions/download-artifact@v8 + with: + name: web-build + path: web/.output/public + + - name: Deploy Web to Cloudflare + if: matrix.provider == 'Cloudflare' + uses: cloudflare/wrangler-action@v4 + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + command: pages deploy web/.output/public --project-name=httpsms + gitHubToken: ${{ secrets.GITHUB_TOKEN }} + + - name: Deploy Web to Firebase + if: matrix.provider == 'Firebase' + uses: FirebaseExtended/action-hosting-deploy@500ac625ca2dd40cbd15f7659af953801858032a + with: + repoToken: "${{ secrets.GITHUB_TOKEN }}" + channelId: live + entryPoint: "./web" + firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_HTTPSMS_86C51 }}" + projectId: httpsms-86c51 diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml deleted file mode 100644 index 7ce643d66..000000000 --- a/.github/workflows/web.yml +++ /dev/null @@ -1,90 +0,0 @@ -name: web - -on: - workflow_call: - pull_request: - branches: - - main - -permissions: - contents: read - pull-requests: write - deployments: write - -defaults: - run: - working-directory: ./web - -jobs: - validate: - name: Validate - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: [ubuntu-latest] - node: [24] - - steps: - - name: Checkout ๐Ÿ›Ž - uses: actions/checkout@master - - - uses: pnpm/action-setup@v6 - name: Install pnpm - with: - version: 11.11.0 - - - name: Install dependencies ๐Ÿ“ฆ - run: pnpm install --trust-lockfile - - - name: Run linter ๐Ÿ‘€ - run: pnpm lint - - - name: Run tests ๐Ÿงช - run: pnpm test - - - name: Build ๐Ÿ—๏ธ - run: mv .env.production .env && pnpm run generate - - deploy: - name: Deploy - needs: validate - if: github.event_name == 'push' && github.ref == 'refs/heads/main' - runs-on: ubuntu-latest - - steps: - - name: Checkout ๐Ÿ›Ž - uses: actions/checkout@master - - - name: Setup Node ๐ŸŸข - uses: actions/setup-node@v7 - with: - node-version: "24.18" - - - uses: pnpm/action-setup@v6 - name: Install pnpm - with: - version: 11.11.0 - - - name: Install dependencies ๐Ÿ“ฆ - run: pnpm install --trust-lockfile - - - name: Build ๐Ÿ—๏ธ - run: mv .env.production .env && pnpm run generate - - - name: Cloudflare Deploy ๐Ÿš€ - uses: cloudflare/wrangler-action@v4 - with: - apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} - accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - command: pages deploy web/.output/public --project-name=httpsms - gitHubToken: ${{ secrets.GITHUB_TOKEN }} - - - name: Firebase Deploy ๐Ÿš€ - uses: FirebaseExtended/action-hosting-deploy@500ac625ca2dd40cbd15f7659af953801858032a - with: - repoToken: "${{ secrets.GITHUB_TOKEN }}" - channelId: live - entryPoint: "./web" - firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_HTTPSMS_86C51 }}" - projectId: httpsms-86c51 diff --git a/README.md b/README.md index 42a6b0d36..0bef0477a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # httpSMS -[![Web](https://github.com/NdoleStudio/httpsms/actions/workflows/web.yml/badge.svg)](https://github.com/NdoleStudio/httpsms/actions/workflows/web.yml) -[![API](https://github.com/NdoleStudio/httpsms/actions/workflows/api.yml/badge.svg)](https://github.com/NdoleStudio/httpsms/actions/workflows/api.yml) +[![CI/CD](https://github.com/NdoleStudio/httpsms/actions/workflows/api.yml/badge.svg)](https://github.com/NdoleStudio/httpsms/actions/workflows/api.yml) [![GitHub contributors](https://img.shields.io/github/contributors/NdoleStudio/httpsms)](https://github.com/NdoleStudio/httpsms/graphs/contributors) [![GitHub license](https://img.shields.io/github/license/NdoleStudio/httpsms?color=brightgreen)](https://github.com/NdoleStudio/httpsms/blob/master/LICENSE) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md) diff --git a/api/cloudbuild.yaml b/api/cloudbuild.yaml index ce819104e..1137fb183 100644 --- a/api/cloudbuild.yaml +++ b/api/cloudbuild.yaml @@ -1,6 +1,6 @@ steps: - name: "gcr.io/kaniko-project/executor:v1.23.2" - id: "Build image and push" + id: "Build and Push API Image" dir: "api" args: - "--destination=us.gcr.io/$PROJECT_ID/$_SERVICE_NAME:$_VERSION" @@ -10,7 +10,7 @@ steps: - "--build-arg=VERSION=$_VERSION" - "--snapshot-mode=time" - - id: "Deploy to cloud run" + - id: "Deploy API" name: "gcr.io/cloud-builders/gcloud" entrypoint: "bash" args: diff --git a/tests/README.md b/tests/README.md index 35c144b68..b4fbcad6f 100644 --- a/tests/README.md +++ b/tests/README.md @@ -140,6 +140,12 @@ the adapter CA/server certificate before building the Compose stack. The workflow runs API handler integration tests and this complete host-side suite, collects service logs on failure, and always tears the stack down. +After integration tests pass, the CI/CD workflow builds the web frontend and +deploys the API in parallel. On pushes to `main`, the web build is deployed to +Cloudflare and Firebase in parallel only after both jobs succeed. Pull requests +run integration tests and web validation/build without deploying. Both the API +and web use the workflow run number as their version. + ## Test Data | Entity | Value | diff --git a/web/firebase.json b/web/firebase.json index 0a3d84e34..c0b714cb3 100644 --- a/web/firebase.json +++ b/web/firebase.json @@ -1,6 +1,6 @@ { "hosting": { - "public": "dist", + "public": ".output/public", "ignore": ["firebase.json", "**/.*", "**/node_modules/**"], "rewrites": [ { From c3476f002b69b0b0b80bbe2597cc028cba26bd60 Mon Sep 17 00:00:00 2001 From: Acho Arnold Ewin Date: Tue, 17 Nov 2026 02:47:54 +0200 Subject: [PATCH 2/3] fix(ci): use Ubuntu 26.04 runners Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a0fd7292-f3aa-4919-929f-d73c2ac0f0c2 --- .github/workflows/api.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/api.yml b/.github/workflows/api.yml index c58bc265c..d2b62509a 100644 --- a/.github/workflows/api.yml +++ b/.github/workflows/api.yml @@ -18,7 +18,7 @@ concurrency: jobs: integration-tests: name: Run Integration Tests - runs-on: ubuntu-24.04 + runs-on: ubuntu-26.04 steps: - name: Checkout Code uses: actions/checkout@v7 @@ -106,7 +106,7 @@ jobs: deploy-api: name: Deploy API - runs-on: ubuntu-24.04 + runs-on: ubuntu-26.04 needs: integration-tests if: github.event_name == 'push' && github.ref == 'refs/heads/main' timeout-minutes: 60 @@ -148,7 +148,7 @@ jobs: build-web: name: Build Web needs: integration-tests - runs-on: ubuntu-24.04 + runs-on: ubuntu-26.04 defaults: run: working-directory: ./web @@ -191,7 +191,7 @@ jobs: name: Deploy Web (${{ matrix.provider }}) needs: [deploy-api, build-web] if: github.event_name == 'push' && github.ref == 'refs/heads/main' - runs-on: ubuntu-24.04 + runs-on: ubuntu-26.04 permissions: contents: read pull-requests: write From 3e63e0861b601df62ab637bc2882268e34229c4d Mon Sep 17 00:00:00 2001 From: Acho Arnold Ewin Date: Tue, 17 Nov 2026 02:50:34 +0200 Subject: [PATCH 3/3] fix(ci): rename unified workflow and use Actions run IDs Rename the workflow to ci.yaml and update documentation links. Use the same repository-wide Actions run ID for API and web versions so renaming the workflow does not restart the version sequence. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a0fd7292-f3aa-4919-929f-d73c2ac0f0c2 --- .github/workflows/{api.yml => ci.yaml} | 2 +- README.md | 2 +- tests/README.md | 5 +++-- web/nuxt.config.ts | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) rename .github/workflows/{api.yml => ci.yaml} (99%) diff --git a/.github/workflows/api.yml b/.github/workflows/ci.yaml similarity index 99% rename from .github/workflows/api.yml rename to .github/workflows/ci.yaml index d2b62509a..3ea751c2d 100644 --- a/.github/workflows/api.yml +++ b/.github/workflows/ci.yaml @@ -129,7 +129,7 @@ jobs: --region=global \ --project=httpsms-86c51 \ --sha=${{ github.sha }} \ - --substitutions=_VERSION=${{ github.run_number }} \ + --substitutions=_VERSION=${{ github.run_id }} \ --format="value(metadata.build.id)") echo -e "Cloud Build: \033[34mhttps://console.cloud.google.com/cloud-build/builds/$BUILD_ID?project=httpsms-86c51\033[0m" echo "" diff --git a/README.md b/README.md index 0bef0477a..b90eda91e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # httpSMS -[![CI/CD](https://github.com/NdoleStudio/httpsms/actions/workflows/api.yml/badge.svg)](https://github.com/NdoleStudio/httpsms/actions/workflows/api.yml) +[![CI/CD](https://github.com/NdoleStudio/httpsms/actions/workflows/ci.yaml/badge.svg)](https://github.com/NdoleStudio/httpsms/actions/workflows/ci.yaml) [![GitHub contributors](https://img.shields.io/github/contributors/NdoleStudio/httpsms)](https://github.com/NdoleStudio/httpsms/graphs/contributors) [![GitHub license](https://img.shields.io/github/license/NdoleStudio/httpsms?color=brightgreen)](https://github.com/NdoleStudio/httpsms/blob/master/LICENSE) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md) diff --git a/tests/README.md b/tests/README.md index b4fbcad6f..0069fe618 100644 --- a/tests/README.md +++ b/tests/README.md @@ -135,7 +135,7 @@ cd tests && \ ## CI/CD -`.github/workflows/api.yml` generates both the fake Firebase credential and +`.github/workflows/ci.yaml` generates both the fake Firebase credential and the adapter CA/server certificate before building the Compose stack. The workflow runs API handler integration tests and this complete host-side suite, collects service logs on failure, and always tears the stack down. @@ -144,7 +144,8 @@ After integration tests pass, the CI/CD workflow builds the web frontend and deploys the API in parallel. On pushes to `main`, the web build is deployed to Cloudflare and Firebase in parallel only after both jobs succeed. Pull requests run integration tests and web validation/build without deploying. Both the API -and web use the workflow run number as their version. +and web use the GitHub Actions run ID as their version, preserving increasing +versions across workflow file renames. ## Test Data diff --git a/web/nuxt.config.ts b/web/nuxt.config.ts index ae3c47149..1fde102fe 100644 --- a/web/nuxt.config.ts +++ b/web/nuxt.config.ts @@ -113,7 +113,7 @@ export default defineNuxtConfig({ runtimeConfig: { public: { apiBaseUrl: process.env.API_BASE_URL || 'http://localhost:8000', - clientVersion: process.env.GITHUB_RUN_NUMBER || 'dev', + clientVersion: process.env.GITHUB_RUN_ID || 'dev', appUrl: process.env.APP_URL || 'https://httpsms.com', appName: process.env.APP_NAME || 'HTTP SMS', appGithubUrl: