lighthouse-badges 1.1.19 → 1.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/{build-test-deploy.yml → build.yml} +54 -15
- package/Dockerfile +1 -1
- package/README.md +2 -2
- package/package.json +12 -14
- package/src/calculations.js +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
name:
|
|
1
|
+
name: build
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
@@ -6,14 +6,29 @@ on:
|
|
|
6
6
|
- master
|
|
7
7
|
pull_request:
|
|
8
8
|
|
|
9
|
+
env:
|
|
10
|
+
TAG_PREFIX: emazzotta/lighthouse-badges
|
|
11
|
+
|
|
9
12
|
jobs:
|
|
10
|
-
build
|
|
11
|
-
name: "Build, Test & Deploy"
|
|
13
|
+
build:
|
|
12
14
|
runs-on: ubuntu-latest
|
|
13
15
|
steps:
|
|
14
16
|
- name: Checkout
|
|
15
17
|
uses: actions/checkout@v2
|
|
16
18
|
|
|
19
|
+
- name: Set up Docker Context for Buildx
|
|
20
|
+
id: buildx-context
|
|
21
|
+
run: docker context create builders
|
|
22
|
+
|
|
23
|
+
- name: Set up QEMU
|
|
24
|
+
uses: docker/setup-qemu-action@v1
|
|
25
|
+
|
|
26
|
+
- name: Set up Docker Buildx
|
|
27
|
+
uses: docker/setup-buildx-action@v1
|
|
28
|
+
with:
|
|
29
|
+
version: latest
|
|
30
|
+
endpoint: builders
|
|
31
|
+
|
|
17
32
|
- name: Versions
|
|
18
33
|
run: |
|
|
19
34
|
echo "node: $(node -v)"
|
|
@@ -22,24 +37,36 @@ jobs:
|
|
|
22
37
|
|
|
23
38
|
- name: NPM Build
|
|
24
39
|
run: |
|
|
25
|
-
|
|
26
|
-
|
|
40
|
+
npm install
|
|
41
|
+
npm run lint
|
|
42
|
+
|
|
43
|
+
- name: Login to DockerHub
|
|
44
|
+
if: github.ref == 'refs/heads/master'
|
|
45
|
+
uses: docker/login-action@v1
|
|
46
|
+
with:
|
|
47
|
+
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
48
|
+
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
27
49
|
|
|
28
50
|
- name: Docker Build
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
51
|
+
uses: docker/build-push-action@v2
|
|
52
|
+
with:
|
|
53
|
+
context: .
|
|
54
|
+
file: ./Dockerfile
|
|
55
|
+
tags: ${{ env.TAG_PREFIX }}:latest
|
|
56
|
+
cache-from: type=gha
|
|
57
|
+
cache-to: type=gha,mode=max
|
|
58
|
+
platforms: linux/amd64,linux/arm64
|
|
32
59
|
|
|
33
60
|
- name: Unit & Integration Test
|
|
34
61
|
run: |
|
|
35
|
-
|
|
62
|
+
npm run test
|
|
36
63
|
bash <(curl -s https://codecov.io/bash)
|
|
37
64
|
|
|
38
65
|
- name: Node System Test
|
|
39
|
-
run:
|
|
66
|
+
run: npm run system-test:light-run
|
|
40
67
|
|
|
41
68
|
- name: Docker System Test
|
|
42
|
-
run:
|
|
69
|
+
run: npm run docker:system-test:run
|
|
43
70
|
|
|
44
71
|
- name: Deploy to Github Registry
|
|
45
72
|
if: github.ref == 'refs/heads/master'
|
|
@@ -68,9 +95,21 @@ jobs:
|
|
|
68
95
|
env:
|
|
69
96
|
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
|
|
70
97
|
|
|
98
|
+
- name: Set Environment Variables
|
|
99
|
+
run: |
|
|
100
|
+
echo "GIT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
|
|
101
|
+
|
|
71
102
|
- name: Deploy to Dockerhub
|
|
72
103
|
if: github.ref == 'refs/heads/master'
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
104
|
+
uses: docker/build-push-action@v2
|
|
105
|
+
with:
|
|
106
|
+
context: .
|
|
107
|
+
file: ./Dockerfile
|
|
108
|
+
push: true
|
|
109
|
+
tags: |
|
|
110
|
+
${{ env.TAG_PREFIX }}:${{ env.GIT_SHA }}
|
|
111
|
+
${{ env.TAG_PREFIX }}:latest
|
|
112
|
+
cache-from: type=gha
|
|
113
|
+
cache-to: type=gha,mode=max
|
|
114
|
+
platforms: linux/amd64,linux/arm64
|
|
115
|
+
|
package/Dockerfile
CHANGED
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[](https://github.com/emazzotta/lighthouse-badges/actions)
|
|
2
2
|
[](https://github.com/emazzotta/lighthouse-badges/actions)
|
|
3
3
|
[](https://www.npmjs.org/package/lighthouse-badges)
|
|
4
4
|
[](https://www.npmjs.org/package/lighthouse-badges)
|
|
@@ -64,7 +64,7 @@ lighthouse-badges --urls https://www.youtube.com/
|
|
|
64
64
|
|
|
65
65
|
### Run
|
|
66
66
|
|
|
67
|
-
Hint: node
|
|
67
|
+
Hint: Only node >= 12 is supported.
|
|
68
68
|
|
|
69
69
|
#### Option 1: npm
|
|
70
70
|
```bash
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lighthouse-badges",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.22",
|
|
4
4
|
"description": "🚦Generate gh-badges (shields.io) based on Lighthouse performance.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -9,8 +9,6 @@
|
|
|
9
9
|
"scripts": {
|
|
10
10
|
"clean": "rm -f *.svg *.html",
|
|
11
11
|
"docker:build": "docker build --build-arg VCS_REF=`git rev-parse --short HEAD` --build-arg BUILD_DATE=`date -u +\"%Y-%m-%dT%H:%M:%SZ\"` --build-arg VERSION=latest -t emazzotta/lighthouse-badges .",
|
|
12
|
-
"docker:pull": "docker pull emazzotta/lighthouse-badges",
|
|
13
|
-
"docker:push": "docker push emazzotta/lighthouse-badges",
|
|
14
12
|
"docker:system-test:run": "docker run emazzotta/lighthouse-badges /bin/sh -c 'lighthouse-badges -rsu https://google.com && EXEC_PATH=/home/chrome/reports npm run system-test:verify --prefix /home/lighthouse'",
|
|
15
13
|
"lint": "eslint .",
|
|
16
14
|
"lint:fix": "eslint --fix .",
|
|
@@ -44,21 +42,21 @@
|
|
|
44
42
|
"argparse": "2.0.1",
|
|
45
43
|
"badge-maker": "^3.3.1",
|
|
46
44
|
"clui": "^0.3.6",
|
|
47
|
-
"lighthouse": "^9.
|
|
45
|
+
"lighthouse": "^9.6.2",
|
|
48
46
|
"ramda": "^0.28.0"
|
|
49
47
|
},
|
|
50
48
|
"devDependencies": {
|
|
51
|
-
"@babel/core": "^7.
|
|
52
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
53
|
-
"@babel/preset-env": "^7.
|
|
54
|
-
"@babel/runtime": "^7.
|
|
55
|
-
"babel-jest": "^
|
|
56
|
-
"eslint": "^8.
|
|
49
|
+
"@babel/core": "^7.18.2",
|
|
50
|
+
"@babel/plugin-transform-runtime": "^7.18.2",
|
|
51
|
+
"@babel/preset-env": "^7.18.2",
|
|
52
|
+
"@babel/runtime": "^7.18.3",
|
|
53
|
+
"babel-jest": "^28.1.1",
|
|
54
|
+
"eslint": "^8.17.0",
|
|
57
55
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
58
|
-
"eslint-plugin-import": "^2.
|
|
59
|
-
"husky": "^
|
|
60
|
-
"jest": "^
|
|
61
|
-
"lint-staged": "^
|
|
56
|
+
"eslint-plugin-import": "^2.26.0",
|
|
57
|
+
"husky": "^8.0.1",
|
|
58
|
+
"jest": "^28.1.1",
|
|
59
|
+
"lint-staged": "^13.0.1",
|
|
62
60
|
"npm-run-all": "^4.1.5"
|
|
63
61
|
},
|
|
64
62
|
"jest": {
|
package/src/calculations.js
CHANGED
|
@@ -21,7 +21,7 @@ const getSquashedScore = async (metrics) => ({
|
|
|
21
21
|
lighthouse: R.pipe(
|
|
22
22
|
R.map((metric) => R.sum(R.values(metric))),
|
|
23
23
|
R.sum,
|
|
24
|
-
|
|
24
|
+
(x) => (x / (R.length(metrics) * R.length(R.keys(R.head(metrics))))),
|
|
25
25
|
R.curry(Math.round),
|
|
26
26
|
)(metrics),
|
|
27
27
|
});
|