DEFINITION
Let's modify our homepage images!
DEFINITION
IMPLEMENT
Web devs receive the images from the marketing or design team.
And implement the changes.
DEFINITION
IMPLEMENT
TEST
Automated testing before merging (component testing, integration testing, E2E...).
DEFINITION
IMPLEMENT
DEPLOY
TEST
It can be deployed on production or other previous environments (staging, test...).
DEFINITION
IMPLEMENT
DEPLOY
WEB
PERF.
CHECK
TEST
Once the code is live somewhere, web performance may be tested.
DEV?
BUSINESS?
SEO?
USERS?
SEARCH
CONSOLE?
NOBODY??
Problem
We've added a loading="lazy" attribute to our cover hero image tag 🤦🏻♀️
Remove the loading="lazy" attribute (or modify its value by eager).
Solution
DEFINITION
IMPLEMENT
DEPLOY
PERF.
CHECK
TEST
Depending on the degradation or the solution complexity...
Spending more time === Spending more money
(and generates a bad UX & DX)
BACKLOG
Pros
Cons
En mi máquina funciona alert!!!
Pros
Cons
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
GitHub is a Git repository hosting service. It offers the distributed version control and source code management functionality of Git, plus its own features such as bug tracking, feature requests, task management, continuous integration, and wikis for every project.
continuous integration
With GitHub Actions you can automate, customize, and execute your software development workflows right in your repository.
Automate running Lighthouse for every commit, viewing the changes, and preventing regressions
Node v12 LTS
Database Storage
(sqlite, mysql, or postgresql)
1. Install Git & Node
2. Create a Heroku account
3. Install Heroku CLI
$ brew tap heroku/brew && brew install heroku
$ npm install -g heroku
4. Set up your lhci-heroku repo
# Create a directory and repo for your heroku project
mkdir lhci-heroku && cd lhci-heroku && git init
# Setup the LHCI files
curl https://raw.githubusercontent.com/GoogleChrome/lighthouse-ci/main/docs/recipes/heroku-server/package.json > package.json
curl https://raw.githubusercontent.com/GoogleChrome/lighthouse-ci/main/docs/recipes/heroku-server/server.js > server.js
# Create the project's first commit
git add package.json server.js && git commit -m 'Initial commit'
4. Set up your lhci-heroku repo
# Create a new project on heroku
heroku create
# Add a free database to your project
heroku addons:create heroku-postgresql:hobby-dev
# Deploy your code to heroku
git push heroku main
# Ensure heroku is running your app and open the URL
heroku ps:scale web=1
heroku open
5. Install LHCI CLI & launch lhci wizard
# Install the Lighthouse CI CLI.
npm install -g @lhci/cli
5. Install LHCI CLI & launch lhci wizard
$ lhci wizard
? Which wizard do you want to run? new-project
? What is the URL of your LHCI server? https://your-lhci-server.herokuapp.com/
? What would you like to name the project? My Project
? Where is the project's code hosted? https://github.com/myaccount/miproject
? What branch is considered the repo's trunk or main branch? main
Created project My Project (XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX)!
Use build token XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX to add data.
Use admin token XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX to manage the project. KEEP THIS SECRET!
6. Create secrets on your GitHub repo
6. Create secrets on your GitHub repo
6. Create secrets on your GitHub repo
6. Create secrets on your GitHub repo
Server URL from Heroku
6. Create secrets on your GitHub repo
Server build token from Heroku
6. Create secrets on your GitHub repo
7. Create a new workflow on your project
lhci.yaml
7. Create a new workflow
lhci.yaml
name: Lighthouse CI Server Production
on: push
jobs:
lhci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16.x
run: npm install
- name: Run Lighthouse CI
uses: treosh/lighthouse-ci-action@v9
with:
runs: 3
urls: |
http://localhost:3000/
http://localhost:3000/about/
http://localhost:3000/blog/
configPath: './lighthouserc.js'
serverBaseUrl: ${{ secrets.LHCI_SERVER_URL }}
serverToken: ${{ secrets.LHCI_TOKEN }}
uploadArtifacts: true
8. Create a new config file
lighthouserc.js
8. Create a new config file
lighthouserc.js
module.exports = {
ci: {
collect: {
// collect options here
},
assert: {
// assert options here
},
upload: {
// upload options here
},
server: {
// server options here
},
wizard: {
// wizard options here
},
},
};
8. Create a new config file
lighthouserc.js
module.exports = {
ci: {
collect: {
startServerCommand: "npm start",
},
assert: {
assertions: {
"categories:performance": ["warn", { minScore: 0.8 }],
"categories:seo": ["error", { minScore: 0.8 }],
"categories:pwa": "off",
"first-contentful-paint": ["warn", {"maxNumericValue": 2000}],
"dom-size": ["error", {"maxNumericValue": 3000}],
"resource-summary:script:size": ["warn", {"maxNumericValue": 300}],
"resource-summary:third-party:count": ["warn", {"maxNumericValue": 5}],
},
}
},
};