Skip to content

Commit 4785dc9

Browse files
committed
Merge remote-tracking branch 'upstream/master' into perf/optimize-blocklist-iteration
2 parents 2b12498 + 0624d3d commit 4785dc9

File tree

154 files changed

+21617
-9569
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

154 files changed

+21617
-9569
lines changed

.eslintignore

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

.eslintrc.json

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

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@
66
*.md text eol=lf
77
*.yml text eol=lf
88
*.yaml text eol=lf
9+
# Mark locale files as generated - hides them from PR diffs by default
10+
# These files are auto-generated from PO files via convert_po_to_json.py
11+
locales/*.json linguist-generated=true
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
name: Lighthouse CI
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, synchronize, reopened]
6+
push:
7+
branches: [master]
8+
9+
jobs:
10+
lighthouse:
11+
name: Lighthouse Performance Audit
12+
runs-on: ubuntu-latest
13+
permissions:
14+
pull-requests: write
15+
contents: read
16+
issues: write
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
24+
25+
- name: Setup Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: '20'
29+
cache: 'npm'
30+
31+
- name: Install dependencies
32+
run: npm ci
33+
34+
- name: Install Lighthouse CI
35+
run: npm install -g @lhci/cli@0.14.x
36+
37+
- name: Run Lighthouse CI
38+
id: lighthouse
39+
run: |
40+
lhci autorun --config=./lighthouserc.js 2>&1 | tee lighthouse-output.txt
41+
echo "LIGHTHOUSE_EXIT_CODE=$?" >> $GITHUB_ENV
42+
43+
- name: Parse Lighthouse Results
44+
id: parse
45+
run: |
46+
# Extract scores from the lighthouse output
47+
# Create a results summary
48+
mkdir -p lighthouse-results
49+
50+
# Find the latest report
51+
REPORT_DIR=".lighthouseci"
52+
if [ -d "$REPORT_DIR" ]; then
53+
# Get the manifest file
54+
MANIFEST="$REPORT_DIR/manifest.json"
55+
if [ -f "$MANIFEST" ]; then
56+
# Extract average scores from manifest
57+
PERF_SCORE=$(jq '[.[].summary.performance] | add / length * 100 | floor' "$MANIFEST" 2>/dev/null || echo "N/A")
58+
A11Y_SCORE=$(jq '[.[].summary.accessibility] | add / length * 100 | floor' "$MANIFEST" 2>/dev/null || echo "N/A")
59+
BP_SCORE=$(jq '[.[].summary["best-practices"]] | add / length * 100 | floor' "$MANIFEST" 2>/dev/null || echo "N/A")
60+
SEO_SCORE=$(jq '[.[].summary.seo] | add / length * 100 | floor' "$MANIFEST" 2>/dev/null || echo "N/A")
61+
62+
# Get report URL from temporary-public-storage
63+
REPORT_URL=$(jq -r '.[0].url // "N/A"' "$MANIFEST" 2>/dev/null)
64+
65+
echo "PERF_SCORE=$PERF_SCORE" >> $GITHUB_OUTPUT
66+
echo "A11Y_SCORE=$A11Y_SCORE" >> $GITHUB_OUTPUT
67+
echo "BP_SCORE=$BP_SCORE" >> $GITHUB_OUTPUT
68+
echo "SEO_SCORE=$SEO_SCORE" >> $GITHUB_OUTPUT
69+
echo "REPORT_URL=$REPORT_URL" >> $GITHUB_OUTPUT
70+
fi
71+
fi
72+
73+
- name: Get Score Emoji
74+
id: emoji
75+
run: |
76+
get_emoji() {
77+
score=$1
78+
if [ "$score" = "N/A" ]; then
79+
echo "⚪"
80+
elif [ "$score" -ge 90 ]; then
81+
echo "🟢"
82+
elif [ "$score" -ge 50 ]; then
83+
echo "🟠"
84+
else
85+
echo "🔴"
86+
fi
87+
}
88+
89+
echo "PERF_EMOJI=$(get_emoji '${{ steps.parse.outputs.PERF_SCORE }}')" >> $GITHUB_OUTPUT
90+
echo "A11Y_EMOJI=$(get_emoji '${{ steps.parse.outputs.A11Y_SCORE }}')" >> $GITHUB_OUTPUT
91+
echo "BP_EMOJI=$(get_emoji '${{ steps.parse.outputs.BP_SCORE }}')" >> $GITHUB_OUTPUT
92+
echo "SEO_EMOJI=$(get_emoji '${{ steps.parse.outputs.SEO_SCORE }}')" >> $GITHUB_OUTPUT
93+
94+
- name: Comment on PR
95+
if: github.event_name == 'pull_request'
96+
uses: thollander/actions-comment-pull-request@v3
97+
with:
98+
message: |
99+
## 🔦 Lighthouse Performance Report
100+
101+
| Category | Score | Status |
102+
|----------|-------|--------|
103+
| ⚡ Performance | **${{ steps.parse.outputs.PERF_SCORE }}** | ${{ steps.emoji.outputs.PERF_EMOJI }} |
104+
| ♿ Accessibility | **${{ steps.parse.outputs.A11Y_SCORE }}** | ${{ steps.emoji.outputs.A11Y_EMOJI }} |
105+
| ✅ Best Practices | **${{ steps.parse.outputs.BP_SCORE }}** | ${{ steps.emoji.outputs.BP_EMOJI }} |
106+
| 🔍 SEO | **${{ steps.parse.outputs.SEO_SCORE }}** | ${{ steps.emoji.outputs.SEO_EMOJI }} |
107+
108+
### Score Legend
109+
- 🟢 90-100: Excellent
110+
- 🟠 50-89: Needs Improvement
111+
- 🔴 0-49: Poor
112+
113+
> 📊 [View Full Lighthouse Report](${{ steps.parse.outputs.REPORT_URL }})
114+
115+
---
116+
*This performance audit helps ensure PRs don't negatively impact user experience.*
117+
comment-tag: lighthouse-report
118+
mode: recreate
119+
pr-number: ${{ github.event.pull_request.number }}
120+
121+
- name: Upload Lighthouse Reports
122+
uses: actions/upload-artifact@v4
123+
if: always()
124+
with:
125+
name: lighthouse-reports
126+
path: .lighthouseci/
127+
retention-days: 30

.github/workflows/linter.yml

Lines changed: 43 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,48 @@
11
name: ESLint
22

33
on:
4-
pull_request:
5-
branches: [master]
4+
pull_request:
5+
branches: [master]
66

77
jobs:
8-
lint:
9-
name: Lint updated JavaScript files with ESLint
10-
11-
runs-on: ubuntu-latest
12-
13-
steps:
14-
- name: Checkout code
15-
uses: actions/checkout@v4
16-
with:
17-
fetch-depth: 0
18-
ref: ${{ github.event.pull_request.head.sha }}
19-
20-
- name: Set up Node.js
21-
uses: actions/setup-node@v4
22-
with:
23-
node-version: 20.x
24-
25-
- name: Get changed JavaScript files
26-
id: get_files
27-
run: |
28-
CHANGED_FILES=$(git diff --diff-filter=ACMRT --name-only ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} -- '*.js')
29-
echo "files<<EOF" >> $GITHUB_ENV
30-
echo "$CHANGED_FILES" >> $GITHUB_ENV
31-
echo "EOF" >> $GITHUB_ENV
32-
33-
- name: Install dependencies
34-
run: npm ci
35-
36-
- name: Run ESLint on changed files
37-
if: env.files != ''
38-
run: |
39-
echo "Linting the following files:"
40-
echo "$files"
41-
echo "$files" | xargs npx eslint
42-
- name: Run Prettier check on changed files
43-
if: env.files != ''
44-
run: |
45-
echo "Checking formatting for the following files:"
46-
echo "$files"
47-
echo "$files" | xargs npx prettier --check
8+
lint:
9+
name: Lint updated JavaScript files with ESLint
10+
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
ref: ${{ github.event.pull_request.head.sha }}
19+
20+
- name: Set up Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: 20.x
24+
cache: "npm"
25+
26+
- name: Get changed JavaScript files
27+
id: get_files
28+
run: |
29+
CHANGED_FILES=$(git diff --diff-filter=ACMRT --name-only ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} -- '*.js')
30+
echo "files<<EOF" >> $GITHUB_ENV
31+
echo "$CHANGED_FILES" >> $GITHUB_ENV
32+
echo "EOF" >> $GITHUB_ENV
33+
34+
- name: Install dependencies
35+
run: npm ci
36+
37+
- name: Run ESLint on changed files
38+
if: env.files != ''
39+
run: |
40+
echo "Linting the following files:"
41+
echo "$files"
42+
echo "$files" | xargs npx eslint
43+
- name: Run Prettier check on changed files
44+
if: env.files != ''
45+
run: |
46+
echo "Checking formatting for the following files:"
47+
echo "$files"
48+
echo "$files" | xargs npx prettier --check

.github/workflows/node.js.yml

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,38 @@
44
name: Smoke Test
55

66
on:
7-
push:
8-
branches: [master]
9-
pull_request:
10-
branches: [master]
7+
push:
8+
branches: [master]
9+
pull_request:
10+
branches: [master]
1111

1212
jobs:
13-
build:
14-
runs-on: ubuntu-latest
15-
16-
strategy:
17-
matrix:
18-
node-version: [18.x, 20.x]
19-
20-
steps:
21-
- name: Checkout code
22-
uses: actions/checkout@v4
23-
with:
24-
fetch-depth: 0
25-
26-
- name: Use Node.js ${{ matrix.node-version }}
27-
uses: actions/setup-node@v4
28-
with:
29-
node-version: ${{ matrix.node-version }}
30-
31-
- run: npm ci
32-
- run: npm run build --if-present
33-
34-
# Post-run cleanup to remove the build directory after the job finishes
35-
- name: Post-run cleanup
36-
if: always()
37-
run: rm -rf ./build
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
strategy:
17+
matrix:
18+
node-version: [20.x, 22.x]
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Use Node.js ${{ matrix.node-version }}
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: ${{ matrix.node-version }}
30+
cache: "npm"
31+
32+
- name: Install dependencies
33+
run: npm ci
34+
35+
- name: Build project
36+
run: npm run build --if-present
37+
38+
# Post-run cleanup to remove the build directory after the job finishes
39+
- name: Post-run cleanup
40+
if: always()
41+
run: rm -rf ./build

.github/workflows/po-to-json-autocommit.yml renamed to .github/workflows/po-to-json-validation.yml

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
name: Auto-convert PO to JSON and commit
1+
name: Convert PO to JSON and verify changes
22

33
on:
44
push:
55
paths:
66
- 'po/**/*.po'
77

