Skip to content

Commit

Permalink
chore: make lighthouse check more radical (#1610)
Browse files Browse the repository at this point in the history
Co-authored-by: Akshat Nema <76521428+akshatnema@users.noreply.github.com>
  • Loading branch information
derberg and akshatnema authored May 3, 2023
1 parent e6945b1 commit 4e9fd70
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 7 deletions.
38 changes: 32 additions & 6 deletions .github/workflows/lighthouse-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,43 @@ jobs:
lighthouse-ci:
name: Lighthouse CI
runs-on: ubuntu-latest
if: "github.repository == 'asyncapi/website' && github.event.pull_request.draft == false &&!((github.actor == 'asyncapi-bot' && startsWith(github.event.pull_request.title, 'ci: update global workflows')) || (github.actor == 'asyncapi-bot' && startsWith(github.event.pull_request.title, 'chore(release):')) || (github.actor == 'allcontributors' && startsWith(github.event.pull_request.title, 'docs: add')))"

steps:
- uses: actions/checkout@v3
- if: >
!github.event.pull_request.draft && !(
(github.actor == 'asyncapi-bot' && (
startsWith(github.event.pull_request.title, 'ci: update global workflows') ||
startsWith(github.event.pull_request.title, 'chore: update code of conduct') ||
startsWith(github.event.pull_request.title, 'ci: update global contribution guide') ||
startsWith(github.event.pull_request.title, 'ci: update workflows for go projects') ||
startsWith(github.event.pull_request.title, 'ci: update workflows for nodejs projects') ||
startsWith(github.event.pull_request.title, 'ci: update release-related workflows for nodejs projects') ||
startsWith(github.event.pull_request.title, 'ci: update semantic release config file') ||
startsWith(github.event.pull_request.title, 'ci: update generic workflows') ||
startsWith(github.event.pull_request.title, 'ci: update workflows for docker-based projects') ||
startsWith(github.event.pull_request.title, 'chore(release):')
)) ||
(github.actor == 'allcontributors[bot]' &&
startsWith(github.event.pull_request.title, 'docs: add')
)
)
id: should_run
name: Should Run
run: echo "::set-output name=shouldrun::true"
- if: steps.should_run.outputs.shouldrun == 'true'
uses: actions/checkout@v3

- name: Await Netlify Preview
- if: steps.should_run.outputs.shouldrun == 'true'
name: Await Netlify Preview
uses: jakepartusch/wait-for-netlify-action@v1
id: netlify
with:
site_name: asyncapi-website
max_timeout: 600

- name: Lighthouse Audit
- if: steps.should_run.outputs.shouldrun == 'true'
name: Lighthouse Audit
id: lighthouse_audit
uses: treosh/lighthouse-ci-action@9.3.0
with:
Expand All @@ -34,7 +58,8 @@ jobs:
env:
PR_NUMBER: ${{ github.event.pull_request.number}}

- name: Lighthouse Score Report
- if: steps.should_run.outputs.shouldrun == 'true'
name: Lighthouse Score Report
id: lighthouse_score_report
uses: actions/github-script@v6
with:
Expand All @@ -59,7 +84,8 @@ jobs:
].join('\n')
core.setOutput("comment", comment);
- name: LightHouse Statistic Comment
- if: steps.should_run.outputs.shouldrun == 'true'
name: LightHouse Statistic Comment
id: lighthouse_statistic_comment
uses: marocchino/sticky-pull-request-comment@v2.2.0
with:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/lighthouserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
"ci": {
"assert": {
"assertions": {
"categories:accessibility": ["error", {"minScore": 0.70}]
"categories:accessibility": ["error", {"minScore": 0.98}],
"categories:best-practices": ["error", {"minScore": 1.00}],
"categories:seo": ["error", {"minScore": 1.00}]
}
},
"collect": {
Expand Down

0 comments on commit 4e9fd70

Please sign in to comment.