Skip to content

Commit a1f258d

Browse files
authored
Merge pull request #2166 from oasisprotocol/lw/shard-playwright
Speedup playwright CI
2 parents 3b2e108 + eb3bb1d commit a1f258d

File tree

18 files changed

+142
-95
lines changed

18 files changed

+142
-95
lines changed

.changelog/2166.internal.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Speedup playwright CI

.github/workflows/ci-test.yml

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ jobs:
5656
path: coverage
5757
retention-days: 5
5858

59-
playwright:
59+
playwright-prepare:
6060
# NOTE: This name appears in GitHub's Checks API.
61-
name: playwright
61+
name: playwright-prepare
6262
needs: [yarn_cache]
6363
runs-on: ubuntu-latest
6464
steps:
@@ -72,24 +72,58 @@ jobs:
7272
- name: Install dependencies
7373
run: yarn install --frozen-lockfile
7474
- run: REACT_APP_E2E_TEST=1 yarn build:ext
75-
- run: REACT_APP_E2E_TEST=1 yarn start:prod &
75+
- run: REACT_APP_E2E_TEST=1 yarn build
76+
- name: Upload builds for playwright
77+
uses: actions/upload-artifact@v4
78+
with:
79+
name: builds-for-playwright
80+
path: |
81+
./build
82+
./build-ext
83+
retention-days: 5
84+
85+
playwright:
86+
# NOTE: This name appears in GitHub's Checks API.
87+
name: playwright
88+
needs: [playwright-prepare]
89+
runs-on: ubuntu-latest
90+
container:
91+
image: mcr.microsoft.com/playwright:v1.46.1-noble
92+
options: --user 1001
93+
strategy:
94+
fail-fast: false
95+
matrix:
96+
shardIndex: [1, 2, 3, 4, 5, 6, 7, 8]
97+
shardTotal: [8]
98+
steps:
99+
- name: Checkout code
100+
uses: actions/checkout@v4
101+
- name: Set up Node.js 18
102+
uses: actions/setup-node@v4
103+
with:
104+
node-version: '18.x'
105+
cache: yarn
106+
- uses: actions/download-artifact@v4
107+
- run: mv ./builds-for-playwright/build ./build
108+
- run: mv ./builds-for-playwright/build-ext ./build-ext
76109
- name: Install playwright's npm dependencies
77110
working-directory: ./playwright/
78111
run: yarn install --frozen-lockfile
79-
- name: Install playwright's system dependencies
80-
working-directory: ./playwright/
81-
run: npx playwright install --with-deps
112+
# outside sharding: yarn + build:ext + build + upload
113+
# and then 8x shard: download builds + serve + test
114+
- run: REACT_APP_E2E_TEST=1 node ./playwright/serve-prod.js &
82115
- run: npx wait-on http://localhost:5000/ --timeout 60000
83116
- name: Run playwright tests (with xvfb-run to support headed extension test)
84117
working-directory: ./playwright/
85-
run: xvfb-run yarn test:prod
118+
run: xvfb-run yarn test:prod --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
86119
- name: 'Upload playwright test-results'
87120
if: ${{ failure() }}
88121
uses: actions/upload-artifact@v4
89122
with:
90-
name: playwright-test-results
123+
name: playwright-test-results-${{ matrix.shardIndex }}
91124
path: playwright/test-results
92125
retention-days: 5
126+
# TODO: maybe https://playwright.dev/docs/test-sharding#merging-reports-from-multiple-shards
93127

