Skip to content

Commit

Permalink
Merge pull request #35 from treosh/next-fixes-iteration2
Browse files Browse the repository at this point in the history
Next fixes, iteration #2
  • Loading branch information
alekseykulikov authored Mar 11, 2020
2 parents 6033a25 + e0a1f72 commit 18edcf3
Show file tree
Hide file tree
Showing 49 changed files with 1,568 additions and 834 deletions.
4 changes: 2 additions & 2 deletions .github/lighthouse/budget.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
{
"resourceType": "script",
"budget": 50
"budget": 100
},
{
"resourceType": "stylesheet",
Expand All @@ -20,4 +20,4 @@
}
]
}
]
]
7 changes: 0 additions & 7 deletions .github/lighthouse/lighthouserc-static-dist-dir.json

This file was deleted.

3 changes: 3 additions & 0 deletions .github/lighthouse/lighthouserc-static-dist-dir.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ci:
collect:
staticDistDir: './script/static-website'
16 changes: 16 additions & 0 deletions .github/matchers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"problemMatcher": [
{
"owner": "lighthouse-ci-action",
"pattern": [
{
"regexp": "^(?:\\s+)?(.*)\\|(error|warning)\\|(.*)\\|(.*)$",
"file": 1,
"code": 2,
"severity": 3,
"message": 4
}
]
}
]
}
18 changes: 0 additions & 18 deletions .github/workflows/LHCI-advanced-config.yml

This file was deleted.

16 changes: 0 additions & 16 deletions .github/workflows/LHCI-assert-on-budget-github-notification.yml

This file was deleted.

17 changes: 0 additions & 17 deletions .github/workflows/LHCI-assert-on-budget-notification.yml

This file was deleted.

16 changes: 0 additions & 16 deletions .github/workflows/LHCI-assert-on-budget-slack-notification.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/LHCI-static-dist-dir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ jobs:
uses: ./
with:
# no urls needed, since it uses local folder to scan .html files
configPath: '.github/lighthouse/lighthouserc-static-dist-dir.json'
configPath: '.github/lighthouse/lighthouserc-static-dist-dir.yml'
19 changes: 0 additions & 19 deletions .github/workflows/LHCI-upload-artifact.yml

This file was deleted.

5 changes: 3 additions & 2 deletions .github/workflows/LHCI-upload-to-private-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ jobs:
with:
urls: |
https://treo.sh/
upload.serverBaseUrl: ${{ secrets.LHCI_SERVER }}
upload.token: ${{ secrets.LHCI_TOKEN }}
serverBaseUrl: ${{ secrets.LHCI_SERVER_BASE_URL }}
serverToken: ${{ secrets.LHCI_SERVER_TOKEN }}
uploadArtifacts: false
16 changes: 12 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,20 @@ python script/simple-server.py # start basic server in a separate tab
PAGE="src/" INPUT_URLS="http://localhost:3000/\$PAGE" INPUT_RUNS="1" node src/index.js

# run with a static dist dir
INPUT_CONFIGPATH=".github/lighthouse/lighthouserc-static-dist-dir.json" INPUT_RUNS="1" node src/index.js
INPUT_CONFIGPATH=".github/lighthouse/lighthouserc-static-dist-dir.yml" INPUT_RUNS="1" node src/index.js

