Merge pull request #52 from Oloodi/26-mobile-cicd-configure-codemagic-firebase-app-distribution---a-production-ready-multi-environment-mobile-pipeline

Mobile cicd configure codemagic firebase app distribution   a production ready multi environment mobile pipeline
This commit is contained in:
Boris-Wilfried
2025-11-19 10:58:01 -05:00
committed by GitHub
1525 changed files with 106103 additions and 9 deletions

View File

@@ -4,11 +4,17 @@
# It is designed to be the main entry point for developers.
# Use .PHONY to declare targets that are not files, to avoid conflicts.
.PHONY: help install dev build integrate-export prepare-export deploy-launchpad deploy-launchpad-full deploy-app admin-install admin-dev admin-build deploy-admin deploy-admin-full configure-iap-launchpad configure-iap-admin list-iap-users remove-iap-user setup-labels export-issues create-issues-from-file install-git-hooks
.PHONY: help install dev build integrate-export prepare-export deploy-launchpad deploy-launchpad-full deploy-app admin-install admin-dev admin-build deploy-admin deploy-admin-full configure-iap-launchpad configure-iap-admin list-iap-users remove-iap-user setup-labels export-issues create-issues-from-file install-git-hooks mobile-client-install mobile-client-dev mobile-client-build mobile-staff-install mobile-staff-dev mobile-staff-build
# The default command to run if no target is specified (e.g., just 'make').
.DEFAULT_GOAL := help
# --- Flutter check ---
FLUTTER := $(shell which flutter)
ifeq ($(FLUTTER),)
$(error "flutter not found in PATH. Please install Flutter and add it to your PATH.")
endif
# --- Firebase & GCP Configuration ---
GCP_DEV_PROJECT_ID := krow-workforce-dev
GCP_STAGING_PROJECT_ID := krow-workforce-staging
@@ -61,6 +67,15 @@ help:
@echo " make dev - Starts the local web frontend server."
@echo " make build - Builds the web frontend for production."
@echo ""
@echo " --- MOBILE APP DEVELOPMENT ---"
@echo " make mobile-client-install - Install dependencies for client app"
@echo " make mobile-client-dev - Run client app in dev mode"
@echo " make mobile-client-build - Build client app (requires ENV & PLATFORM, optional BUILD_TYPE=apk)"
@echo ""
@echo " make mobile-staff-install - Install dependencies for staff app"
@echo " make mobile-staff-dev - Run staff app in dev mode"
@echo " make mobile-staff-build - Build staff app (requires ENV & PLATFORM, optional BUILD_TYPE=apk)"
@echo ""
@echo " --- DEPLOYMENT ---"
@echo " make deploy-launchpad-full - Deploys internal launchpad to Cloud Run (dev only) with IAP."
@echo " make deploy-admin-full [ENV=staging] - Deploys Admin Console to Cloud Run with IAP (default: dev)."
@@ -72,7 +87,7 @@ help:
@echo ""
@echo " --- PROJECT MANAGEMENT & TOOLS ---"
@echo " make setup-labels - Creates/updates GitHub labels from labels.yml."
@echo " make export-issues [ARGS="--state=all --label=bug"] - Exports GitHub issues to a markdown file. See scripts/export_issues.sh for options."
@echo " make export-issues [ARGS=\"--state=all --label=bug\"] - Exports GitHub issues to a markdown file. See scripts/export_issues.sh for options."
@echo " make create-issues-from-file - Bulk creates GitHub issues from a markdown file."
@echo " make install-git-hooks - Installs git pre-push hook to protect main/dev branches."
@echo ""
@@ -193,7 +208,7 @@ configure-iap-launchpad:
@gcloud run services add-iam-policy-binding $(CR_LAUNCHPAD_SERVICE_NAME) \
--region=$(CR_LAUNCHPAD_REGION) \
--project=$(GCP_DEV_PROJECT_ID) \
--member="serviceAccount:$(IAP_SERVICE_ACCOUNT)" \
--member=\"serviceAccount:$(IAP_SERVICE_ACCOUNT)\" \
--role='roles/run.invoker' \
--quiet
@echo " - Adding users from iap-users.txt..."
@@ -205,7 +220,7 @@ configure-iap-launchpad:
--resource-type=cloud-run \
--service=$(CR_LAUNCHPAD_SERVICE_NAME) \
--region=$(CR_LAUNCHPAD_REGION) \
--member="$$member" \
--member=\"$$member\" \
--role='roles/iap.httpsResourceAccessor' \
--quiet; \
done
@@ -217,7 +232,7 @@ configure-iap-admin:
@gcloud run services add-iam-policy-binding $(CR_ADMIN_SERVICE_NAME) \
--region=$(CR_ADMIN_REGION) \
--project=$(GCP_PROJECT_ID) \
--member="serviceAccount:$(IAP_SERVICE_ACCOUNT)" \
--member=\"serviceAccount:$(IAP_SERVICE_ACCOUNT)\" \
--role='roles/run.invoker' \
--quiet
@echo " - Adding users from iap-users.txt..."
@@ -229,7 +244,7 @@ configure-iap-admin:
--resource-type=cloud-run \
--service=$(CR_ADMIN_SERVICE_NAME) \
--region=$(CR_ADMIN_REGION) \
--member="$$member" \
--member=\"$$member\" \
--role='roles/iap.httpsResourceAccessor' \
--quiet; \
done
@@ -254,7 +269,7 @@ remove-iap-user:
--resource-type=cloud-run \
--service=$(IAP_SERVICE_NAME) \
--region=$(IAP_SERVICE_REGION) \
--member="$(USER)" \
--member=\"$(USER)\" \
--role='roles/iap.httpsResourceAccessor' \
--quiet
@echo "✅ User removed from IAP."
@@ -329,4 +344,69 @@ dataconnect-init:
dataconnect-deploy:
@echo "--> Deploying Firebase Data Connect schemas to [$(ENV)] (project: $(FIREBASE_ALIAS))..."
@firebase deploy --only dataconnect --project=$(FIREBASE_ALIAS)
@echo "✅ Data Connect deployment completed for [$(ENV)]."
@echo "✅ Data Connect deployment completed for [$(ENV)]."
# --- Mobile App Development ---
FLAVOR :=
ifeq ($(ENV),dev)
FLAVOR := dev
else ifeq ($(ENV),staging)
FLAVOR := staging
else ifeq ($(ENV),prod)
FLAVOR := production
endif
BUILD_TYPE ?= appbundle
mobile-client-install:
@echo "--> Installing Flutter dependencies for client app..."
@cd mobile-apps/client-app && $(FLUTTER) pub get
mobile-client-dev:
@echo "--> Running client app in dev mode..."
@echo "--> If using VS code, use the debug configurations"
@cd mobile-apps/client-app && $(FLUTTER) run --flavor dev -t lib/main_dev.dart
mobile-client-build:
@if [ "$(ENV)" != "dev" ] && [ "$(ENV)" != "staging" ] && [ "$(ENV)" != "prod" ]; then \
echo "ERROR: ENV must be one of dev, staging, or prod."; exit 1; \
fi
@if [ "$(PLATFORM)" != "android" ] && [ "$(PLATFORM)" != "ios" ]; then \
echo "ERROR: PLATFORM must be either android or ios."; exit 1; \
fi
@echo "--> Building client app for $(PLATFORM) with flavor $(FLAVOR)..."
@cd mobile-apps/client-app && \
$(FLUTTER) pub get && \
$(FLUTTER) pub run build_runner build --delete-conflicting-outputs && \
if [ "$(PLATFORM)" = "android" ]; then \
$(FLUTTER) build $(BUILD_TYPE) --flavor $(FLAVOR); \
elif [ "$(PLATFORM)" = "ios" ]; then \
$(FLUTTER) build ipa --flavor $(FLAVOR); \
fi
mobile-staff-install:
@echo "--> Installing Flutter dependencies for staff app..."
@cd mobile-apps/staff-app && $(FLUTTER) pub get
mobile-staff-dev:
@echo "--> Running staff app in dev mode..."
@echo "--> If using VS code, use the debug configurations"
@cd mobile-apps/staff-app && $(FLUTTER) run --flavor dev -t lib/main_dev.dart
mobile-staff-build:
@if [ "$(ENV)" != "dev" ] && [ "$(ENV)" != "staging" ] && [ "$(ENV)" != "prod" ]; then \
echo "ERROR: ENV must be one of dev, staging, or prod."; exit 1; \
fi
@if [ "$(PLATFORM)" != "android" ] && [ "$(PLATFORM)" != "ios" ]; then \
echo "ERROR: PLATFORM must be either android or ios."; exit 1; \
fi
@echo "--> Building staff app for $(PLATFORM) with flavor $(FLAVOR)..."
@cd mobile-apps/staff-app && \
$(FLUTTER) pub get && \
$(FLUTTER) pub run build_runner build --delete-conflicting-outputs && \
if [ "$(PLATFORM)" = "android" ]; then \
$(FLUTTER) build $(BUILD_TYPE) --flavor $(FLAVOR); \
elif [ "$(PLATFORM)" = "ios" ]; then \
$(FLUTTER) build ipa --flavor $(FLAVOR); \
fi