From 762117341c18c17ba6abeba2ce35c6a57c053e1e Mon Sep 17 00:00:00 2001 From: Paul Chavez Date: Sat, 7 Dec 2024 22:20:12 -0500 Subject: [PATCH 1/4] feat: add Lighthouse CI workflow and configuration; remove old image compression workflow --- .../workflows/calibreapp-image-actions.yml | 33 ------------------- .github/workflows/ci.yml | 31 +++++++++++++++++ .gitignore | 2 ++ lighthouserc.js | 12 +++++++ 4 files changed, 45 insertions(+), 33 deletions(-) delete mode 100644 .github/workflows/calibreapp-image-actions.yml create mode 100644 .github/workflows/ci.yml create mode 100644 lighthouserc.js diff --git a/.github/workflows/calibreapp-image-actions.yml b/.github/workflows/calibreapp-image-actions.yml deleted file mode 100644 index e3aec3e..0000000 --- a/.github/workflows/calibreapp-image-actions.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Compress Images -on: - pull_request: - # Run Image Actions when JPG, JPEG, PNG or WebP files are added or changed. - # See https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#onpushpull_requestpaths for reference. - paths: - - '**.jpg' - - '**.jpeg' - - '**.png' - - '**.webp' - - '**.ico' - - '**.svg' -jobs: - build: - # Only run on Pull Requests within the same repository, and not from forks. - if: github.event.pull_request.head.repo.full_name == github.repository - name: calibreapp/image-actions - permissions: write-all - runs-on: ubuntu-latest - steps: - - name: Checkout Repo - uses: actions/checkout@v4 - - - name: Compress Images - uses: calibreapp/image-actions@main - with: - # The `GITHUB_TOKEN` is automatically generated by GitHub and scoped only to the repository that is currently running the action. By default, the action can’t update Pull Requests initiated from forked repositories. - # See https://docs.github.com/en/actions/reference/authentication-in-a-workflow and https://help.github.com/en/articles/virtual-environments-for-github-actions#token-permissions - githubToken: ${{ secrets.GITHUB_TOKEN }} - jpegQuality: '80' - jpegProgressive: false - pngQuality: '80' - webpQuality: '80' \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c92aef0 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,31 @@ +name: Lighthouse CI + +on: + push: + branches: + - main + + pull_request: + branches: + - main + +jobs: + lighthouse: + name: Lighthouse + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Use Node.js 18 + uses: actions/setup-node@v3 + with: + node-version: '18' + - name: npm install, build + run: | + npm install + npm run build + - name: run Lighthouse CI + run: | + npm install -g @lhci/cli@0.14.x + lhci autorun + env: + LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index fd3dbb5..4837ee0 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,5 @@ yarn-error.log* # typescript *.tsbuildinfo next-env.d.ts + +.lighthouseci \ No newline at end of file diff --git a/lighthouserc.js b/lighthouserc.js new file mode 100644 index 0000000..dc9c0c0 --- /dev/null +++ b/lighthouserc.js @@ -0,0 +1,12 @@ +module.exports = { + ci: { + collect: { + numberOfRuns: 3, + url: ['http://localhost:3000/'], + startServerCommand: 'npm run start' + }, + upload: { + target: 'temporary-public-storage' + } + } +}; \ No newline at end of file From 3be42ec2411762f5aae1bd4f65045e5ebc8e28fd Mon Sep 17 00:00:00 2001 From: Paul Chavez Date: Sat, 7 Dec 2024 22:41:20 -0500 Subject: [PATCH 2/4] chore: update CI workflow to use Bun and latest actions; improve steps for Lighthouse CI --- .github/workflows/ci.yml | 31 +++++++++++++++++-------------- bun.lockb | Bin 210441 -> 210441 bytes 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c92aef0..ad904ca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,31 +1,34 @@ name: Lighthouse CI -on: +on: push: branches: - main - pull_request: branches: - main jobs: lighthouse: - name: Lighthouse runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Use Node.js 18 - uses: actions/setup-node@v3 + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Bun + uses: oven-sh/setup-bun@v2 with: - node-version: '18' - - name: npm install, build - run: | - npm install - npm run build - - name: run Lighthouse CI + bun-version: 1.1.5 + + - name: Install dependencies + run: bun install + + - name: Build project + run: bun run build + + - name: Install and Run Lighthouse CI run: | - npm install -g @lhci/cli@0.14.x - lhci autorun + bun add -g @lhci/cli@0.14.x + bunx lhci autorun env: LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }} \ No newline at end of file diff --git a/bun.lockb b/bun.lockb index 808d8b09dce6302a2a5d21f5e37b1be14fab63c3..4b4474248214500e86bea674a3254766a800c1fa 100755 GIT binary patch delta 59 zcmeBt!_)bOr=f*$3)5{e4#qemBRx|+)9H`Jn5F=Erh3K(dPdXh#hKjLK|C`(qxLi6 MOxw?hGuz4m05VY#D*ylh delta 59 xcmeBt!_)bOr=f*$3)5{e4kiW&nEqIdX$pc@FV5t~4wY*^BhIw_j5xEc900da49frj From f56e1491b757867e5f78efd2dac9074737b51306 Mon Sep 17 00:00:00 2001 From: Paul Chavez Date: Sat, 7 Dec 2024 22:56:11 -0500 Subject: [PATCH 3/4] chore: update lighthouserc.js to use Bun for server command and add Lighthouse assertions --- lighthouserc.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lighthouserc.js b/lighthouserc.js index dc9c0c0..3900fe9 100644 --- a/lighthouserc.js +++ b/lighthouserc.js @@ -3,10 +3,13 @@ module.exports = { collect: { numberOfRuns: 3, url: ['http://localhost:3000/'], - startServerCommand: 'npm run start' + startServerCommand: 'bun run start' }, upload: { target: 'temporary-public-storage' + }, + assert: { + preset: 'lighthouse:recommended' } } }; \ No newline at end of file From efc218dae0b89d52e016b4f1d23b0de09f297500 Mon Sep 17 00:00:00 2001 From: Paul Chavez Date: Sun, 8 Dec 2024 18:58:28 -0500 Subject: [PATCH 4/4] chore: update CI workflow to remove unnecessary environment variable for Lighthouse CI --- .github/workflows/ci.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ad904ca..bbafed6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,6 +29,4 @@ jobs: - name: Install and Run Lighthouse CI run: | bun add -g @lhci/cli@0.14.x - bunx lhci autorun - env: - LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }} \ No newline at end of file + bunx lhci autorun \ No newline at end of file