1+ name : Run app services
2+ on :
3+ push :
4+ branches : [ main, master ]
5+ pull_request :
6+ branches : [ main, master ]
7+
8+ env :
9+ PROJECT_ID : ' benefit-decision-toolkit-play'
10+ WORKLOAD_IDENTITY_PROVIDER : ' projects/1034049717668/locations/global/workloadIdentityPools/github-actions-google-cloud/providers/github'
11+
12+ jobs :
13+ run-services :
14+ runs-on : ' ubuntu-latest'
15+
16+ # Add these permissions for Workload Identity Federation
17+ permissions :
18+ contents : read
19+ id-token : write
20+
21+ steps :
22+ - name : Checkout repository
23+ uses : actions/checkout@v4
24+
25+ # Devbox needs a .env file to exist, even if it's empty
26+ - name : ' Create .env file'
27+ run : touch .env
28+
29+ # Setup devbox which includes Node.js, Firebase CLI, and Google Cloud SDK
30+ - name : ' Install devbox'
31+ uses :
' jetify-com/[email protected] ' 32+ with :
33+ enable-cache : true
34+
35+ # Configure Workload Identity Federation and generate an access token
36+ - id : ' auth'
37+ name : ' Authenticate to Google Cloud'
38+ uses : ' google-github-actions/auth@v2'
39+ with :
40+ workload_identity_provider : ' ${{ env.WORKLOAD_IDENTITY_PROVIDER }}'
41+ service_account : cicd-build-deploy-api@benefit-decision-toolkit-play.iam.gserviceaccount.com
42+ project_id : ${{ env.PROJECT_ID }}
43+
44+ - name : Cache node modules
45+ uses : actions/cache@v4
46+ with :
47+ path : builder-frontend/node_modules
48+ key : ${{ runner.os }}-node-${{ hashFiles('builder-frontend/package-lock.json') }}
49+ restore-keys : |
50+ ${{ runner.os }}-node-
51+
52+ - name : Install dependencies
53+ working-directory : builder-frontend
54+ run : devbox run install-builder-frontend-ci
55+
56+ - name : Run all services
57+ run : devbox services up -b
58+ continue-on-error : true
59+
60+ # E2E Testing
61+
62+ - uses : actions/setup-node@v4
63+ with :
64+ node-version : lts/*
65+ working-directory : e2e
66+
67+ - name : Install dependencies
68+ run : npm ci
69+ working-directory : e2e
70+
71+ - name : Install Playwright Browsers
72+ run : npx playwright install --with-deps
73+ working-directory : e2e
74+
75+ - name : Run Playwright tests
76+ run : npx playwright test
77+ working-directory : e2e
78+
79+ - uses : actions/upload-artifact@v4
80+ if : ${{ !cancelled() }}
81+ with :
82+ name : playwright-report
83+ path : playwright-report/
84+ retention-days : 30
85+ working-directory : e2e
86+
87+ # End E2E Testing
88+
89+ - name : Stop all services
90+ run : devbox services stop
91+ continue-on-error : true
0 commit comments