-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GitHub Actions & Lighthouse conf (#1)
* Use Lighthouse CI Action * Configure Asserts in LHCI assertion language * Add puppeteer script to login into our web app
- Loading branch information
1 parent
d52f77c
commit fe8556b
Showing
5 changed files
with
388 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Flujo automatizada para auditar cada Pull Request con Lighthouse | ||
|
||
name: Performance Audit | ||
|
||
# Control: Ejecute la acción para cada Pull Request | ||
# Y cada Push a nuestro bello branch de producción | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- todo-lo-bello | ||
|
||
jobs: | ||
lighthouse: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Use Node.js 12.x | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12.x | ||
|
||
- name: Install and build | ||
run: | | ||
npm install | ||
npm run build | ||
- name: Audit with lighthouse CI | ||
uses: treosh/lighthouse-ci-action@v2 | ||
with: | ||
# Usa nuestra configuracion de Lighthouse CI para correr | ||
# nuestro propio servidor Node y hacer login con Puppeteer. | ||
# Lee más en: | ||
# LHCLI options https://github.com/GoogleChrome/lighthouse-ci/blob/master/docs/cli.md | ||
# treosh/lg-ci-action options https://github.com/marketplace/actions/lighthouse-ci-action | ||
runs: 1 | ||
urls: 'http://localhost:3000' | ||
configPath: './.github/workflows/setup/lighthouse-audit.json' | ||
uploadArtifacts: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"ci": { | ||
"collect": { | ||
"startServerCommand": "npm start", | ||
"startServerReadyPattern": "micro", | ||
"puppeteerScript": "./.github/workflows/setup/puppeteer-login.js", | ||
"settings": { | ||
"disableStorageReset": true | ||
} | ||
}, | ||
"assert": { | ||
"assertions": { | ||
"categories:performance": ["error", { "minScore": 0.8 }], | ||
"first-contentful-paint": ["error", { "maxNumericValue": 1000 }], | ||
"interactive": ["error", { "maxNumericValue": 1500 }], | ||
"resource-summary:font:count": ["error", { "maxNumericValue": 1 }], | ||
"resource-summary:script:size": [ | ||
"error", | ||
{ "maxNumericValue": 150000 } | ||
], | ||
"resource-summary:stylesheet:size": [ | ||
"error", | ||
{ "maxNumericValue": 100000 } | ||
] | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* Login to our app | ||
* | ||
* Usa nuestra formulario login y espera | ||
* hasta que un item del carousel salvaje aparezca | ||
* <excited-pikachu.gif> | ||
* | ||
* @param {puppeteer.Browser} browser | ||
* @param {{url: string, options: LHCI.CollectCommand.Options}} context | ||
*/ | ||
async function login(browser, { url }) { | ||
const page = await browser.newPage() | ||
await page.goto(`${url}/login`) | ||
await page.type('input[type="email"]', 'mira@que.com') | ||
await page.type('input[type="password"]', 'bello') | ||
await page.click('button') | ||
await page.waitForSelector('.carousel-item') | ||
} | ||
|
||
module.exports = login |
Oops, something went wrong.