Skip to content

Commit

Permalink
INFRA11 - Define a budget for Performance score in Lighthouse check (#…
Browse files Browse the repository at this point in the history
…155)

* INFRA11 - Define a budget for Performance score in Lighthouse check

* dynamic axe chrome driver

* link to downloaded chromium

* fix for chromium
  • Loading branch information
gregoriopalama authored Mar 28, 2024
1 parent 1215a2b commit 7356e4d
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
22 changes: 21 additions & 1 deletion .github/workflows/axe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,26 @@ jobs:
- run: pnpm run build --if-present
- run: pnpm run preview & npx wait-on http://localhost:4321
- run: pnpm install -g @axe-core/cli
- name: Get Chromium version
run: |
CHROMIUM_VERSION=$(wget -qO- https://googlechromelabs.github.io/chrome-for-testing/LATEST_RELEASE_STABLE | cut -d. -f1)
echo "Chromium version: $CHROMIUM_VERSION"
echo "CHROMIUM_VERSION=$CHROMIUM_VERSION" >> $GITHUB_ENV
- name: Setup Chrome
id: setup-chrome
uses: browser-actions/setup-chrome@v1
with:
chrome-version: ${{ env.CHROMIUM_VERSION }}
- name: Linking Chrome
run: |
rm -f /opt/google/chrome/chrome
ln -s ${{ steps.setup-chrome.outputs.chrome-path }} /opt/google/chrome/chrome
- name: Install chromedriver
run: |
echo "Installing chromedriver version: $CHROMIUM_VERSION"
pnpm install -g chromedriver@$CHROMIUM_VERSION
echo "chromedriver version: $(chromedriver --version)"
- name: Run axe
run: |
axe http://localhost:4321 --exit
CHROMIUM_VERSION=$(google-chrome --version | cut -d' ' -f3 | cut -d'.' -f1)
axe --chromedriver-path $(pnpm root -g)/chromedriver/bin/chromedriver http://localhost:4321 --exit
1 change: 1 addition & 0 deletions .github/workflows/lighthouse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ jobs:
uploadArtifacts: true
temporaryPublicStorage: true
runs: 5
budgetPath: ./.github/workflows/lighthouse/budget.json
- name: Format Lighthouse score
uses: actions/github-script@v5
id: format_lighthouse_score
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/lighthouse/budget.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[
{
"path": "/*",
"resourceSizes": [],
"timings": [
{
"metric": "largest-contentful-paint",
"budget": 2500
},
{
"metric": "max-potential-fid",
"budget": 100
},
{
"metric": "cumulative-layout-shift",
"budget": 0.1
}
]
}
]

0 comments on commit 7356e4d

Please sign in to comment.