Skip to content

Commit

Permalink
Merge pull request #79 from teomrd/lighthouse
Browse files Browse the repository at this point in the history
Lighthouse
  • Loading branch information
teomrd authored Nov 13, 2024
2 parents 90a84cb + d206520 commit dd1ca69
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 19 deletions.
17 changes: 17 additions & 0 deletions .github/actions/lighthouse-audit/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Lighthouse Audit checks
description: Checks for Performance Accessibility, Best Practices & SEO from Google Lighthouse project
runs:
using: composite
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install Lighthouse
shell: bash
run: |
npm install -g @lhci/cli@0.14.x
- name: Run Lighthouse audit
shell: bash
run: |
make lighthouse-audit
19 changes: 18 additions & 1 deletion .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,27 @@ on:
jobs:
quality-checks:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v2
with:
deno-version: v2.x
- run: make checks
- run: make build
build-and-audit:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v2
with:
deno-version: v2.x
- name: Lighthouse audits
env:
LHCI_BUILD_CONTEXT__CURRENT_HASH: ${{ github.event.pull_request.head.sha || github.sha }}
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
uses: ./.github/actions/lighthouse-audit
38 changes: 38 additions & 0 deletions .lighthouserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"ci": {
"collect": {
"staticDistDir": "./dist"
},
"upload": {
"target": "temporary-public-storage"
},
"assert": {
"assertions": {
"categories:performance": [
"error",
{
"minScore": 1
}
],
"categories:accessibility": [
"error",
{
"minScore": 0.9
}
],
"categories.best-practices" : [
"error",
{
"minScore": 0.95
}
],
"categories.seo" : [
"error",
{
"minScore": 0.9
}
]
}
}
}
}
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ MAKE_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))

.DEFAULT_GOAL := dev

.PHONY : install dev audits deploy serve build deploy clean
.PHONY : install dev deploy serve build deploy clean

install:
deno install
Expand All @@ -22,11 +22,11 @@ test:
compile:
deno task compile

checks: install verify-formatting lint test
make compile
checks: install compile build verify-formatting lint
make test

audits: install build
deno task lighthouse
lighthouse-audit: install build
lhci autorun

clean:
deno clean
Expand Down
10 changes: 0 additions & 10 deletions lighthouserc.js

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/build.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as esbuild from "npm:esbuild";

const VERSION = Deno.env.get("NEW_VERSION")
const VERSION = Deno.env.get("NEW_VERSION") || `v0.0.0`;

const result = await esbuild.build({
entryPoints: ["./src/index.ts"],
Expand Down
6 changes: 4 additions & 2 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
#!/bin/bash

echo -e "🛠️ Building ${COLOR_GREEN}MiroPad${NO_COLOR} ${COLOR_RED}${NEW_VERSION}${NO_COLOR} \n"
version="${NEW_VERSION:-"v0.0.0"}"

echo -e "🛠️ Building ${COLOR_GREEN}MiroPad${NO_COLOR} ${COLOR_RED}${version}${NO_COLOR} \n"

mkdir -p ./dist

cp ./src/manifest.json ./dist
cp ./static/favicon.ico ./dist
cp ./src/service-worker.js ./dist

echo "$NEW_VERSION" >./dist/version
echo "$version" >./dist/version

cp -r ./src/assets/images ./dist/images

Expand Down

0 comments on commit dd1ca69

Please sign in to comment.