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

[LHCI] Resolve Lighthouse CI Performance Test Error and Added Desktop Audit #4397

Merged
merged 17 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
39 changes: 39 additions & 0 deletions .desktop-lighthouserc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
module.exports = {
"ci": {
"collect": {
"settings": {
"preset": "desktop"
},
"staticDistDir": "./public",
"url": [
"http://localhost/404/index.html?desktop",
"http://localhost/?desktop",
"http://localhost/company/about/index.html?desktop",
"http://localhost/cloud-native-management/meshery/index.html?desktop",
"http://localhost/cloud-native-management/meshmap/index.html?desktop",
"http://localhost/learn/learning-paths/index.html?desktop",
"http://localhost/learn/service-mesh-books/index.html?desktop",
"http://localhost/learn/service-mesh-workshops/index.html?desktop",
"http://localhost/learn/index.html?desktop",
"http://localhost/blog/index.html?desktop",
"http://localhost/resources/index.html?desktop",
"http://localhost/careers/index.html?desktop",
"http://localhost/community/members/index.html?desktop",
"http://localhost/community/meshmates/index.html?desktop",
"http://localhost/community/events/index.html?desktop",
"http://localhost/community/newcomers/index.html?desktop",
],
},
"assert": {
"assertions": {
"categories:performance": ["warn", {"minScore": .90}],
"categories:accessibility": ["warn", {"minScore": .90}],
"categories:best-practices": ["warn", {"minScore": .90}],
"categories:seo": ["warn", {"minScore": .90}],
}
},
"upload": {
"target": "temporary-public-storage",
},
}
};
5 changes: 4 additions & 1 deletion .github/workflows/lighthouseci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@ jobs:
with:
node-version: 19
- run: npm install && npm install -g @lhci/cli@0.11.x
- run: npm run build
- run: CI=false npm run build
- run: lhci collect --config=.desktop-lighthouserc.js
- run: lhci assert --config=.desktop-lighthouserc.js
- run: lhci upload
- run: lhci autorun
30 changes: 15 additions & 15 deletions .lighthouserc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ module.exports = {
"collect": {
"staticDistDir": "./public",
"url" : ["http://localhost/404.html",
"http://localhost/index.html",
"http://localhost/404/index.html",
"http://localhost/company/about.html" ,
"http://localhost/cloud-native-management/meshery.html",
"http://localhost/cloud-native-management/meshmap.html",
"http://localhost/learn/learning-paths.html",
"http://localhost/learn/service-mesh-books.html",
"http://localhost/learn/service-mesh-workshops.html",
"http://localhost/learn.html",
"http://localhost/blog.html",
"http://localhost/resources.html",
"http://localhost/careers.html",
"http://localhost/community/members.html",
"http://localhost/community/meshmates.html",
"http://localhost/community/events.html",
"http://localhost/community/newcomers.html",],
"http://localhost",
"http://localhost/company/about/index.html",
"http://localhost/cloud-native-management/meshery/index.html",
"http://localhost/cloud-native-management/meshmap/index.html",
"http://localhost/learn/learning-paths/index.html",
"http://localhost/learn/service-mesh-books/index.html",
"http://localhost/learn/service-mesh-workshops/index.html",
"http://localhost/learn/index.html",
"http://localhost/blog/index.html",
"http://localhost/resources/index.html",
"http://localhost/careers/index.html",
"http://localhost/community/members/index.html",
"http://localhost/community/meshmates/index.html",
"http://localhost/community/events/index.html",
"http://localhost/community/newcomers/index.html",],
},
"assert": {
"preset": "lighthouse:no-pwa",
Expand Down
4 changes: 2 additions & 2 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const { paginate } = require("gatsby-awesome-pagination");
const { createFilePath } = require("gatsby-source-filesystem");
const config = require("./gatsby-config");

if (process.env.CI) {
if (process.env.CI === "true") {
// All process.env.CI conditionals in this file are in place for GitHub Pages, if webhost changes in the future, code may need to be modified or removed.
//Replacing '/' would result in empty string which is invalid
const replacePath = (url) => (url === "/" || url.includes("/404")) ? url : `${url}.html`;
Expand Down Expand Up @@ -69,7 +69,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
const { createPage } = actions;

const envCreatePage = (props) => {
if (process.env.CI){
if (process.env.CI === "true"){
const { path, ...rest } = props;

createRedirect({ fromPath: `/${path}/`, toPath: `/${path}`, redirectInBrowser: true, isPermanent: true });
Expand Down