88
jobs:
9-
convert-and-commit:
9+
convert-and-verify:
1010
runs-on: ubuntu-latest
1111

1212
steps:
@@ -30,7 +30,7 @@ jobs:
3030
echo "$(cat changed_po_files.txt)" >> $GITHUB_OUTPUT
3131
echo "EOF" >> $GITHUB_OUTPUT
3232
33-
- name: Run conversion script
33+
- name: Convert PO files to JSON
3434
if: steps.find_po.outputs.po_files != ''
3535
run: |
3636
mkdir -p locales
@@ -39,18 +39,13 @@ jobs:
3939
python3 convert_po_to_json.py "$po_file" "locales"
4040
done < changed_po_files.txt
4141
42-
- name: Commit and push updated JSON
42+
- name: Verify JSON conversion changes
4343
if: steps.find_po.outputs.po_files != ''
4444
run: |
45-
git config --global user.name "github-actions[bot]"
46-
git config --global user.email "github-actions[bot]@users.noreply.github.com"
47-
48-
git add locales/*.json
49-
50-
if git diff --cached --quiet; then
51-
echo "✅ No JSON changes to commit."
45+
if ! git diff --quiet locales/; then
46+
echo "❌ Generated translation JSON files have changes that need to be committed."
47+
echo "Please run the PO-to-JSON conversion locally and commit the generated files in locales/."
48+
exit 1
5249
else
53-
git commit -m "chore(i18n): auto-update JSON files from updated PO files"
54-
git push origin ${{ github.ref }}
55-
echo "🚀 Pushed updated JSON files."
50+
echo "✅ Translation JSON files are verified and up to date."
5651
fi

.github/workflows/security_scan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Setup Node.js
1919
uses: actions/setup-node@v4
2020
with:
21-
node-version: '18'
21+
node-version: '20'
2222

2323
- name: Install Dependencies
2424
run: npm install

0 commit comments

Comments
 (0)