22name : validate
33
44concurrency :
5- group : validate
5+ group : validate-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
66 cancel-in-progress : true
77
88on :
9+ pull_request :
10+ branches :
11+ - main
912 push :
1013 branches :
11- - ' **'
12- - ' !main'
14+ - main
1315 # Allows you to run this workflow manually from the Actions tab
1416 workflow_dispatch :
1517
2527 IS_CI_AUTOMATION : " yes"
2628 outputs :
2729 src-changed : ${{ steps.check.outputs.src-changed }}
30+ e2e-changed : ${{ steps.check.outputs.e2e-changed }}
2831 iac-changed : ${{ steps.check.outputs.iac-changed }}
2932 steps :
3033 - uses : actions/checkout@v4
5154 - 'src/**'
5255 - 'uv.lock'
5356 - 'vite.config.mjs'
57+ e2e-changed:
58+ - '.github/workflows/validate.yml'
59+ - '.env.example'
60+ - 'config.toml.example'
61+ - 'docker-compose.yml'
62+ - 'Dockerfile.keycloak'
63+ - 'keycloak/**'
64+ - 'test/e2e/**'
5465 iac-changed:
5566 - 'pulumi/**'
5667
@@ -107,8 +118,15 @@ jobs:
107118 src : " pulumi"
108119
109120 run-e2e-tests-local :
110- needs : detect-changes
111- if : false
121+ needs :
122+ - detect-changes
123+ - validate-accounts
124+ if : >-
125+ always() &&
126+ (needs.detect-changes.outputs.src-changed == 'true' || needs.detect-changes.outputs.e2e-changed == 'true') &&
127+ needs.detect-changes.result == 'success' &&
128+ needs.validate-accounts.result != 'failure' &&
129+ needs.validate-accounts.result != 'cancelled'
112130 runs-on : ubuntu-latest
113131 environment :
114132 name : staging
@@ -129,31 +147,47 @@ jobs:
129147 - uses : actions/checkout@v4
130148
131149 - name : Set up local environment
150+ shell : bash
132151 run : |
133152 cp .env.example .env
134153 mkdir -p mail/etc && cp config.toml.example mail/etc/config.toml
135- echo -e "\nFXA_CLIENT_ID=$FXA_CLIENT_ID" >> .env
136- echo "FXA_SECRET=$FXA_SECRET" >> .env
137- echo "SECRET_KEY=$SECRET_KEY" >> .env
138- echo "LOGIN_CODE_SECRET=$LOGIN_CODE_SECRET" >> .env
139- echo "FXA_ENCRYPT_SECRET=$FXA_ENCRYPT_SECRET" >> .env
140- echo "PADDLE_TOKEN=$PADDLE_TOKEN" >> .env
141- echo "PADDLE_API_KEY=$PADDLE_API_KEY" >> .env
142-
143- - name : Start appointment stack via docker
154+ append_env_if_set() {
155+ local key="$1"
156+ local value="${!key}"
157+
158+ if [ -n "$value" ]; then
159+ printf '%s=%s\n' "$key" "$value" >> .env
160+ fi
161+ }
162+
163+ echo >> .env
164+ append_env_if_set FXA_CLIENT_ID
165+ append_env_if_set FXA_SECRET
166+ append_env_if_set SECRET_KEY
167+ append_env_if_set LOGIN_CODE_SECRET
168+ append_env_if_set FXA_ENCRYPT_SECRET
169+ append_env_if_set PADDLE_TOKEN
170+ append_env_if_set PADDLE_API_KEY
171+
172+ - name : Start accounts stack via docker
144173 run : docker compose up -d --build -V
145174
175+ - name : Wait for local services
176+ run : |
177+ curl --retry 30 --retry-all-errors --retry-delay 2 --fail http://localhost:8087/health
178+ curl --retry 30 --retry-all-errors --retry-delay 2 --fail http://localhost:9000/health/ready
179+
146180 - uses : actions/setup-node@v4
147181 with :
148182 node-version : 20
149183 cache : ' npm'
150184 cache-dependency-path : ' test/e2e/package-lock.json'
151185
152186 - name : Install E2E test dependencies
187+ working-directory : test/e2e
153188 run : |
154- cd ./test/e2e
155- npm install
156- npx playwright install
189+ npm ci
190+ npx playwright install --with-deps firefox
157191
158192 - name : Create test plans
159193 run : |
@@ -163,8 +197,8 @@ jobs:
163197
164198 - name : Run E2E tests against local stack
165199 id : e2e
200+ working-directory : test/e2e
166201 run : |
167- cd ./test/e2e
168202 cp .env.dev.example .env
169203 npm run e2e-test
170204
0 commit comments