-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add e2e checks github actions workflow with prettier #875
base: main
Are you sure you want to change the base?
Changes from all commits
dc12500
322d594
c46d0b9
a015322
d71e97f
6dabf01
7d6ac45
a400cd0
334f1c1
71fb9c5
5383fa8
50d8571
915cb31
db5d0b9
8903de1
87643fc
3bbc778
8ae2d13
a8fe9e8
c2c13dd
ff13ffc
a7479b2
64a1ed7
38449ed
4a17dd9
4ea9cf7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: E2E Code Quality Checks | ||
run-name: E2E Code Quality Checks | ||
|
||
on: | ||
pull_request: | ||
branches: [ main ] | ||
paths: | ||
- 'e2e/**' | ||
push: | ||
branches: [ main ] | ||
paths: | ||
- 'e2e/**' | ||
|
||
jobs: | ||
quality: | ||
name: E2E Code Quality | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
|
||
- name: Cache Node.js dependencies | ||
id: cache-node | ||
uses: actions/cache@v4 | ||
with: | ||
path: e2e/node_modules | ||
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} | ||
|
||
- name: Install dependencies | ||
if: steps.cache-node.outputs.cache-hit != 'true' | ||
run: make e2e-install-ci | ||
|
||
- name: Check formatting | ||
run: make e2e-format-check-native | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,11 @@ __check_defined = \ | |
e2e-clean \ | ||
e2e-clean-image \ | ||
e2e-clean-report \ | ||
e2e-format \ | ||
e2e-format-check \ | ||
e2e-format-check-native \ | ||
e2e-format-native \ | ||
e2e-install-ci-native \ | ||
e2e-merge-reports \ | ||
e2e-setup-ci \ | ||
e2e-setup-native \ | ||
|
@@ -95,6 +100,21 @@ e2e-clean-report: ## Remove the local e2e report folders and content | |
rm -rf ./e2e/blob-report | ||
rm -rf ./e2e/test-results | ||
|
||
e2e-format: e2e-build ## Format code with autofix inside Docker | ||
docker run --rm -v e2e:/e2e $(E2E_IMAGE_NAME) npm run e2e-format | ||
|
||
e2e-format-check: ## Format check without autofix inside Docker | ||
docker run --rm -v $(PWD)/e2e:/e2e $(E2E_NODE_IMAGE) sh -c "cd /e2e && npm run e2e-format:check" | ||
|
||
e2e-format-check-native: ## Format check without autofix natively | ||
cd e2e && npm run e2e-format:check | ||
|
||
e2e-format-native: ## Format code with autofix natively | ||
cd e2e && npm run e2e-format | ||
|
||
e2e-install-ci: ## CI install dependencies | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. confusing that we have both e2e-install-ci and e2e-setup-ci can we combine them There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This issue is somewhat related to the comment above - I wanted a separate non-playwright install command for checks so i added
But this would be unnecessarily installing playwright for code quality checks - and unnecessarily running an extra |
||
cd e2e && npm ci | ||
|
||
e2e-merge-reports: ## Merge E2E blob reports from multiple shards into an HTML report | ||
cd e2e && npm run e2e-merge-reports | ||
|
||
|
@@ -119,10 +139,10 @@ e2e-test: e2e-build | |
-e CURRENT_SHARD=$(CURRENT_SHARD) \ | ||
-e TOTAL_SHARDS=$(TOTAL_SHARDS) \ | ||
-e CI=$(CI) \ | ||
-v $(PWD)/e2e/playwright-report:/e2e/playwright-report \ | ||
-v $(PWD)/e2e/blob-report:/e2e/blob-report \ | ||
-v e2e/playwright-report:/e2e/playwright-report \ | ||
-v e2e/blob-report:/e2e/blob-report \ | ||
$(E2E_IMAGE_NAME) \ | ||
$(E2E_ARGS) | ||
npm run e2e-test -- $(E2E_ARGS) | ||
@echo "Run 'make e2e-show-report' to view the test report" | ||
|
||
e2e-test-native: ## Run end-to-end tests natively | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ node_modules/ | |
/blob-report/ | ||
/playwright/.cache/ | ||
*.png* | ||
.prettier-cache |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*-lock.json |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"overrides": [ | ||
{ | ||
"files": [ | ||
"*.js", | ||
"*.jsx", | ||
"*.ts", | ||
"*.tsx", | ||
"*.json", | ||
"*.md", | ||
"*.mdx", | ||
"*.scss", | ||
"*.yaml", | ||
"*.yml" | ||
], | ||
"options": { | ||
"semi": true, | ||
"singleQuote": true, | ||
"tabWidth": 2, | ||
"trailingComma": "es5", | ||
"printWidth": 100 | ||
} | ||
} | ||
] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,23 @@ | ||
{ | ||
"name": "e2e", | ||
"version": "1.0.0", | ||
"scripts": { | ||
"e2e-merge-reports": "npx playwright merge-reports --reporter html blob-report", | ||
"e2e-setup": "npx playwright install --with-deps", | ||
"e2e-show-report": "npx playwright show-report", | ||
"e2e-test": "./run-e2e-test", | ||
"e2e-test:ui": "./run-e2e-test --ui" | ||
}, | ||
"devDependencies": { | ||
"@playwright/test": "^1.49.0", | ||
"@types/node": "^22.10.1" | ||
}, | ||
"dependencies": { | ||
"@axe-core/playwright": "^4.10.1", | ||
"dotenv": "^16.4.7", | ||
"playwright": "^1.49.0" | ||
} | ||
"name": "e2e", | ||
"version": "1.0.0", | ||
"scripts": { | ||
"e2e-format": "prettier --cache --cache-location='./.prettier-cache' --write .", | ||
"e2e-format:check": "prettier --cache --cache-location='./.prettier-cache' --check .", | ||
"e2e-merge-reports": "npx playwright merge-reports --reporter html blob-report", | ||
"e2e-setup": "npx playwright install --with-deps", | ||
"e2e-show-report": "npx playwright show-report", | ||
"e2e-test": "./run-e2e-test", | ||
"e2e-test:ui": "./run-e2e-test --ui" | ||
}, | ||
"devDependencies": { | ||
"@playwright/test": "^1.49.0", | ||
"@types/node": "^22.10.1", | ||
"prettier": "^3.5.1" | ||
}, | ||
"dependencies": { | ||
"@axe-core/playwright": "^4.10.1", | ||
"dotenv": "^16.4.7", | ||
"playwright": "^1.49.0" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
// Merge a base and derived config | ||
export function deepMerge(obj1, obj2) { | ||
const result = { ...obj1 }; | ||
const result = { ...obj1 }; | ||
|
||
for (let key in obj2) { | ||
if (obj2.hasOwnProperty(key)) { | ||
if (obj2[key] instanceof Object && obj1[key] instanceof Object) { | ||
result[key] = deepMerge(obj1[key], obj2[key]); | ||
} else { | ||
result[key] = obj2[key]; | ||
} | ||
for (let key in obj2) { | ||
if (obj2.hasOwnProperty(key)) { | ||
if (obj2[key] instanceof Object && obj1[key] instanceof Object) { | ||
result[key] = deepMerge(obj1[key], obj2[key]); | ||
} else { | ||
result[key] = obj2[key]; | ||
} | ||
} | ||
|
||
return result; | ||
} | ||
|
||
return result; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we got to discussing the where or how this should run - we can go back to the google docs if necessary. I recently started a section about it there