Skip to content

Commit 50247c4

Browse files
WIP github action for running services.
1 parent ee8aa87 commit 50247c4

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
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+
- uses: actions/setup-node@v4
26+
with:
27+
node-version: lts/*
28+
29+
# Devbox needs a .env file to exist, even if it's empty
30+
- name: 'Create .env file'
31+
run: touch .env
32+
33+
# Setup devbox which includes Node.js, Firebase CLI, and Google Cloud SDK
34+
- name: 'Install devbox'
35+
uses: 'jetify-com/[email protected]'
36+
with:
37+
enable-cache: true
38+
39+
# Configure Workload Identity Federation and generate an access token
40+
- id: 'auth'
41+
name: 'Authenticate to Google Cloud'
42+
uses: 'google-github-actions/auth@v2'
43+
with:
44+
workload_identity_provider: '${{ env.WORKLOAD_IDENTITY_PROVIDER }}'
45+
service_account: cicd-build-deploy-api@benefit-decision-toolkit-play.iam.gserviceaccount.com
46+
project_id: ${{ env.PROJECT_ID }}
47+
48+
- name: Cache node modules
49+
uses: actions/cache@v4
50+
with:
51+
path: builder-frontend/node_modules
52+
key: ${{ runner.os }}-node-${{ hashFiles('builder-frontend/package-lock.json') }}
53+
restore-keys: |
54+
${{ runner.os }}-node-
55+
56+
- name: Install dependencies
57+
working-directory: builder-frontend
58+
run: devbox run install-builder-frontend-ci
59+
60+
- name: Run all services
61+
run: devbox services up -b
62+
continue-on-error: true
63+
64+
# E2E Testing
65+
66+
- name: Install dependencies
67+
run: npm ci
68+
working-directory: e2e
69+
70+
- name: Install Playwright Browsers
71+
run: npx playwright install --with-deps
72+
working-directory: e2e
73+
74+
- name: Run Playwright tests
75+
run: npx playwright test
76+
working-directory: e2e
77+
78+
- uses: actions/upload-artifact@v4
79+
if: ${{ !cancelled() }}
80+
with:
81+
name: playwright-report
82+
path: playwright-report/
83+
retention-days: 30
84+
working-directory: e2e
85+
86+
# End E2E Testing
87+
88+
- name: Stop all services
89+
run: devbox services stop
90+
continue-on-error: true

0 commit comments

Comments
 (0)