diff --git a/.chglog/CHANGELOG.tpl.md b/.chglog/CHANGELOG.tpl.md
new file mode 100755
index 0000000..cc0367b
--- /dev/null
+++ b/.chglog/CHANGELOG.tpl.md
@@ -0,0 +1,23 @@
+# Changelog
+
+{{ range .Versions -}}
+## {{ if .Tag.Previous }}[{{ .Tag.Name }}]({{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}){{ else }}{{ .Tag.Name }}{{ end }} ({{ datetime "2006-01-02" .Tag.Date }})
+
+{{ range .CommitGroups -}}
+### {{ .Title }}
+
+{{ range .Commits -}}
+- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ (regexReplaceAll "(.*)/issues/(.*)" (regexReplaceAll "(Co-\\w*-by.*)" .Subject "") "${1}/pulls/${2}") | trim }}
+{{ end }}
+{{- end -}}
+
+{{- if .NoteGroups -}}
+{{ range .NoteGroups -}}
+### {{ .Title }}
+
+{{ range .Notes }}
+{{ .Body }}
+{{ end }}
+{{ end -}}
+{{ end -}}
+{{ end -}}
diff --git a/.chglog/config.yml b/.chglog/config.yml
new file mode 100755
index 0000000..01b21dc
--- /dev/null
+++ b/.chglog/config.yml
@@ -0,0 +1,25 @@
+style: github
+template: CHANGELOG.tpl.md
+info:
+ title: CHANGELOG
+ repository_url: https://gitea.rknet.org/docker/lhci
+options:
+ commit_groups:
+ title_maps:
+ feat: Features
+ fix: Bug Fixes
+ perf: Performance Improvements
+ refactor: Code Refactoring
+ chore: Others
+ test: Testing
+ ci: CI Pipeline
+ docs: Documentation
+ header:
+ pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$"
+ pattern_maps:
+ - Type
+ - Scope
+ - Subject
+ notes:
+ keywords:
+ - BREAKING CHANGE
diff --git a/.drone.yml b/.drone.yml
index db8f725..94e4a4d 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -7,16 +7,16 @@ platform:
arch: amd64
steps:
-- name: markdownlint
- image: thegeeklab/markdownlint-cli
- commands:
- - markdownlint 'README.md'
+ - name: markdownlint
+ image: thegeeklab/markdownlint-cli
+ commands:
+ - markdownlint 'README.md'
trigger:
ref:
- - refs/heads/master
- - refs/pull/**
- - refs/tags/**
+ - refs/heads/main
+ - refs/pull/**
+ - refs/tags/**
---
kind: pipeline
@@ -27,97 +27,106 @@ platform:
arch: amd64
steps:
-- name: dryrun
- image: plugins/docker:19
- settings:
- build_args:
- - BUILD_VERSION=${DRONE_TAG%-*}
- dockerfile: Dockerfile
- dry_run: true
- password:
- from_secret: docker_password
- repo: thegeeklab/${DRONE_REPO_NAME}
- username:
- from_secret: docker_username
- when:
- ref:
- - refs/pull/**
+ - name: dryrun
+ image: thegeeklab/drone-docker-buildx:23
+ settings:
+ dockerfile: Dockerfile
+ dry_run: true
+ provenance: false
+ repo: thegeeklab/${DRONE_REPO_NAME}
+ when:
+ ref:
+ - refs/pull/**
-- name: tags
- image: thegeeklab/docker-autotag
- environment:
- DOCKER_AUTOTAG_FORCE_LATEST: True
- DOCKER_AUTOTAG_IGNORE_PRERELEASE: True
- DOCKER_AUTOTAG_OUTPUT_FILE: .tags
- DOCKER_AUTOTAG_VERSION: ${DRONE_TAG}
- when:
- ref:
- - refs/heads/master
- - refs/tags/**
- depends_on:
- - dryrun
+ - name: tags
+ image: thegeeklab/docker-autotag
+ environment:
+ DOCKER_AUTOTAG_FORCE_LATEST: True
+ DOCKER_AUTOTAG_IGNORE_PRERELEASE: True
+ DOCKER_AUTOTAG_OUTPUT_FILE: .tags
+ DOCKER_AUTOTAG_VERSION: ${DRONE_TAG}
+ when:
+ ref:
+ - refs/heads/main
+ - refs/tags/**
+ depends_on:
+ - dryrun
-- name: publish-dockerhub
- image: plugins/docker:19
- settings:
- build_args:
- - BUILD_VERSION=${DRONE_TAG%-*}
- dockerfile: Dockerfile
- password:
- from_secret: docker_password
- repo: thegeeklab/${DRONE_REPO_NAME}
- username:
- from_secret: docker_username
- when:
- ref:
- - refs/heads/master
- - refs/tags/**
- depends_on:
- - tags
+ - name: changelog-generate
+ image: thegeeklab/git-chglog
+ commands:
+ - git fetch -tq
+ - git-chglog --no-color --no-emoji -o CHANGELOG.md ${DRONE_TAG:---next-tag unreleased unreleased}
+ depends_on:
+ - tags
-- name: publish-quay
- image: plugins/docker:19
- settings:
- build_args:
- - BUILD_VERSION=${DRONE_TAG%-*}
- dockerfile: Dockerfile
- password:
- from_secret: quay_password
- registry: quay.io
- repo: quay.io/thegeeklab/${DRONE_REPO_NAME}
- username:
- from_secret: quay_username
- when:
- ref:
- - refs/heads/master
- - refs/tags/**
- depends_on:
- - tags
+ - name: changelog-format
+ image: thegeeklab/alpine-tools
+ commands:
+ - prettier CHANGELOG.md
+ - prettier -w CHANGELOG.md
+ depends_on:
+ - changelog-generate
-- name: publish-gitea
- image: plugins/gitea-release
- settings:
- api_key:
- from_secret: gitea_token
- base_url: https://gitea.rknet.org
- note: CHANGELOG.md
- overwrite: true
- title: ${DRONE_TAG}
- when:
- ref:
- - refs/tags/**
- depends_on:
- - publish-dockerhub
- - publish-quay
+ - name: publish-dockerhub
+ image: thegeeklab/drone-docker-buildx:23
+ settings:
+ dockerfile: Dockerfile
+ password:
+ from_secret: docker_password
+ provenance: false
+ repo: thegeeklab/${DRONE_REPO_NAME}
+ username:
+ from_secret: docker_username
+ when:
+ ref:
+ - refs/heads/main
+ - refs/tags/**
+ depends_on:
+ - changelog-format
+
+ - name: publish-quay
+ image: thegeeklab/drone-docker-buildx:23
+ settings:
+ dockerfile: Dockerfile
+ password:
+ from_secret: quay_password
+ provenance: false
+ registry: quay.io
+ repo: quay.io/thegeeklab/${DRONE_REPO_NAME}
+ username:
+ from_secret: quay_username
+ when:
+ ref:
+ - refs/heads/main
+ - refs/tags/**
+ depends_on:
+ - changelog-format
+
+ - name: publish-gitea
+ image: plugins/gitea-release
+ settings:
+ api_key:
+ from_secret: gitea_token
+ base_url: https://gitea.rknet.org
+ note: CHANGELOG.md
+ overwrite: true
+ title: ${DRONE_TAG}
+ when:
+ ref:
+ - refs/tags/**
+ depends_on:
+ - publish-dockerhub
+ - publish-quay
trigger:
ref:
- - refs/heads/master
- - refs/pull/**
- - refs/tags/**
+ - refs/heads/main
+ - refs/pull/**
+ - refs/tags/**
depends_on:
-- test
+ - test
---
kind: pipeline
@@ -128,63 +137,61 @@ platform:
arch: amd64
steps:
-- name: pushrm-dockerhub
- pull: always
- image: chko/docker-pushrm:1
- environment:
- DOCKER_PASS:
- from_secret: docker_password
- DOCKER_USER:
- from_secret: docker_username
- PUSHRM_FILE: README.md
- PUSHRM_SHORT: Custom image for lighthouse-ci
- PUSHRM_TARGET: thegeeklab/${DRONE_REPO_NAME}
- when:
- status:
- - success
+ - name: pushrm-dockerhub
+ image: chko/docker-pushrm:1
+ environment:
+ DOCKER_PASS:
+ from_secret: docker_password
+ DOCKER_USER:
+ from_secret: docker_username
+ PUSHRM_FILE: README.md
+ PUSHRM_SHORT: Custom image for lighthouse-ci
+ PUSHRM_TARGET: thegeeklab/${DRONE_REPO_NAME}
+ when:
+ status:
+ - success
-- name: pushrm-quay
- pull: always
- image: chko/docker-pushrm:1
- environment:
- APIKEY__QUAY_IO:
- from_secret: quay_token
- PUSHRM_FILE: README.md
- PUSHRM_TARGET: quay.io/thegeeklab/${DRONE_REPO_NAME}
- when:
- status:
- - success
+ - name: pushrm-quay
+ image: chko/docker-pushrm:1
+ environment:
+ APIKEY__QUAY_IO:
+ from_secret: quay_token
+ PUSHRM_FILE: README.md
+ PUSHRM_TARGET: quay.io/thegeeklab/${DRONE_REPO_NAME}
+ when:
+ status:
+ - success
-- name: matrix
- image: plugins/matrix
- settings:
- homeserver:
- from_secret: matrix_homeserver
- password:
- from_secret: matrix_password
- roomid:
- from_secret: matrix_roomid
- template: "Status: **{{ build.status }}**
Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}
Message: {{ build.message }}"
- username:
- from_secret: matrix_username
- when:
- status:
- - success
- - failure
+ - name: matrix
+ image: thegeeklab/drone-matrix
+ settings:
+ homeserver:
+ from_secret: matrix_homeserver
+ password:
+ from_secret: matrix_password
+ roomid:
+ from_secret: matrix_roomid
+ template: "Status: **{{ .Build.Status }}**
Build: [{{ .Repo.Owner }}/{{ .Repo.Name }}]({{ .Build.Link }}){{ if .Build.Branch }} ({{ .Build.Branch }}){{ end }} by {{ .Commit.Author }}
Message: {{ .Commit.Message.Title }}"
+ username:
+ from_secret: matrix_username
+ when:
+ status:
+ - success
+ - failure
trigger:
ref:
- - refs/heads/master
- - refs/tags/**
+ - refs/heads/main
+ - refs/tags/**
status:
- - success
- - failure
+ - success
+ - failure
depends_on:
-- build-container
+ - build-container
---
kind: signature
-hmac: 6947fd2349103a32a9fe46e79d61751515b6c1b6e5b6ee4c45bd9421a25ae0f7
+hmac: 40c971d184c9d8e7749c0109daf8093e7d90caae2ed7fc42117901410e07212c
...
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..1b763b1
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+CHANGELOG.md
diff --git a/.prettierignore b/.prettierignore
index eef18b7..23a4f05 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -1 +1,3 @@
.drone.yml
+*.tpl.md
+LICENSE
diff --git a/CHANGELOG.md b/CHANGELOG.md
deleted file mode 100644
index 68c3ae2..0000000
--- a/CHANGELOG.md
+++ /dev/null
@@ -1,3 +0,0 @@
-- ENHANCEMENT
- - Update dependency mikefarah/yq to v4.1.0
- - Use `yq` native alternative syntax
diff --git a/Dockerfile b/Dockerfile
index fa6e0e9..473c648 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,5 +1,4 @@
-FROM node:10-alpine
-# due to https://github.com/http-party/http-server/issues/537
+FROM node:lts-bullseye-slim@sha256:009f925f64bfbf87c11a19809c4e6068aa2bb167083179990f52b197805b9dde
LABEL maintainer="Robert Kaussow "
LABEL org.opencontainers.image.authors="Robert Kaussow "
@@ -12,9 +11,9 @@ ARG BUILD_VERSION
ARG YQ_VERSION
# renovate: datasource=npm depName=@lhci/cli
-ENV LHCI_VERSION="${BUILD_VERSION:-0.6.1}"
+ENV LHCI_VERSION="${BUILD_VERSION:-0.12.0}"
# renovate: datasource=github-releases depName=mikefarah/yq
-ENV YQ_VERSION="${YQ_VERSION:-v4.1.0}"
+ENV YQ_VERSION="${YQ_VERSION:-v4.34.1}"
ENV LHCI_BASE_DIR=/drone/src \
FORCE_COLOR=true \
@@ -23,25 +22,17 @@ ENV LHCI_BASE_DIR=/drone/src \
ADD overlay/ /
-RUN apk --update add --virtual .build-deps curl && \
- echo @edge http://dl-cdn.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories && \
- echo @edge http://dl-cdn.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories && \
- apk update && \
- apk add --update --no-cache git chromium@edge jq && \
- curl -SsL -o /usr/local/bin/yq "https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64" && \
+RUN apt-get update && apt-get install -y git curl wget gnupg jq bash bc && \
+ curl -SsfL -o /usr/local/bin/yq "https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64" && \
chmod 755 /usr/local/bin/yq && \
+ wget -qO - "https://dl-ssl.google.com/linux/linux_signing_key.pub" | apt-key add - && \
+ echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | tee "/etc/apt/sources.list.d/google.list" && \
+ apt-get update && apt-get install --no-install-recommends -y google-chrome-stable && \
LHCI_VERSION="${LHCI_VERSION##v}" && \
- LHCI_MAJOR="${LHCI_VERSION%%.*}" && \
- if [ -z "${LHCI_MAJOR//[0-9]}" ] && [ -n "$LHCI_MAJOR" ]; then \
- echo "Installing lhci version '$LHCI_VERSION' ..." && \
- npm install -g @lhci/cli@"$LHCI_VERSION"; \
- else \
- echo "Installing latest lhci ..." && \
- npm install -g @lhci/cli; \
- fi && \
+ echo "Installing lhci version '$LHCI_VERSION' ..." && \
+ npm install -g @lhci/cli@"$LHCI_VERSION"; \
npm install -g lighthouse && \
- apk del .build-deps && \
- rm -rf /var/cache/apk/* && \
+ rm -rf /var/lib/apt/lists/* && \
rm -rf /tmp/* && \
rm -rf /root/.cache/
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..3812eb4
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2022 Robert Kaussow
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is furnished
+to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice (including the next
+paragraph) shall be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/README.md b/README.md
index 99391d8..d4faeab 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@ Custom image for lighthouse-ci
[![Docker Hub](https://img.shields.io/badge/dockerhub-latest-blue.svg?logo=docker&logoColor=white)](https://hub.docker.com/r/thegeeklab/lhci)
[![Quay.io](https://img.shields.io/badge/quay-latest-blue.svg?logo=docker&logoColor=white)](https://quay.io/repository/thegeeklab/lhci)
[![Source: Gitea](https://img.shields.io/badge/source-gitea-blue.svg?logo=gitea&logoColor=white)](https://gitea.rknet.org/docker/lhci)
-[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://gitea.rknet.org/docker/lhci/src/branch/master/LICENSE)
+[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://gitea.rknet.org/docker/lhci/src/branch/main/LICENSE)
Custom wrapper Docker image for [lighthouse-ci](https://github.com/GoogleChrome/lighthouse-ci).
@@ -88,4 +88,4 @@ docker build -t lhci:latest .
## License
-This project is licensed under the MIT License - see the [LICENSE](https://gitea.rknet.org/docker/lhci/src/branch/master/LICENSE) file for details.
+This project is licensed under the MIT License - see the [LICENSE](https://gitea.rknet.org/docker/lhci/src/branch/main/LICENSE) file for details.
diff --git a/overlay/usr/bin/lhci b/overlay/usr/bin/lhci
index 0aa3d25..bd70ba8 100755
--- a/overlay/usr/bin/lhci
+++ b/overlay/usr/bin/lhci
@@ -1,4 +1,4 @@
-#!/usr/bin/env sh
+#!/usr/bin/env bash
set -eo pipefail
CONFIG="${LHCI_BASE_DIR%/}/.lighthouserc.yml"
@@ -10,16 +10,16 @@ if [ -f "$CONFIG" ] && echo "$OUT" | grep -q "Done running Lighthouse"; then
UPLOAD_TARGET=$(yq e '.ci.upload.target // ""' "${CONFIG}")
UPLOAD_OUTPUT_DIR=$(yq e '.ci.upload.outputDir // ""' "${CONFIG}")
- if [ "${UPLOAD_TARGET}" = "filesystem" ] && [ -n "${UPLOAD_OUTPUT_DIR}" ] ; then
+ if [ "${UPLOAD_TARGET}" = "filesystem" ] && [ -n "${UPLOAD_OUTPUT_DIR}" ]; then
MANIFEST=${UPLOAD_OUTPUT_DIR%/}/manifest.json
DIST="${LHCI_BASE_DIR%/}/${UPLOAD_OUTPUT_DIR%/}/dist"
mkdir -p "${DIST}"
if [ -f "$CONFIG" ]; then
- cp /templates/summary.md "${DIST}/summary.md"
+ cp /templates/summary.md "${DIST}/summary.md"
printf "\nPost-process report files...\n"
- for ITEM in $(jq -r '.[] | select( .isRepresentativeRun == true ) | @base64' < "${MANIFEST}"); do
+ for ITEM in $(jq -r '.[] | select( .isRepresentativeRun == true ) | @base64' <"${MANIFEST}"); do
JSON=$(echo "${ITEM}" | base64 -d)
FILE_DATE=$(date '+%Y%m%d%H%M')
@@ -38,7 +38,7 @@ if [ -f "$CONFIG" ] && echo "$OUT" | grep -q "Done running Lighthouse"; then
cp "${FILENAME}" "${DIST}/${FILENAME_NEW}.html"
echo "Report for ${URL} will be uploaded to ${DOWNLOAD}"
- echo "| [Link]("${DOWNLOAD}") | \`${URL}\` | $(echo "scale=0;($PERF*100)/1" | bc) % | $(echo "scale=0;($ACCESS*100)/1" | bc) % | $(echo "scale=0;($PRACTICE*100)/1" | bc) % | $(echo "scale=0;($SEO*100)/1" | bc) % | $(echo "scale=0;($PWA*100)/1" | bc) % |" >> "${DIST}/summary.md"
+ echo "| [Link](${DOWNLOAD}) | \`${URL}\` | $(echo "scale=0;($PERF*100)/1" | bc) % | $(echo "scale=0;($ACCESS*100)/1" | bc) % | $(echo "scale=0;($PRACTICE*100)/1" | bc) % | $(echo "scale=0;($SEO*100)/1" | bc) % | $(echo "scale=0;($PWA*100)/1" | bc) % |" >>"${DIST}/summary.md"
done
else
printf "\nPost-processing skipped. Manifest not found!\n"
diff --git a/overlay/usr/bin/lhci-official b/overlay/usr/bin/lhci-official
index 0898f89..acf5f02 100755
--- a/overlay/usr/bin/lhci-official
+++ b/overlay/usr/bin/lhci-official
@@ -1,4 +1,4 @@
-#!/usr/bin/env sh
+#!/usr/bin/env bash
set -eo pipefail
exec /usr/local/bin/lhci "$@"
diff --git a/renovate.json b/renovate.json
index f9b373d..5f02575 100644
--- a/renovate.json
+++ b/renovate.json
@@ -1,16 +1,4 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
- "extends": ["config:base"],
- "ignorePresets": [":prHourlyLimit2"],
- "regexManagers": [
- {
- "fileMatch": ["^Dockerfile$"],
- "matchStrings": [
- "# renovate: datasource=(?\\S+) depName=(?\\S+)( versioning=(?.*?))?\\nENV .*?_VERSION=\"\\${.*:-(?.*)}\"\\s"
- ]
- }
- ],
- "droneci": {
- "enabled": false
- }
+ "extends": ["github>thegeeklab/renovate-presets:docker"]
}