Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

devops: run lhci on bot and user landings #75

Merged
merged 2 commits into from
Apr 6, 2024

Conversation

gaboesquivel
Copy link
Member

@gaboesquivel gaboesquivel commented Apr 6, 2024

Summary by CodeRabbit

  • New Features
    • Expanded Lighthouse checks to include additional URLs for comprehensive performance analysis.
  • Refactor
    • Improved the Lighthouse report script for detailed performance insights on multiple pages.

Copy link

vercel bot commented Apr 6, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
masterbots ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 6, 2024 7:49am

Copy link

github-actions bot commented Apr 6, 2024

Running Lighthouse audit...

Copy link
Contributor

coderabbitai bot commented Apr 6, 2024

Walkthrough

This update enhances the Lighthouse CI workflow by expanding its scope to include additional URLs for performance review. It introduces a smarter approach to handling the analysis of multiple pages, where the script now iterates over each page, gathering performance metrics to create a comprehensive, page-specific report. This change ensures a more detailed and insightful overview of the site's performance, aiding in pinpointing areas for improvement.

Changes

File Path Change Summary
.github/workflows/.../lighthouse.yml Added more URLs for Lighthouse checks; refactored to iterate over pages and generate detailed comments per page based on performance scores.

🐇✨
In the digital garden, where the web does bloom,
A rabbit hopped in, with a task to groom.
"Let's check these pages," it said with a cheer,
"For performance and speed, to make things clear."
With a hop and a skip, it went through the site,
Leaving reports in its wake, shining so bright.
"Now all can see, where improvements can be made,"
The rabbit concluded, as the sunlight started to fade.
🌟📄

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@gaboesquivel gaboesquivel changed the title devops: debug github actions devops: run lhci on bot and user landings Apr 6, 2024
@gaboesquivel gaboesquivel merged commit 88c230d into develop Apr 6, 2024
1 of 2 checks passed
@gaboesquivel gaboesquivel deleted the test-lighthouse-ci-10 branch April 6, 2024 07:49
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Review Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 15179c2 and 22ee038.
Files selected for processing (1)
  • .github/workflows/lighthouse.yml (2 hunks)

Comment on lines +38 to +40
"https://${{ steps.vercel_preview_url.outputs.preview_url }}/b/moneybot"
"https://${{ steps.vercel_preview_url.outputs.preview_url }}/u/slug-1"
"https://${{ steps.vercel_preview_url.outputs.preview_url }}/p"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider parameterizing the URL paths to enhance maintainability.

-            "https://${{ steps.vercel_preview_url.outputs.preview_url }}/b/moneybot"
-            "https://${{ steps.vercel_preview_url.outputs.preview_url }}/u/slug-1"
-            "https://${{ steps.vercel_preview_url.outputs.preview_url }}/p"
+            ${{ format('https://{{ steps.vercel_preview_url.outputs.preview_url }}/{0}', 'b/moneybot') }}
+            ${{ format('https://{{ steps.vercel_preview_url.outputs.preview_url }}/{0}', 'u/slug-1') }}
+            ${{ format('https://{{ steps.vercel_preview_url.outputs.preview_url }}/{0}', 'p') }}

Parameterizing the paths can simplify future updates to the URLs and make the workflow file cleaner and more readable.


Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
"https://${{ steps.vercel_preview_url.outputs.preview_url }}/b/moneybot"
"https://${{ steps.vercel_preview_url.outputs.preview_url }}/u/slug-1"
"https://${{ steps.vercel_preview_url.outputs.preview_url }}/p"
${{ format('https://{{ steps.vercel_preview_url.outputs.preview_url }}/{0}', 'b/moneybot') }}
${{ format('https://{{ steps.vercel_preview_url.outputs.preview_url }}/{0}', 'u/slug-1') }}
${{ format('https://{{ steps.vercel_preview_url.outputs.preview_url }}/{0}', 'p') }}

Comment on lines +50 to +70
const manifest = ${{ toJSON(steps.lighthouse_audit.outputs.manifest) }};
const links = ${{ toJSON(steps.lighthouse_audit.outputs.links) }};

const formatResult = (res) => Math.round((res * 100))
Object.keys(result).forEach(key => result[key] = formatResult(result[key]))
const formatResult = (res) => Math.round((res * 100));
const score = (res) => (res >= 90 ? '🟢' : res >= 50 ? '🟠' : '🔴');

const score = res => res >= 90 ? '🟢' : res >= 50 ? '🟠' : '🔴'
let comment = `⚡️ [Lighthouse report](${Object.values(links)[0]}) for the changes in this PR:\n`;
comment += '| Category | Score |\n';
comment += '| --- | --- |\n';

