Skip to content

Commit 633578c

Browse files
committed
CI(test): add custom proxy to playwright-actions
This changes the playwright action to use a new custom testing proxy, which should make tests faster and more stable. Also increases the instance size and parallelizes the different long running setups.
1 parent a3302da commit 633578c

File tree

1 file changed

+29
-39
lines changed

1 file changed

+29
-39
lines changed

.github/workflows/playwright-actions.yml

Lines changed: 29 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
playwright-tests:
7373
runs-on:
7474
- codebuild-content-services-be-repo-${{ github.run_id }}-${{ github.run_attempt }}
75-
- instance-size:medium
75+
- instance-size:large
7676
- buildspec-override:true
7777

7878
steps:
@@ -188,9 +188,12 @@ jobs:
188188
with:
189189
go-version: "${{ steps.get-go-version.outputs.go-version }}"
190190

191-
- name: Set up Make
191+
- name: Install Make
192192
run: sudo apt-get install make
193193

194+
- name: Install Parallel
195+
run: sudo apt-get install -y parallel
196+
194197
- name: Copy the example config
195198
run: cp ./configs/config.yaml.example ./configs/config.yaml
196199

@@ -218,14 +221,20 @@ jobs:
218221
echo "CI=true" >> .env
219222
echo 'DB_CONNECTION_STRING="postgresql://content:content@localhost:5433/content"' >> .env
220223
221-
- name: Backend compose-up
222-
run: make compose-down compose-clean compose-up
224+
- name: Set up Node.js
225+
uses: actions/setup-node@v4
226+
with:
227+
node-version-file: "_playwright-tests/.nvmrc"
223228

224-
- name: Import the smallest Redhat repos
225-
run: OPTIONS_REPOSITORY_IMPORT_FILTER=small make repos-import
229+
- name: Increase file watchers limit
230+
run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
226231

227-
- name: Run snapshot for redhat repo
228-
run: go run cmd/external-repos/main.go snapshot https://cdn.redhat.com/content/dist/rhel9/9/aarch64/codeready-builder/os/
232+
- name: Update /etc/hosts
233+
working-directory: content-sources-frontend
234+
run: sudo npm run patch:hosts
235+
236+
- name: Run front-end playwright, API playwright and back-end setups in parallel
237+
run: 'parallel --line-buffer --tagstring "[{#}]:" ::: "cd content-sources-frontend && yarn install && yarn build && yarn playwright install --with-deps" "make compose-down compose-clean compose-up" "cd _playwright-tests && yarn install && yarn playwright install --with-deps"'
229238

230239
- name: Backend run
231240
run: make run &
@@ -235,22 +244,15 @@ jobs:
235244
chmod +x .github/workflowScripts/waitForBackend.sh
236245
.github/workflowScripts/waitForBackend.sh
237246
238-
- name: Set up Node.js
239-
uses: actions/setup-node@v4
240-
with:
241-
node-version-file: "_playwright-tests/.nvmrc"
242-
243-
- name: Install API playwright and dependencies
244-
working-directory: _playwright-tests
245-
run: yarn install
247+
- name: Import the smallest Redhat repos
248+
run: OPTIONS_REPOSITORY_IMPORT_FILTER=small make repos-import
246249

247-
- name: Install Playwright Browsers
248-
working-directory: _playwright-tests
249-
run: yarn playwright install --with-deps
250+
- name: Run snapshot for redhat repo
251+
run: go run cmd/external-repos/main.go snapshot https://cdn.redhat.com/content/dist/rhel9/9/aarch64/codeready-builder/os/
250252

251253
- name: Run API Playwright tests
252254
working-directory: _playwright-tests
253-
run: CURRENTS_PROJECT_ID=V4Ri3k CURRENTS_RECORD_KEY=$CURRENTS_RECORD_KEY yarn playwright test
255+
run: CURRENTS_PROJECT_ID=V4Ri3k CURRENTS_RECORD_KEY=$CURRENTS_RECORD_KEY CURRENTS_CI_BUILD_ID="${{ github.repository }}-${{ github.run_id }}-${{ github.run_attempt }}" yarn playwright test
254256

255257
- name: Publish API Test Report
256258
uses: ctrf-io/github-test-reporter@v1
@@ -266,33 +268,21 @@ jobs:
266268
path: ./_playwright-tests/playwright-ctrf
267269
retention-days: 10
268270

269-
- name: Install front-end dependencies
270-
working-directory: content-sources-frontend
271-
run: yarn install
272-
273-
- name: Install front-end Playwright Browsers
271+
- name: Frontend run (static)
274272
working-directory: content-sources-frontend
275-
run: yarn playwright install --with-deps
276-
- name: Increase file watchers limit
277-
run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
273+
run: yarn fec static --port 8003 &
278274

279-
- name: Update /etc/hosts
275+
- name: Wait for frontend to be ready
280276
working-directory: content-sources-frontend
281-
run: sudo npm run patch:hosts
282-
283-
- name: Build front-end FEC container
284-
working-directory: content-sources-frontend
285-
run: yarn build
277+
run: npx wait-on http://localhost:8003/apps/content-sources/
286278

287-
- name: Start front-end server
279+
- name: Run testing proxy
288280
working-directory: content-sources-frontend
289-
run: |
290-
BACKEND_PORT=8000 yarn start:stage &
291-
npx wait-on https://localhost:1337
281+
run: docker run -d --network=host -e HTTPS_PROXY=$RH_PROXY_URL -v "$(pwd)/config:/config:ro,Z" --name consoledot-testing-proxy quay.io/dvagner/consoledot-testing-proxy
292282

293283
- name: Run front-end Playwright tests
294284
working-directory: content-sources-frontend
295-
run: CURRENTS_PROJECT_ID=V4Ri3k CURRENTS_RECORD_KEY=$CURRENTS_RECORD_KEY yarn playwright test
285+
run: CURRENTS_PROJECT_ID=V4Ri3k CURRENTS_RECORD_KEY=$CURRENTS_RECORD_KEY CURRENTS_CI_BUILD_ID="${{ github.repository }}-${{ github.run_id }}-${{ github.run_attempt }}" yarn playwright test
296286

297287
- name: Publish front-end Test Report
298288
uses: ctrf-io/github-test-reporter@v1

0 commit comments

Comments
 (0)