|
| 1 | +# Cloud Build configuration for Firebase Functions All Integration Tests |
| 2 | +# Runs all test suites (both V1 and V2) sequentially |
| 3 | + |
| 4 | +options: |
| 5 | + machineType: "E2_HIGHCPU_8" |
| 6 | + logging: CLOUD_LOGGING_ONLY |
| 7 | + |
| 8 | +timeout: "7200s" |
| 9 | + |
| 10 | +steps: |
| 11 | + # Build SDK and run all test suites sequentially |
| 12 | + # Using the official Google Cloud SDK image which includes gcloud pre-installed |
| 13 | + - name: "gcr.io/google.com/cloudsdktool/cloud-sdk:stable" |
| 14 | + id: "build-sdk-and-test-all" |
| 15 | + entrypoint: "bash" |
| 16 | + args: |
| 17 | + - "-c" |
| 18 | + - | |
| 19 | + # Install Node.js 20.x |
| 20 | + echo "Installing Node.js 20..." |
| 21 | + apt-get update -qq |
| 22 | + apt-get install -y -qq curl |
| 23 | + curl -fsSL https://deb.nodesource.com/setup_20.x | bash - |
| 24 | + apt-get install -y -qq nodejs |
| 25 | + node --version |
| 26 | + npm --version |
| 27 | +
|
| 28 | + # Step 1: Build and pack the firebase-functions SDK from source |
| 29 | + echo "Building firebase-functions SDK from source..." |
| 30 | + pwd |
| 31 | + ls -la |
| 32 | + npm ci |
| 33 | + npm run build |
| 34 | + npm pack |
| 35 | + # Move the tarball to where integration tests expect it |
| 36 | + mv firebase-functions-*.tgz integration_test/firebase-functions-local.tgz |
| 37 | + echo "SDK built and packed successfully" |
| 38 | +
|
| 39 | + # Step 2: Run all integration tests with the local SDK |
| 40 | + cd integration_test |
| 41 | + echo "Installing test dependencies..." |
| 42 | + npm ci |
| 43 | + # Install firebase-tools globally |
| 44 | + npm install -g firebase-tools |
| 45 | + # gcloud is already available in this image |
| 46 | + gcloud config set project "$PROJECT_ID" |
| 47 | + # Verify tools are installed |
| 48 | + firebase --version |
| 49 | + gcloud --version |
| 50 | + # Verify gcloud project is set correctly |
| 51 | + gcloud config get-value project |
| 52 | + # Set environment variables |
| 53 | + export PROJECT_ID="$PROJECT_ID" |
| 54 | + echo "Running all tests on project: $PROJECT_ID" |
| 55 | + # Use Application Default Credentials (Cloud Build service account) |
| 56 | + # Run all test suites sequentially |
| 57 | + node scripts/run-tests.js --sequential --skip-cleanup |
| 58 | +
|
| 59 | +# Artifacts to store |
| 60 | +artifacts: |
| 61 | + objects: |
| 62 | + location: "gs://${PROJECT_ID}_cloudbuild/artifacts/${BUILD_ID}" |
| 63 | + paths: |
| 64 | + - "logs/**/*.log" |
0 commit comments