Skip to content

Commit afa7160

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

File tree

2 files changed

+85
-27
lines changed

2 files changed

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

e2e/.github/workflows/playwright.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)