# run with Slack integration
# some of env variables mocked from GitHub ENV - https://help.github.com/en/actions/automating-your-workflow-with-github-actions/using-environment-variables
INPUT_URLS="https://alekseykulikov.com/" INPUT_BUDGETPATH=".github/lighthouse/impossible-budget.json" INPUT_RUNS="1" INPUT_SLACKWEBHOOKURL="custom-webhook-url" INPUT_PERSONALGITHUBTOKEN="github-token" INPUT_APPLICATIONGITHUBTOKEN="github-token" INPUT_NOTIFICATIONS='slack' GITHUB_REPOSITORY="repo-name" GITHUB_SHA="githib-pr-head-sha" node src/index.js
INPUT_URLS="https://alekseykulikov.com/" INPUT_BUDGETPATH=".github/lighthouse/impossible-budget.json" INPUT_RUNS="1" INPUT_SLACKWEBHOOKURL="custom-webhook-url" INPUT_PERSONALGITHUBTOKEN="github-github" INPUT_APPLICATIONGITHUBTOKEN="github-token" INPUT_NOTIFICATIONS='slack' GITHUB_REPOSITORY="repo-name" GITHUB_SHA="githib-pr-head-sha" node src/index.js
INPUT_URLS="https://alekseykulikov.com/" INPUT_BUDGETPATH=".github/lighthouse/impossible-budget.json" INPUT_RUNS="1" INPUT_SLACKWEBHOOKURL="custom-webhook-url" INPUT_GISTUPLOADTOKEN="github-token" INPUT_GITHUBTOKEN="github-token" INPUT_NOTIFICATIONS='slack' GITHUB_REPOSITORY="repo-name" GITHUB_SHA="githib-pr-head-sha" node src/index.js
INPUT_URLS="https://alekseykulikov.com/" INPUT_BUDGETPATH=".github/lighthouse/impossible-budget.json" INPUT_RUNS="1" INPUT_SLACKWEBHOOKURL="custom-webhook-url" INPUT_GISTUPLOADTOKEN="github-github" INPUT_GITHUBTOKEN="github-token" INPUT_NOTIFICATIONS='slack' GITHUB_REPOSITORY="repo-name" GITHUB_SHA="githib-pr-head-sha" node src/index.js
```

### Slack notification

> INPUT_APPLICATIONGITHUBTOKEN requers setup a Github Application etc.
Images and failure/warning images are stored in (assets)[./assets] folder. Original SVGs are downloaded from https://feathericons.com/, like all Github Action icons.

```js
GITHUB_REPOSITORY=treosh/lighthouse-ci-action GITHUB_ACTION=build GITHUB_ACTOR=alekseykulikov node -e "require('./src/utils/slack').sendSlackNotification({ resultsPath: '/Users/aleksey/code/treosh/website/.lighthouseci', slackWebhookUrl: 'https://hooks.slack.com/..' })"
```

Use Block Kit Builder to design the notification, [current version](<https://api.slack.com/tools/block-kit-builder?mode=message&blocks=%5B%7B%22type%22%3A%22section%22%2C%22text%22%3A%7B%22type%22%3A%22mrkdwn%22%2C%22text%22%3A%22Failed%20to%20check%20assertions%20against%20of%202%20URLs.%5Cn%5Cn%20Action%3A%20%3Chttps%3A%2F%2Fgithub.com%2Ftreosh%2Flighthouse-ci-action%2Fruns%2F490360861%20%7C%20CI%2Fbuild%20%2345%3E%5CnRepository%3A%20%3Chttps%3A%2F%2Fgithub.com%2Ftreosh%2Flighthouse-ci-action%20%7C%20treosh%2Flighthouse-ci-action%20(master)%3E%5CnAuthor%3A%20alekseykulikov%22%7D%7D%2C%7B%22type%22%3A%22divider%22%7D%2C%7B%22type%22%3A%22section%22%2C%22text%22%3A%7B%22type%22%3A%22mrkdwn%22%2C%22text%22%3A%222%20results%20for%20https%3A%2F%2Ftreo.sh%2F%22%7D%2C%22accessory%22%3A%7B%22type%22%3A%22button%22%2C%22text%22%3A%7B%22type%22%3A%22plain_text%22%2C%22text%22%3A%22View%20Report%22%2C%22emoji%22%3Atrue%7D%2C%22url%22%3A%22https%3A%2F%2Ftreo.sh%2F%22%7D%7D%2C%7B%22type%22%3A%22section%22%2C%22text%22%3A%7B%22type%22%3A%22mrkdwn%22%2C%22text%22%3A%22*offscreen-images*%20failure%20for%20*maxLength*%20assertion%5CnDefer%20offscreen%20images%20%3Chttps%3A%2F%2Fweb.dev%2Foffscreen-images%20%7C%20%5B...%5D%3E%5CnExpected%20*%3C%3D%200*%2C%20but%20found%20*1*%22%7D%2C%22accessory%22%3A%7B%22type%22%3A%22image%22%2C%22image_url%22%3A%22https%3A%2F%2Fuser-images.githubusercontent.com%2F158189%2F76324191-ef4c2880-62e5-11ea-8bf1-ac5ff7571eef.png%22%2C%22alt_text%22%3A%22failure%22%7D%7D%2C%7B%22type%22%3A%22section%22%2C%22text%22%3A%7B%22type%22%3A%22mrkdwn%22%2C%22text%22%3A%22*max-potential-fid*%20warning%20for%20*minScore*%20assertion%5CnMax%20Potential%20First%20Input%20Delay%20%3Chttps%3A%2F%2Fdevelopers.google.com%2Fweb%2Fupdates%2F2018%2F05%2Ffirst-input-delay%20%7C%20%5B...%5D%3E%5CnExpected%20*%20%3E%3D%200.8*%2C%20but%20found%20*0.25*%22%7D%2C%22accessory%22%3A%7B%22type%22%3A%22image%22%2C%22image_url%22%3A%22https%3A%2F%2Fuser-images.githubusercontent.com%2F158189%2F76411224-a356bd80-6391-11ea-8a58-8003213a7afa.png%22%2C%22alt_text%22%3A%22warning%22%7D%7D%2C%7B%22type%22%3A%22divider%22%7D%2C%7B%22type%22%3A%22section%22%2C%22text%22%3A%7B%22type%22%3A%22mrkdwn%22%2C%22text%22%3A%221%20result%20for%20https%3A%2F%2Ftreo.sh%2Fpricing%22%7D%2C%22accessory%22%3A%7B%22type%22%3A%22button%22%2C%22text%22%3A%7B%22type%22%3A%22plain_text%22%2C%22text%22%3A%22View%20Report%22%2C%22emoji%22%3Atrue%7D%2C%22url%22%3A%22https%3A%2F%2Ftreo.sh%2Fpricing%22%7D%7D%2C%7B%22type%22%3A%22section%22%2C%22text%22%3A%7B%22type%22%3A%22mrkdwn%22%2C%22text%22%3A%22*uses-passive-event-listeners*%20warning%20for%20*minScore*%20assertion%5CnDoes%20not%20use%20passive%20listeners%20to%20improve%20scrolling%20performance%20%3Chttps%3A%2F%2Fweb.dev%2Fuses-passive-event-listeners%20%7C%20%5B...%5D%3E%5CnExpected%20*%20%3E%3D%201*%2C%20but%20found%20*0*%22%7D%2C%22accessory%22%3A%7B%22type%22%3A%22image%22%2C%22image_url%22%3A%22https%3A%2F%2Fuser-images.githubusercontent.com%2F158189%2F76411224-a356bd80-6391-11ea-8a58-8003213a7afa.png%22%2C%22alt_text%22%3A%22warning%22%7D%7D%5D>)
Loading

0 comments on commit 18edcf3

Please sign in to comment.