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

Lighthouse CI #554

Merged
merged 14 commits into from
Aug 8, 2024
Merged

Lighthouse CI #554

merged 14 commits into from
Aug 8, 2024

Conversation

dcsaszar
Copy link
Contributor

@dcsaszar dcsaszar commented Aug 5, 2024

No description provided.

This will be used by the Lighthouse CI
* Prerender the EN homepage from a predefined instance
* Precompress and serve brotli for realistic CDN-like score
* Instead of `numberOfRuns` we use a retry strategy for faster results
It is included in the Lighthouse job.
@dcsaszar dcsaszar requested a review from apepper August 5, 2024 14:25
@apepper apepper self-assigned this Aug 5, 2024
Copy link
Contributor

@apepper apepper left a comment

Choose a reason for hiding this comment

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

FEEDBACK (4d02505)

Good stuff 🚀!

Please see my comments for questions/suggestions.

Comment on lines +15 to +17
upload:
outputDir: .lighthouseci/results
target: filesystem
Copy link
Contributor

Choose a reason for hiding this comment

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

Are those files used somewhere?

Copy link
Contributor Author

@dcsaszar dcsaszar Aug 6, 2024

Choose a reason for hiding this comment

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

No, they aren't, but the upload must go somewhere, so I just put them in an ignored-anyway folder. If you are fine with different values feel free to suggest some:
https://github.com/GoogleChrome/lighthouse-ci/blob/main/docs/configuration.md#target

temporary-public-storage maybe?

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the investigation.

filesystem is ok, but how about moving it to tmp/lighthouseci/results and gitignore tmp?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

.lighthouseci is written to anyway (see https://github.com/GoogleChrome/lighthouse-ci/blob/main/docs/configuration.md#collect).

What we could do is something like:

  upload:
    outputDir: .lighthouseci
    reportFilenamePattern: tmp
    target: filesystem

This would no longer accumulate reports for local runs and even hide the (over)written dummy file from most IDEs.
But in case someone is actually interested in archived local results, this would be a blocker. Leave as is?

.lighthouserc.yml Outdated Show resolved Hide resolved
.circleci/config.yml Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
package.json Outdated
@@ -8,6 +8,7 @@
"check-types": "tsc",
"preview": "vite preview",
"lint": "eslint --max-warnings 0 'src/**/*.ts' 'src/**/*.tsx' && knip",
"lighthouse": "SCRIVITO_TENANT=d0a154d76edf2a7bd991fc658e700a1d SCRIVITO_ORIGIN=http://localhost:8080 PRERENDER_OBJ_ID=c2a0aab78be05a4e npm run prerender && precompress --include '(**).(css|html|js)' --types br dist-ssr && for run in $(seq 6); do lhci autorun && break; done",
Copy link
Contributor

Choose a reason for hiding this comment

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

Regarding for run in $(seq 6); do lhci autorun && break; done: Do I understand this correctly, that lighthouse will try up to six times to reach the target score? Isn't numberOfRuns for that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, but

This reverts commit cccca78.
Allows to have a Lighthouse-like setup by running all three prerender scripts in order.
For quick non-performance-related checks `prerender-precompress` is optional.
@dcsaszar dcsaszar requested a review from apepper August 6, 2024 12:34
Copy link
Contributor

@apepper apepper left a comment

Choose a reason for hiding this comment

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

FEEDBACK (f7091b9)

Nice 🚀! Please see my comments.

package-lock.json Outdated Show resolved Hide resolved
Comment on lines +15 to +17
upload:
outputDir: .lighthouseci/results
target: filesystem
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the investigation.

filesystem is ok, but how about moving it to tmp/lighthouseci/results and gitignore tmp?

package.json Outdated Show resolved Hide resolved
.lighthouserc.yml Outdated Show resolved Hide resolved
### Challenges
* deliver, e.g., `en.html` if there is also a directory `en`.
* deliver the Brotli version if it exists

### Solution
* `http-server` can't handle the directory/filename clash
* `local-web-server` doesn't send the Brotli version with the straightforward `--static.extensions` option (https://github.com/lwsjs/local-web-server/wiki/How-to-serve-static-files)
* Luckily we can work around this by using `--rewrite` (https://github.com/lwsjs/local-web-server/wiki/How-to-rewrite-URLs-to-local-or-remote-destinations)
Avoids:
```
npm WARN deprecated rimraf@2.7.1: Rimraf versions prior to v4 are no longer supported
```
@dcsaszar dcsaszar requested a review from apepper August 7, 2024 20:51
Copy link
Contributor

@apepper apepper left a comment

Choose a reason for hiding this comment

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

FEEDBACK (a68fb50)

Almost there 🚀!

package.json Outdated Show resolved Hide resolved
@dcsaszar dcsaszar requested a review from apepper August 8, 2024 09:19
Copy link
Contributor

@apepper apepper left a comment

Choose a reason for hiding this comment

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

LGTM (5b2d689)

Awesome 🚀! Great work!

@apepper apepper merged commit f6b529c into main Aug 8, 2024
6 checks passed
@apepper apepper deleted the dave-lhci branch August 8, 2024 09:30
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.

2 participants