const comment = [
`⚡️ [Lighthouse report](${Object.values(links)[0]}) for the changes in this PR:`,
'| Category | Score |',
'| --- | --- |',
`| ${score(result.performance)} Performance | ${result.performance} |`,
`| ${score(result.accessibility)} Accessibility | ${result.accessibility} |`,
`| ${score(result['best-practices'])} Best practices | ${result['best-practices']} |`,
`| ${score(result.seo)} SEO | ${result.seo} |`,
`| ${score(result.pwa)} PWA | ${result.pwa} |`,
' ',
`*Lighthouse ran on [${Object.keys(links)[0]}](${Object.keys(links)[0]})*`
].join('\n')
Object.keys(manifest).forEach((page) => {
const result = manifest[page].summary;
const pageLink = manifest[page].url;
Object.keys(result).forEach((key) => {
const formattedScore = formatResult(result[key]);
comment += `| ${score(result[key])} ${key} | ${formattedScore} |\n`;
});
comment += `*Lighthouse ran on [${pageLink}](${pageLink})*\n\n`;
});

core.setOutput("comment", comment);
core.setOutput('comment', comment);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure error handling for the Lighthouse audit results.

+            if (!manifest || Object.keys(manifest).length === 0) {
+              core.setFailed('Lighthouse audit did not generate any results.');
+              return;
+            }

Adding error handling ensures that the workflow fails gracefully if the Lighthouse audit does not generate any results, providing clearer feedback to the developers.


Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
const manifest = ${{ toJSON(steps.lighthouse_audit.outputs.manifest) }};
const links = ${{ toJSON(steps.lighthouse_audit.outputs.links) }};
const formatResult = (res) => Math.round((res * 100))
Object.keys(result).forEach(key => result[key] = formatResult(result[key]))
const formatResult = (res) => Math.round((res * 100));
const score = (res) => (res >= 90 ? '🟢' : res >= 50 ? '🟠' : '🔴');
const score = res => res >= 90 ? '🟢' : res >= 50 ? '🟠' : '🔴'
let comment = `⚡️ [Lighthouse report](${Object.values(links)[0]}) for the changes in this PR:\n`;
comment += '| Category | Score |\n';
comment += '| --- | --- |\n';
const comment = [
`⚡️ [Lighthouse report](${Object.values(links)[0]}) for the changes in this PR:`,
'| Category | Score |',
'| --- | --- |',
`| ${score(result.performance)} Performance | ${result.performance} |`,
`| ${score(result.accessibility)} Accessibility | ${result.accessibility} |`,
`| ${score(result['best-practices'])} Best practices | ${result['best-practices']} |`,
`| ${score(result.seo)} SEO | ${result.seo} |`,
`| ${score(result.pwa)} PWA | ${result.pwa} |`,
' ',
`*Lighthouse ran on [${Object.keys(links)[0]}](${Object.keys(links)[0]})*`
].join('\n')
Object.keys(manifest).forEach((page) => {
const result = manifest[page].summary;
const pageLink = manifest[page].url;
Object.keys(result).forEach((key) => {
const formattedScore = formatResult(result[key]);
comment += `| ${score(result[key])} ${key} | ${formattedScore} |\n`;
});
comment += `*Lighthouse ran on [${pageLink}](${pageLink})*\n\n`;
});
core.setOutput("comment", comment);
core.setOutput('comment', comment);
const manifest = ${{ toJSON(steps.lighthouse_audit.outputs.manifest) }};
const links = ${{ toJSON(steps.lighthouse_audit.outputs.links) }};
if (!manifest || Object.keys(manifest).length === 0) {
core.setFailed('Lighthouse audit did not generate any results.');
return;
}
const formatResult = (res) => Math.round((res * 100));
const score = (res) => (res >= 90 ? '🟢' : res >= 50 ? '🟠' : '🔴');
let comment = `⚡️ [Lighthouse report](${Object.values(links)[0]}) for the changes in this PR:\n`;
comment += '| Category | Score |\n';
comment += '| --- | --- |\n';
Object.keys(manifest).forEach((page) => {
const result = manifest[page].summary;
const pageLink = manifest[page].url;
Object.keys(result).forEach((key) => {
const formattedScore = formatResult(result[key]);
comment += `| ${score(result[key])} ${key} | ${formattedScore} |\n`;
});
comment += `*Lighthouse ran on [${pageLink}](${pageLink})*\n\n`;
});
core.setOutput('comment', comment);

gaboesquivel added a commit that referenced this pull request Apr 9, 2024
* devops: force deployment

* devops: force deployment

* devops: force deployment

* devops: update cloudbuild.yml

* devops: cloud logging only

* devops: remove cloudbuild.yml

* chore: update bunlock