94128
upload-coverage:
95129
# NOTE: This name appears in GitHub's Checks API.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"start": "REACT_APP_META_CSP= HMR_PORT=2222 EXTENSION_CSP=`yarn -s print-extension-dev-csp` parcel --host localhost --port 3000 --dist-dir build-dev",
1616
"test": "jest --color",
1717
"test:watch": "yarn run test --watch",
18-
"start:prod": "yarn run build && node ./internals/scripts/serve-prod.js",
18+
"start:prod": "yarn run build && node ./playwright/serve-prod.js",
1919
"checkTs": "tsc --noEmit",
2020
"lint": "eslint --ext js,ts,tsx ./",
2121
"lint:fix": "yarn run lint --fix",
@@ -134,7 +134,6 @@
134134
"react-test-renderer": "18.3.1",
135135
"redux-saga-test-plan": "4.0.6",
136136
"sanitize.css": "13.0.0",
137-
"serve-handler": "6.1.5",
138137
"stream-browserify": "3.0.0",
139138
"string_decoder": "1.3.0",
140139
"ts-jest": "29.1.1",

playwright/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"test:screenshots": "playwright test --project screenshots"
99
},
1010
"devDependencies": {
11-
"@playwright/test": "1.46.1"
11+
"@playwright/test": "1.46.1",
12+
"serve-handler": "6.1.6"
1213
}
1314
}

internals/scripts/serve-prod.js renamed to playwright/serve-prod.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
const path = require('path')
33
const http = require('http')
44
const serveHandler = require('serve-handler')
5-
const { getCsp, getPermissionsPolicy } = require('../getSecurityHeaders.js')
5+
const { getCsp, getPermissionsPolicy } = require('../internals/getSecurityHeaders.js')
66
const csp = getCsp({ isDev: false, isExtension: false })
77
const permissionsPolicy = getPermissionsPolicy()
88
console.log(`Content-Security-Policy: ${csp}\n`)
99
console.log(`Permissions-Policy: ${permissionsPolicy}\n`)
1010

11-
const root = path.resolve(__dirname, '../..')
11+
const root = path.resolve(__dirname, '..')
1212

