Skip to content

Commit 8285379

Browse files
init repo
0 parents  commit 8285379

14 files changed

+1197
-0
lines changed

.github/workflows/lighthouse.yml

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Lighthouse CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
inputs:
9+
url:
10+
description: 'URL to run Lighthouse on'
11+
required: false
12+
default: 'http://localhost:8080'
13+
14+
jobs:
15+
lhci:
16+
name: Lighthouse
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Use Node.js 20
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: 20
24+
- name: Install dependencies
25+
run: |
26+
npm install -g @lhci/[email protected]
27+
npm install -g http-server
28+
- name: Start local server
29+
run: http-server . -p 8080 &
30+
- name: Run Lighthouse CI
31+
run: |
32+
URL="${{ github.event.inputs.url || 'http://localhost:8080' }}"
33+
lhci autorun --collect.url=$URL
34+
- name: Format and Log Lighthouse score
35+
run: |
36+
echo "Lighthouse 성능 측정 결과"
37+
if [ -f .lighthouseci/links.json ]; then
38+
LATEST_JSON=$(ls -t .lighthouseci/lhr-*.json | head -n1)
39+
if [ -n "$LATEST_JSON" ]; then
40+
jq -r '.categories | to_entries[] | "\(.key): \(.value.score * 100 | floor)"' "$LATEST_JSON" | while read line; do
41+
key=$(echo "$line" | cut -d':' -f1)
42+
score=$(echo "$line" | cut -d':' -f2)
43+
if (( $(echo "$score >= 90" | bc -l) )); then
44+
emoji="🟢"
45+
elif (( $(echo "$score >= 50" | bc -l) )); then
46+
emoji="🟠"
47+
else
48+
emoji="🔴"
49+
fi
50+
echo "$key: $emoji $score"
51+
done
52+
53+
# Try to extract report URL from links.json
54+
REPORT_URL=$(jq -r '.html' .lighthouseci/links.json)
55+
56+
# If the above fails, try to construct the URL from the JSON filename
57+
if [ "$REPORT_URL" = "null" ] || [ -z "$REPORT_URL" ]; then
58+
JSON_FILENAME=$(basename $LATEST_JSON)
59+
HTML_FILENAME="${JSON_FILENAME%.json}.html"
60+
REPORT_URL="https://storage.googleapis.com/lighthouse-infrastructure.appspot.com/reports/$HTML_FILENAME"
61+
fi
62+
63+
echo "Lighthouse 보고서 전체 보기: $REPORT_URL"
64+
else
65+
echo "No JSON report file found in .lighthouseci directory"
66+
fi
67+
else
68+
echo "links.json not found. Unable to process Lighthouse results."
69+
fi

.gitignore

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
firebase-debug.log*
8+
firebase-debug.*.log*
9+
10+
# Firebase cache
11+
.firebase/
12+
13+
# Firebase config
14+
15+
# Uncomment this if you'd like others to create their own Firebase project.
16+
# For a team working on the same Firebase project(s), it is recommended to leave
17+
# it commented so all members can deploy to the same project(s) in .firebaserc.
18+
# .firebaserc
19+
20+
# Runtime data
21+
pids
22+
*.pid
23+
*.seed
24+
*.pid.lock
25+
26+
# Directory for instrumented libs generated by jscoverage/JSCover
27+
lib-cov
28+
29+
# Coverage directory used by tools like istanbul
30+
coverage
31+
32+
# nyc test coverage
33+
.nyc_output
34+
35+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
36+
.grunt
37+
38+
# Bower dependency directory (https://bower.io/)
39+
bower_components
40+
41+
# node-waf configuration
42+
.lock-wscript
43+
44+
# Compiled binary addons (http://nodejs.org/api/addons.html)
45+
build/Release
46+
47+
# Dependency directories
48+
node_modules/
49+
50+
# Optional npm cache directory
51+
.npm
52+
53+
# Optional eslint cache
54+
.eslintcache
55+
56+
# Optional REPL history
57+
.node_repl_history
58+
59+
# Output of 'npm pack'
60+
*.tgz
61+
62+
# Yarn Integrity file
63+
.yarn-integrity
64+
65+
# dotenv environment variables file
66+
.env
67+
68+
# dataconnect generated files
69+
.dataconnect
70+
71+
72+
# DS_Store files
73+
.DS_Store

0 commit comments

Comments
 (0)