From 33d16e71ecdf130ab4c1b79ce99f9e05f5291d59 Mon Sep 17 00:00:00 2001 From: Arthur Belleville Date: Thu, 23 Oct 2025 23:04:56 +0200 Subject: [PATCH] Fix tests --- .circleci/config.yml | 54 ++++++++++++++++----- apps/main/src/components/ProtectedRoute.tsx | 2 +- 2 files changed, 42 insertions(+), 14 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4e0c38a..b0465e8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -109,12 +109,23 @@ jobs: build-apps: executor: node-executor + parameters: + environment: + type: string + default: "staging" steps: - checkout - setup-pnpm - run: - name: Build all apps - command: pnpm run build:apps + name: Build main app for << parameters.environment >> + command: | + cd apps/main + npm run build:<< parameters.environment >> + - run: + name: Build external app + command: | + cd apps/external + npm run build - persist_to_workspace: root: . paths: @@ -124,7 +135,7 @@ jobs: - packages/shared/dist - store_artifacts: path: apps/main/dist - destination: main-app + destination: main-app-<< parameters.environment >> - store_artifacts: path: apps/external/dist destination: external-app @@ -194,20 +205,25 @@ jobs: at: . - setup-pnpm - run: - name: Deploy frontend to staging + name: Deploy main app to staging command: | cd apps/main - echo "Deploying main app to staging..." - # Uncomment and configure your Cloudflare deployment + echo "Deploying main app to staging environment..." + npx wrangler deploy --env staging + - run: + name: Deploy external app to staging + command: | + cd apps/external + echo "Deploying external app to staging..." + # Add external app staging deployment if needed # npx wrangler deploy --env staging - echo "Set CLOUDFLARE_API_TOKEN in CircleCI environment variables" - run: name: Deploy API to staging command: | echo "Deploying API to staging environment..." # Add your API deployment commands here # Example for Google Cloud Run: - # gcloud run deploy xtablo-api --image gcr.io/${GCP_PROJECT}/xtablo-api:${CIRCLE_SHA1} --region us-central1 + # gcloud run deploy xtablo-api-staging --image gcr.io/${GCP_PROJECT}/xtablo-api:${CIRCLE_SHA1} --region us-central1 deploy-production: executor: node-executor @@ -217,15 +233,25 @@ jobs: at: . - setup-pnpm - run: - name: Deploy frontend to production + name: Deploy main app to production command: | - echo "Deploying to production..." - pnpm run deploy:all + cd apps/main + echo "Deploying main app to production environment..." + npx wrangler deploy --env production + - run: + name: Deploy external app to production + command: | + cd apps/external + echo "Deploying external app to production..." + # Add external app production deployment if needed + # npx wrangler deploy --env production - run: name: Deploy API to production command: | echo "Deploying API to production environment..." # Add your production API deployment commands here + # Example for Google Cloud Run: + # gcloud run deploy xtablo-api --image gcr.io/${GCP_PROJECT}/xtablo-api:${CIRCLE_SHA1} --region us-central1 # Workflows workflows: @@ -272,8 +298,9 @@ workflows: - test-unit - test-api - # Build phase + # Build phase for staging - build-apps: + environment: "staging" requires: - test-lint - test-typecheck @@ -304,8 +331,9 @@ workflows: - test-unit - test-api - # Build phase + # Build phase for production - build-apps: + environment: "prod" requires: - test-lint - test-typecheck diff --git a/apps/main/src/components/ProtectedRoute.tsx b/apps/main/src/components/ProtectedRoute.tsx index 30690f7..fc045e8 100644 --- a/apps/main/src/components/ProtectedRoute.tsx +++ b/apps/main/src/components/ProtectedRoute.tsx @@ -42,7 +42,7 @@ export const ProtectedRoute = ({ fallback, shouldRedirectToCurrentPage }: Protec return match(status) .with("loading", () => ) - .with("should-land-user", () => ) + .with("should-land-user", () => ) .with("should-redirect", () => ) .with("should-pass", () => ) .exhaustive();