1313
const server = http.createServer((request, response) => {
1414
return serveHandler(request, response, {

playwright/yarn.lock

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,68 @@
99
dependencies:
1010
playwright "1.46.1"
1111

12+
balanced-match@^1.0.0:
13+
version "1.0.2"
14+
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
15+
integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==
16+
17+
brace-expansion@^1.1.7:
18+
version "1.1.11"
19+
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
20+
integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==
21+
dependencies:
22+
balanced-match "^1.0.0"
23+
concat-map "0.0.1"
24+
25+
26+
version "3.0.0"
27+
resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048"
28+
integrity sha512-pMhOfFDPiv9t5jjIXkHosWmkSyQbvsgEVNkz0ERHbuLh2T/7j4Mqqpz523Fe8MVY89KC6Sh/QfS2sM+SjgFDcw==
29+
30+
31+
version "0.0.1"
32+
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
33+
integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==
34+
35+
36+
version "0.5.2"
37+
resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.2.tgz#0cf68bb9ddf5f2be7961c3a85178cb85dba78cb4"
38+
integrity sha512-kRGRZw3bLlFISDBgwTSA1TMBFN6J6GWDeubmDE3AF+3+yXL8hTWv8r5rkLbqYXY4RjPk/EzHnClI3zQf1cFmHA==
39+
1240
1341
version "2.3.2"
1442
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a"
1543
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==
1644

45+
mime-db@~1.33.0:
46+
version "1.33.0"
47+
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.33.0.tgz#a3492050a5cb9b63450541e39d9788d2272783db"
48+
integrity sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==
49+
50+
51+
version "2.1.18"
52+
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.18.tgz#6f323f60a83d11146f831ff11fd66e2fe5503bb8"
53+
integrity sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==
54+
dependencies:
55+
mime-db "~1.33.0"
56+
57+
58+
version "3.1.2"
59+
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b"
60+
integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==
61+
dependencies:
62+
brace-expansion "^1.1.7"
63+
64+
65+
version "1.0.2"
66+
resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53"
67+
integrity sha512-DUWJr3+ULp4zXmol/SZkFf3JGsS9/SIv+Y3Rt93/UjPpDpklB5f1er4O3POIbUuUJ3FXgqte2Q7SrU6zAqwk8w==
68+
69+
70+
version "3.3.0"
71+
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-3.3.0.tgz#f7f31d32e8518c2660862b644414b6d5c63a611b"
72+
integrity sha512-qyCH421YQPS2WFDxDjftfc1ZR5WKQzVzqsp4n9M2kQhVOo/ByahFoUNJfl58kOcEGfQ//7weFTDhm+ss8Ecxgw==
73+
1774
1875
version "1.46.1"
1976
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.46.1.tgz#28f3ab35312135dda75b0c92a3e5c0e7edb9cc8b"
@@ -27,3 +84,21 @@ [email protected]:
2784
playwright-core "1.46.1"
2885
optionalDependencies:
2986
fsevents "2.3.2"
87+
88+
89+
version "1.2.0"
90+
resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.0.tgz#f49be6b487894ddc40dcc94a322f611092e00d5e"
91+
integrity sha512-kA5WQoNVo4t9lNx2kQNFCxKeBl5IbbSNBl1M/tLkw9WCn+hxNBAW5Qh8gdhs63CJnhjJ2zQWFoqPJP2sK1AV5A==
92+
93+
94+
version "6.1.6"
95+
resolved "https://registry.yarnpkg.com/serve-handler/-/serve-handler-6.1.6.tgz#50803c1d3e947cd4a341d617f8209b22bd76cfa1"
96+
integrity sha512-x5RL9Y2p5+Sh3D38Fh9i/iQ5ZK+e4xuXRd/pGbM4D13tgo/MGwbttUk8emytcr1YYzBYs+apnUngBDFYfpjPuQ==
97+
dependencies:
98+
bytes "3.0.0"
99+
content-disposition "0.5.2"
100+
mime-types "2.1.18"
101+
minimatch "3.1.2"
102+
path-is-inside "1.0.2"
103+
path-to-regexp "3.3.0"
104+
range-parser "1.2.0"

src/app/components/FatalErrorHandler/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { useSelector } from 'react-redux'
2323
import { normalizeColor } from 'grommet/es6/utils'
2424
import { ResponsiveLayer } from '../ResponsiveLayer'
2525
import logotype from '../../../../public/Icon Blue 192.png'
26-
import { runtimeIs } from 'config'
26+
import { runtimeIs } from 'app/lib/runtimeIs'
2727
import { BrandButton } from '../Button'
2828

2929
const StyledTextArea = styled(TextArea)`

src/app/components/Ionic/components/IonicNativePlatformProvider/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { FC, PropsWithChildren } from 'react'
2-
import { runtimeIs } from '../../../../../config'
2+
import { runtimeIs } from 'app/lib/runtimeIs'
33
import { IonicContextProvider } from '../../providers/IonicProvider'
44
import { UpdateGate } from '../UpdateGate'
55

src/app/components/Persist/ChoosePasswordFields.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { useState } from 'react'
99
import { useTranslation } from 'react-i18next'
1010
import { useSelector } from 'react-redux'
1111
import { ChoosePasswordInputFields } from './ChoosePasswordInputFields'
12-
import { runtimeIs } from 'config'
12+
import { runtimeIs } from 'app/lib/runtimeIs'
1313

1414
export function ChoosePasswordFields() {
1515
const { t } = useTranslation()

src/app/lib/ledger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { hex2uint, publicKeyToAddress } from './helpers'
77
import type Transport from '@ledgerhq/hw-transport'
88
import { isSupported, requestLedgerDevice } from '@ledgerhq/hw-transport-webusb/lib-es/webusb'
99
import BleTransport from '@oasisprotocol/ionic-ledger-hw-transport-ble/lib'
10-
import { runtimeIs } from '../../config'
10+
import { runtimeIs } from 'app/lib/runtimeIs'
1111

1212
interface LedgerAccount {
1313
publicKey: Uint8Array

0 commit comments

Comments
 (0)