Merge pull request #22406 from jithenms/feature/add-microsite-accessibility-check

[feat] Add microsite accessibility CI workflow
This commit is contained in:
Ben Lambert
2024-02-07 14:04:48 +01:00
committed by GitHub
6 changed files with 143 additions and 3 deletions
@@ -7,7 +7,7 @@ on:
branches: [master]
paths-ignore:
- 'lighthouserc.js'
- '.github/workflows/verify_accessibility_core.yml'
- '.github/workflows/verify_accessibility.yml'
- 'plugins/catalog/src/**'
- 'plugins/catalog-react/src/**'
- 'plugins/techdocs/src/**'
+2 -2
View File
@@ -1,11 +1,11 @@
name: Accessibility
on:
# NOTE: If you change these you must update verify_accessibility_core-noop.yml as well
# NOTE: If you change these you must update verify_accessibility-noop.yml as well
pull_request:
branches: [master]
paths:
- 'lighthouserc.js'
- '.github/workflows/verify_accessibility_core.yml'
- '.github/workflows/verify_accessibility.yml'
- 'plugins/catalog/src/**'
- 'plugins/catalog-react/src/**'
- 'plugins/techdocs/src/**'
@@ -0,0 +1,31 @@
# NO-OP placeholder that always passes for other paths
# This is here so that we're able to set the status check as required
name: Microsite Accessibility
on:
pull_request:
branches: [master]
paths-ignore:
- '.github/workflows/verify_microsite_accessibility.yml'
- 'microsite/scripts/**'
- 'microsite/src/**'
- 'microsite/data/**'
- 'microsite/blog/**'
- 'microsite/static/**'
- 'beps/**'
- 'mkdocs.yml'
- 'docs/**'
permissions:
contents: read
jobs:
noop:
name: Microsite Accessibility
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1
with:
egress-policy: audit
- run: echo NOOP
@@ -0,0 +1,40 @@
name: Microsite Accessibility
on:
# NOTE: If you change these you must update verify_microsite_accessibility-noop.yml as well
pull_request:
branches: [master]
paths:
- '.github/workflows/verify_microsite_accessibility.yml'
- 'microsite/**'
- 'beps/**'
- 'mkdocs.yml'
- 'docs/**'
jobs:
lhci:
name: Microsite Accessibility
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1
with:
egress-policy: audit
- uses: actions/checkout@v4.1.1
- name: Use Node.js 18.x
uses: actions/setup-node@v4.0.1
with:
node-version: 18.x
- name: top-level install
run: yarn install --immutable
- name: yarn install
run: yarn install --immutable
working-directory: microsite
- name: run Lighthouse CI
run: |
yarn dlx @lhci/cli@0.11.x --config=microsite/lighthouserc.js autorun
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+68
View File
@@ -0,0 +1,68 @@
/*
* Copyright 2023 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var sidebars = require('./sidebars.json');
module.exports = {
ci: {
collect: {
url: [
/** Home */
'http://localhost:3000',
/** Docs - Getting Started */
'http://localhost:3000/docs/getting-started',
/** Docs - Software Catalog */
'http://localhost:3000/docs/features/software-catalog',
/** Docs - Create a Plugin */
'http://localhost:3000/docs/plugins/create-a-plugin',
/** Docs - Designing for Backstage */
'http://localhost:3000/docs/dls/design',
/** Blog */
'http://localhost:3000/blog',
/** Plugins */
'http://localhost:3000/plugins',
/** Demos */
'http://localhost:3000/demos',
/** Community */
'http://localhost:3000/community',
/** Releases */
...sidebars.releases['Release Notes'].map(
path => `http://localhost:3000/docs/${path}`,
),
],
settings: {
onlyCategories: ['accessibility'],
output: ['html', 'json'],
outputPath: './.lighthouseci/reports',
preset: 'desktop',
},
// refers to root package scripts
startServerCommand: 'yarn run start:microsite',
startServerReadyPattern: 'compiled successfully',
startServerReadyTimeout: 600000,
numberOfRuns: 1,
},
assert: {
assertions: {
'categories:performance': 'off',
'categories:pwa': 'off',
'categories:best-practices': 'off',
'categories:seo': 'off',
'categories:accessibility': ['error', { minScore: 0.95 }],
},
},
},
};
+1
View File
@@ -11,6 +11,7 @@
"start-backend": "yarn workspace example-backend start",
"start:next": "yarn workspace example-app-next start",
"start-backend:next": "yarn workspace example-backend-next start",
"start:microsite": "cd microsite/ && yarn start",
"build:backend": "yarn workspace example-backend build",
"build:all": "backstage-cli repo build --all",
"build:api-reports": "yarn build:api-reports:only --tsc",