* feat: browse as homepage, work early access (#62)

* feat: browse as home

* feat: browse as home

* feat: remove tabs

* feat: supabase auth (#63)

* feat: supabase auth

* feat: supabase auth

* feat: supabase auth

* feat: supabase auth

* feat: supabase auth

* feat: supabase auth

* feat: supabase auth

* feat: supabase auth

* feat: supabase auth

* feat: pro form

* devops:  lighthouse reports on prs (#64)

* devops:  lighthouse reports on prs

* chore: cleanup

* devops: lighthouse ci (#65)

* devops:  lighthouse reports on prs

* chore: cleanup

* chore: test lighthouse ci

* devops: lighthouse reports on pr

* devops: use zentered/vercel-preview-url

* devops: lighthouse ci github action (#66)

* chore: test lighthouse ci

* devops: fix version on github actions

* chore: cleanup

* devops: debug lighthouse github action (#67)

* chore: test lighthouse ci

* devops: debug github actions

* devops: correct project id on github actions (#69)

* devops: debug github actions

* devops: correct project id

* devops: correct vercel team id (#70)

* devops: debug github actions

* devops: correct vercel team id

* devops: debug github actions (#71)

* devops: debug github actions

* devops: use actions/checkout v4

* devops: add protocol to lhci url

* devops: use foo-software/lighthouse-check-action (#72)

* devops: debug github actions

* devops: debug github actions

* devops: use foo-software/lighthouse-check-action

* devops: lhci budget path (#73)

* devops: debug github actions

* devops: lhci budget path

* devops: disable lhci budget (#74)

* devops: debug github actions

* devops: disable lhci budget

* devops: run lhci on bot and user landings (#75)

* devops: debug github actions

* devops: run lhci on bot and user landings

* devops: run lhci on bot and user landings (#76)

* devops: debug github actions

* devops: run lhci on bot and user landings

* devops: run lhci on bot and user landings

* devops: run lhci on bot and user landings (#77)

* devops: debug github actions

* devops: run lhci on bot and user landings

* devops: debug lhci results comment (#78)

* devops: debug github actions

* devops: debug lhci results comment

* devops: debug lhci results comment (#79)

* devops: debug github actions

* devops: debug lhci results comment

* feat: thread landing (#80)

* devops: debug lhci results comment

* feat: thread landing

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: debug lhci results comment (#83)

* chore: cleanup

* devops: debug lhci results comment

* devops: debug lhci results comment (#84)

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: debug lhci results comment (#85)

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: debug lhci results comment (#86)

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: debug lhci results comment (#88)

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: debug lhci results comment (#89)

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: lhci results table comment

* devops: debug lhci results comment

* devops: lhci results table comment (#90)

* devops: lhci results table comment

* devops: lhci results table comment (#91)

* devops: lhci results table comment

* devops: lhci results table comment

* devops: lhci results table comment

* devops: debug lhci results comment (#92)

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: debug lhci results comment (#93)

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: lhci results table comment (#94)

* devops: debug lhci results comment

* devops: debug lhci results comment (#95)

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: debug lhci results comment (#96)

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: debug lhci results comment

* devops: lhci results table comment

* devops: lhci results table comment

* devops: debug lhci results comment

* devops: lhci results table comment (#98)

* chore: cleanup

* devops: lhci results table comment

* devops: test lhci results comment (#99)

* devops: test lhci results comment

* devops: test lhci results comment

* devops: test lhci results comment

* feat: shortener

* feat: supabase auth

* fix: hasura jwt secret on local env

* fix: hasura jwt secret on local env

* chore: user profile cookie

* chore: user profile cookie

* chore: user profile cookie

* chore: user profile cookie

* feat: supabase auth, github oauth, session cookies

* devops: config pkgs, eslint, prettier, tailwind, ts (#101)

* devops: config pkgs, eslint, prettier, tailwind, ts

* devops: config pkgs, eslint, prettier, tailwind, ts

* devops: config pkgs, eslint, prettier, tailwind, ts

* devops: config pkgs, eslint, prettier, tailwind, ts

* devops: remove first comment on lhci action

* devops: fix eslint action

* chore: ssr on browse, supa types, updated actions (#103)

* chore: browse ssr improvements, supabase db types

* chore: fix eslint

* devops: lhci on pr

* feat: thread ui dialog and ssr in public pages (#105)

* feat: thread dialog ui

* feat: thread dialog ui

* feat: thread dialog ui

* feat: ssr and layout improvements on u and b routes

* fix: correct thread number

* feat: ssr and layout improvements on u and b routes

* feat: global categories nav

* chore: move shared components

* feat: copy shortlink

* chore: disable getUserProfile

* perf: only 25 items on first render

* perf: only 20 items on first render

* fix: supabase ssr bug (#106)

* devops: wait 2 minutes before running lhci (#107)

* feat: load only 15 more

* fix: auth issues

* devops: wait 2 minutes before running lhci

* devops: wait before lhci, fix vercel build (#108)

* feat: load only 15 more

* fix: auth issues

* devops: wait 2 minutes before running lhci

* chore: cleanup

* fix: header session bug

* fix: chat auth bug (#109)

* fix: chat auth bug

* fix: chat auth bug

* fix: chat auth bug

* fix: chat navigation (#110)

* fix: icon size

* fix: chat navigation

* feat: chat list and dialog (#111)

* feat: chat lists and dialog

* feat: chat lists and dialog

* feat: dialog chat input
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant