Skip to content

Commit 383f90e

Browse files
committed
add lighthouse CI checks for core features
Signed-off-by: Emma Indal <emma.indahl@gmail.com>
1 parent cb807e0 commit 383f90e

4 files changed

Lines changed: 104 additions & 0 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Verify Accessibility Core features
2+
on:
3+
pull_request:
4+
branches: [master]
5+
paths:
6+
- 'plugins/catalog/**'
7+
- 'plugins/techdocs/**'
8+
- 'plugins/scaffolder/**'
9+
- 'plugins/search/**'
10+
11+
jobs:
12+
lhci:
13+
name: Lighthouse
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
- name: Use Node.js 16.x
18+
uses: actions/setup-node@v3
19+
with:
20+
node-version: 16.x
21+
- name: install dependencies
22+
run: |
23+
yarn install
24+
- name: run Lighthouse CI
25+
run: |
26+
npm install -g @lhci/cli@0.11.x
27+
lhci autorun
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,7 @@ tsconfig.tmp.json
152152

153153
# vscode database functionality support files
154154
*.session.sql
155+
156+
# Lighthouse CI Reports
157+
**/.lighthouseci/*
158+
!**/.lighthouseci/scripts
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
'use strict';
2+
3+
module.exports = async (browser, context) => {
4+
// launch browser for LHCI
5+
const page = await browser.newPage();
6+
await page.goto('http://localhost:3000');
7+
await page.evaluate(() => {
8+
localStorage.setItem('@backstage/core:SignInPage:provider', 'guest');
9+
});
10+
await page.goto('http://localhost:3000');
11+
};

lighthouserc.js

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* Copyright 2023 The Backstage Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
module.exports = {
17+
ci: {
18+
collect: {
19+
url: [
20+
/** Software Catalog */
21+
'http://localhost:3000/catalog',
22+
'http://localhost:3000/catalog-import',
23+
'http://localhost:3000/catalog/default/component/backstage',
24+
/** TechDocs */
25+
'http://localhost:3000/docs',
26+
'http://localhost:3000/docs/default/component/backstage',
27+
/** Software Templates */
28+
'http://localhost:3000/create',
29+
'http://localhost:3000/create/tasks',
30+
'http://localhost:3000/create/actions',
31+
'http://localhost:3000/create/edit',
32+
'http://localhost:3000/create/templates/default/react-ssr-template',
33+
/** Search */
34+
'http://localhost:3000/search',
35+
],
36+
settings: {
37+
onlyCategories: ['accessibility'],
38+
// need to disable storage reset because of auth
39+
disableStorageReset: true,
40+
output: ['html', 'json'],
41+
outputPath: './.lighthouseci/reports',
42+
preset: 'desktop',
43+
},
44+
startServerCommand: 'yarn dev',
45+
startServerReadyTimeout: 600000,
46+
numberOfRuns: 1,
47+
puppeteerScript: './.lighthouseci/scripts/guest-auth.js',
48+
startServerReadyPattern: 'Listening on :7007',
49+
},
50+
assert: {
51+
assertions: {
52+
'categories:performance': 'off',
53+
'categories:pwa': 'off',
54+
'categories:best-practices': 'off',
55+
'categories:seo': 'off',
56+
'categories:accessibility': ['error', { minScore: 0.85 }],
57+
},
58+
},
59+
},
60+
};

0 commit comments

Comments
 (0)