Skip to content
This repository has been archived by the owner on Jul 8, 2023. It is now read-only.

Commit

Permalink
Feat: Add lighthouse tests
Browse files Browse the repository at this point in the history
  • Loading branch information
luisorbaiceta committed Jan 20, 2022
1 parent 0749438 commit bb9adb7
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 3 deletions.
31 changes: 28 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ jobs:
strategy:
matrix:
node-version: [16.x]
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v2
Expand All @@ -28,10 +27,36 @@ jobs:
- name: Test
run: npm test

# Sets the branch name as environment variable
- uses: nelonoel/branch-name@v1.0.1
- name: Publish
uses: netlify/actions/build@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}

- name: Waiting for Netlify Preview
id: deployment
uses: jakepartusch/wait-for-netlify-action@v1.3
with:
site_name: "fastify-website"

# Check lighthouse indicators for main page
- name: Audit Preview
id: lighthouse_audit
uses: treosh/lighthouse-ci-action@v8
env:
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
with:
urls: ${{ steps.deployment.outputs.url }}
configPath: ".github/workflows/lighthouse/.lighthouserc.json"

automerge:
needs: build
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
steps:
- uses: fastify/github-action-merge-dependabot@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
target: minor
59 changes: 59 additions & 0 deletions .github/workflows/lighthouse/.lighthouserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"ci": {
"collect": {
"numberOfRuns": 3
},
"assert": {
"assertions": {
"render-blocking-resources": [
"warn",
{
"numericValue": 0
}
],
"uses-rel-preconnect": [
"warn",
{
"numericValue": 0
}
],
"maskable-icon": [
"warn",
{
"minScore": 0.9
}
],
"csp-xss": [
"warn",
{
"minScore": 0
}
],
"categories:performance": [
"error",
{
"minScore": 0.9
}
],
"categories:accessibility": [
"error",
{
"minScore": 0.9
}
],
"categories:best-practices": [
"error",
{
"minScore": 0.9
}
],
"categories:seo": [
"error",
{
"minScore": 1
}
]
}
}
}
}

0 comments on commit bb9adb7

Please sign in to comment.