track analytics for the site #285
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this is heavily influenced by | |
# https://github.com/tomdye/vercel-lighthouse-action | |
name: CI | |
on: | |
pull_request: | |
branches: [main] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
permissions: | |
checks: read | |
contents: read | |
pull-requests: write | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: restore dependencies | |
uses: bahmutov/npm-install@v1 | |
- run: npm run lint:all | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: restore dependencies | |
uses: bahmutov/npm-install@v1 | |
- run: npm run test | |
type_check: | |
name: type check | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: restore dependencies | |
uses: bahmutov/npm-install@v1 | |
- run: npm run type-check | |
lighthouse_desktop: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: restore dependencies | |
uses: bahmutov/npm-install@v1 | |
- name: awaiting preview url | |
uses: patrickedqvist/[email protected] | |
id: vercel_preview_url | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
max_timeout: 300 # 5min | |
- name: add comment to PR | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
number: ${{ github.event.pull_request.number }} | |
header: lighthouse desktop | |
message: | | |
🚦 Running Lighthouse audit on desktop... | |
- name: audit urls using lighthouse emulating desktop | |
id: lighthouse_audit | |
uses: treosh/lighthouse-ci-action@v9 | |
with: | |
urls: | | |
${{ steps.vercel_preview_url.outputs.url }} | |
${{ steps.vercel_preview_url.outputs.url }}/about | |
${{ steps.vercel_preview_url.outputs.url }}/posts | |
${{ steps.vercel_preview_url.outputs.url }}/posts/post-design-system | |
${{ steps.vercel_preview_url.outputs.url }}/posts/the-perfect-header-animation | |
uploadArtifacts: true | |
temporaryPublicStorage: true | |
runs: 3 | |
configPath: './.github/lighthouse/desktop.lighthouserc.js' | |
- name: format lighthouse result | |
id: lighthouse_result | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
require('./.github/lighthouse/formatLighthouseResult.js')({ | |
core, | |
type: 'Desktop', | |
links: ${{ steps.lighthouse_audit.outputs.links }}, | |
manifest: ${{ steps.lighthouse_audit.outputs.manifest }} | |
}) | |
- name: add lighthouse comment to PR | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
number: ${{ github.event.pull_request.number }} | |
header: lighthouse desktop | |
message: | | |
${{ steps.lighthouse_result.outputs.comment }} | |
lighthouse_mobile: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: restore dependencies | |
uses: bahmutov/npm-install@v1 | |
- name: awaiting preview url | |
uses: patrickedqvist/[email protected] | |
id: vercel_preview_url | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
max_timeout: 300 # 5min | |
- name: add comment to PR | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
number: ${{ github.event.pull_request.number }} | |
header: lighthouse mobile | |
message: | | |
🚦 Running Lighthouse audit on mobile... | |
- name: audit urls using lighthouse emulating mobile | |
id: lighthouse_audit | |
uses: treosh/lighthouse-ci-action@v9 | |
with: | |
urls: | | |
${{ steps.vercel_preview_url.outputs.url }} | |
${{ steps.vercel_preview_url.outputs.url }}/about | |
${{ steps.vercel_preview_url.outputs.url }}/posts | |
${{ steps.vercel_preview_url.outputs.url }}/posts/post-design-system | |
${{ steps.vercel_preview_url.outputs.url }}/posts/the-perfect-header-animation | |
uploadArtifacts: true | |
temporaryPublicStorage: true | |
runs: 3 | |
configPath: './.github/lighthouse/mobile.lighthouserc.js' | |
- name: format lighthouse result | |
id: lighthouse_result | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
require('./.github/lighthouse/formatLighthouseResult.js')({ | |
core, | |
type: 'Mobile', | |
links: ${{ steps.lighthouse_audit.outputs.links }}, | |
manifest: ${{ steps.lighthouse_audit.outputs.manifest }} | |
}) | |
- name: add lighthouse comment to PR | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
number: ${{ github.event.pull_request.number }} | |
header: lighthouse mobile | |
message: | | |
${{ steps.lighthouse_result.outputs.comment }} |