@@ -23,37 +23,37 @@ jobs:
2323 test :
2424 name : Run JavaScript Tests
2525 runs-on : ubuntu-latest
26-
26+
2727 strategy :
2828 matrix :
2929 node-version : [18, 20]
30-
30+
3131 steps :
3232 - name : 📂 Checkout repository
3333 uses : actions/checkout@v5
34-
34+
3535 - name : 🟢 Setup Node.js ${{ matrix.node-version }}
3636 uses : actions/setup-node@v4
3737 with :
3838 node-version : ${{ matrix.node-version }}
3939 cache : ' npm'
40-
40+
4141 - name : 📦 Install dependencies
4242 run : |
4343 npm ci
4444 # Also install optional reporter if needed
4545 npm install jest-html-reporter --save-dev || true
46-
46+
4747 - name : 🧪 Run unit tests
4848 run : npm test -- --coverage --ci --maxWorkers=2
4949 env :
5050 CI : true
51-
51+
5252 - name : 📊 Generate coverage report
5353 if : matrix.node-version == '20' # Only run coverage on one version
5454 run : |
5555 npm run test:coverage || true
56-
56+
5757 - name : 📤 Upload coverage to Codecov
5858 if : matrix.node-version == '20'
5959 uses : codecov/codecov-action@v5
6262 flags : frontend
6363 name : frontend-coverage
6464 fail_ci_if_error : false
65-
65+
6666 - name : 📋 Upload test results
6767 if : always()
6868 uses : actions/upload-artifact@v4
@@ -72,27 +72,27 @@ jobs:
7272 coverage/
7373 test-report.html
7474 retention-days : 7
75-
75+
7676 - name : 💬 Comment PR with results
7777 if : github.event_name == 'pull_request' && matrix.node-version == '20'
7878 uses : actions/github-script@v7
7979 with :
8080 script : |
8181 const fs = require('fs');
8282 let coverageText = '📊 **Frontend Test Coverage Report**\n\n';
83-
83+
8484 try {
8585 // Try to read coverage summary if it exists
8686 const coveragePath = './coverage/coverage-summary.json';
8787 if (fs.existsSync(coveragePath)) {
8888 const coverage = JSON.parse(fs.readFileSync(coveragePath, 'utf8'));
8989 const total = coverage.total;
90-
90+
9191 coverageText += '| Metric | Coverage | Status |\n';
9292 coverageText += '|--------|----------|--------|\n';
93-
93+
9494 const getStatus = (pct) => pct >= 80 ? '✅' : pct >= 70 ? '⚠️' : '❌';
95-
95+
9696 coverageText += `| Lines | ${total.lines.pct}% | ${getStatus(total.lines.pct)} |\n`;
9797 coverageText += `| Statements | ${total.statements.pct}% | ${getStatus(total.statements.pct)} |\n`;
9898 coverageText += `| Functions | ${total.functions.pct}% | ${getStatus(total.functions.pct)} |\n`;
@@ -103,19 +103,19 @@ jobs:
103103 } catch (error) {
104104 coverageText += `⚠️ Could not parse coverage report: ${error.message}\n`;
105105 }
106-
106+
107107 // Find and update or create comment
108108 const { data: comments } = await github.rest.issues.listComments({
109109 owner: context.repo.owner,
110110 repo: context.repo.repo,
111111 issue_number: context.issue.number,
112112 });
113-
114- const botComment = comments.find(comment =>
115- comment.user.type === 'Bot' &&
113+
114+ const botComment = comments.find(comment =>
115+ comment.user.type === 'Bot' &&
116116 comment.body.includes('Frontend Test Coverage Report')
117117 );
118-
118+
119119 if (botComment) {
120120 await github.rest.issues.updateComment({
121121 owner: context.repo.owner,
@@ -135,22 +135,22 @@ jobs:
135135 lint-js :
136136 name : Lint JavaScript
137137 runs-on : ubuntu-latest
138-
138+
139139 steps :
140140 - name : 📂 Checkout repository
141141 uses : actions/checkout@v5
142-
142+
143143 - name : 🟢 Setup Node.js
144144 uses : actions/setup-node@v4
145145 with :
146146 node-version : ' 20'
147147 cache : ' npm'
148-
148+
149149 - name : 📦 Install ESLint
150150 run : |
151151 npm install --save-dev eslint
152152 npm install --save-dev eslint-plugin-jest || true
153-
153+
154154 - name : 🔍 Run ESLint
155155 run : |
156156 npx eslint static/js/*.js --ignore-pattern "*.min.js" || true
@@ -160,42 +160,42 @@ jobs:
160160 name : Integration Tests
161161 runs-on : ubuntu-latest
162162 needs : test
163-
163+
164164 steps :
165165 - name : 📂 Checkout repository
166166 uses : actions/checkout@v5
167-
167+
168168 - name : 🟢 Setup Node.js
169169 uses : actions/setup-node@v4
170170 with :
171171 node-version : ' 20'
172172 cache : ' npm'
173-
173+
174174 - name : 💎 Setup Ruby
175175 uses : ruby/setup-ruby@v1
176176 with :
177177 ruby-version : ' 3.3'
178178 bundler-cache : true
179-
179+
180180 - name : 📦 Install dependencies
181181 run : |
182182 npm ci
183183 bundle install
184-
184+
185185 - name : 🏗️ Build Jekyll site
186186 run : |
187187 bundle exec jekyll build
188188 env :
189189 JEKYLL_ENV : test
190-
190+
191191 - name : 🧪 Run integration tests
192192 run : |
193193 npm run test:integration || echo "No integration tests yet"
194194 continue-on-error : true
195-
195+
196196 - name : 📤 Upload built site
197197 uses : actions/upload-artifact@v4
198198 with :
199199 name : built-site
200200 path : _site/
201- retention-days : 1
201+ retention-days : 1
0 commit comments