Skip to content

Commit 7450842

Browse files
committed
chore: initial commit
0 parents  commit 7450842

17 files changed

+5994
-0
lines changed

.dockerignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
.idea
2+
.github
3+
.vscode
4+
.git
5+
.*ignore
6+
.releaserc
7+
.*.{yaml,yml}
8+
.*.txt
9+
.*.cache
10+
*.dist.php
11+
*.xml.dist
12+
.pre-commit*.yaml
13+
.env*
14+
.env.template
15+
Makefile
16+
Dockerfile
17+
/bin/*.sh
18+
docker/resources
19+
docker/compose.yaml
20+
*compose-override.yaml
21+
config/k8s
22+
config/ssl
23+
README.md
24+
LICENSE
25+
/secrets
26+
/docs
27+
/tests
28+
/scripts
29+
/node_modules

.github/AUTHORS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# As the admin and steward of the project, FMJdev "owns" all code
2+
* @FMJdev

.github/CODEOWNERS

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This is the list of LHCI' significant contributors.
2+
#
3+
# This does not necessarily list everyone who has contributed code,
4+
# especially since many employees of one corporation may be contributing.
5+
# To see the full list of contributors, see the revision history in
6+
# source control.
7+
#
8+
# This file is currently manually managed.
9+
10+
FMJdev <info@fmj.dev>

.github/linters/.markdown-lint.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Markdownlint configuration file
2+
# ref: https://github.com/DavidAnson/markdownlint/blob/b2305efafb034b1f328845aec9928b5363ffd646/schema/.markdownlint.yaml
3+
4+
# MD013/line-length : Line length : https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md013.md
5+
MD013:
6+
# Number of characters
7+
line_length: 240
8+
# Number of characters for headings
9+
heading_line_length: 300
10+
# Number of characters for code blocks
11+
code_block_line_length: 120
12+
# Include code blocks
13+
code_blocks: true
14+
# Include headings
15+
headings: true
16+
# Exclude Tables
17+
tables: false
18+
19+
# MD033/no-inline-html : Inline HTML : https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md033.md
20+
MD033:
21+
# Allowed elements
22+
allowed_elements: ["img", "a"]
23+
24+
# MD034/no-bare-urls : Bare URL used : https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md034.md
25+
# NOTE: disabled because the tables in the READMEs might contain chart values which are bare URLs
26+
MD034: false
27+
28+
# MD036/no-emphasis-as-heading : Emphasis used instead of a heading : https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md036.md
29+
MD036:
30+
# Punctuation characters
31+
punctuation: ".,;:!?。,;:!?"

.github/workflows/superlint.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: 'Run Super-Linter'
2+
3+
on: ['push', 'pull_request']
4+
5+
permissions: read-all
6+
7+
jobs:
8+
lint:
9+
name: Super-Lint
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
packages: read
14+
statuses: write
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
# super-linter needs the full git history to get the
20+
# list of files that changed across commits
21+
fetch-depth: 0
22+
23+
- name: Superlinter
24+
uses: super-linter/super-linter@v7.1.0
25+
env:
26+
DEFAULT_BRANCH: main
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
VALIDATE_JSCPD: false

.gitignore

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# IntelliJ IDEA
4+
.idea/
5+
6+
# JetBrains Fleet
7+
.fleet/
8+
9+
# VS Code
10+
.vscode/
11+
12+
# dependencies
13+
/node_modules
14+
/.pnp
15+
.pnp.js
16+
.yarn/install-state.gz
17+
18+
# testing
19+
/coverage
20+
21+
# next.js
22+
/.next/
23+
/out/
24+
25+
# production
26+
/build
27+
28+
# misc
29+
.DS_Store
30+
*.pem
31+
32+
# debug
33+
npm-debug.log*
34+
yarn-debug.log*
35+
yarn-error.log*
36+
37+
# env config
38+
.env*
39+
.*env
40+
!.env.template

.pre-commit-config.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
exclude: (.*.lock.json)
2+
repos:
3+
- repo: https://github.com/pre-commit/pre-commit-hooks
4+
rev: v2.3.0
5+
hooks:
6+
- id: check-yaml
7+
- id: end-of-file-fixer
8+
- id: trailing-whitespace
9+
- repo: https://github.com/markdownlint/markdownlint
10+
rev: v0.13.0
11+
hooks:
12+
- id: markdownlint
13+
args:
14+
- "-r ~MD013"
15+
- repo: https://github.com/rhysd/actionlint
16+
rev: v1.7.2
17+
hooks:
18+
- id: actionlint
19+
- repo: https://github.com/crate-ci/typos
20+
rev: v1.24.6
21+
hooks:
22+
- id: typos

.releaserc

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"branches": [
3+
"main",
4+
"next"
5+
],
6+
"plugins": [
7+
[
8+
"@semantic-release/commit-analyzer",
9+
{
10+
"preset": "conventionalcommits",
11+
"parserOpts": {
12+
"noteKeywords": [
13+
"BREAKING CHANGE",
14+
"BREAKING CHANGES",
15+
"BREAKING"
16+
]
17+
}
18+
}
19+
],
20+
[
21+
"@semantic-release/release-notes-generator",
22+
{
23+
"preset": "conventionalcommits",
24+
"parserOpts": {
25+
"noteKeywords": [
26+
"BREAKING CHANGE",
27+
"BREAKING CHANGES",
28+
"BREAKING"
29+
]
30+
}
31+
}
32+
],
33+
"@semantic-release/github",
34+
[
35+
"@semantic-release/changelog",
36+
{
37+
"changelogFile": "CHANGELOG.md"
38+
}
39+
],
40+
[
41+
"@semantic-release/git",
42+
{
43+
"assets": [
44+
"CHANGELOG.md"
45+
]
46+
}
47+
],
48+
"@semantic-release/npm"
49+
]
50+
}

Dockerfile

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
#syntax=docker/dockerfile:1.4
2+
3+
# Build arguments
4+
ARG VERSION=0.1.0
5+
ARG NODE_VERSION=20
6+
ARG APP_ENV=prod
7+
8+
# -------------------------------------
9+
# LHCI Base Image
10+
# -------------------------------------
11+
FROM node:${NODE_VERSION}-alpine as base
12+
13+
# container settings
14+
ARG PHP_VERSION
15+
ARG PUID=4501
16+
ARG PGID=4501
17+
ARG PORT=9001
18+
ARG USER=lhci
19+
20+
# persistent / runtime deps
21+
# hadolint ignore=DL3008
22+
RUN apk update && apk add --no-cache --update \
23+
python3=~3.12 \
24+
build-base=~0.5 \
25+
sqlite=~3.45 \
26+
yq=~4.44 \
27+
jq=~1.7 \
28+
trurl
29+
30+
# set default environment variables
31+
ENV PUID=${PUID} \
32+
PGID=${PGID} \
33+
PORT=${PORT} \
34+
APP_ENV=${APP_ENV}
35+
36+
RUN <<EOF
37+
mkdir -p /data
38+
chown -R ${PUID}:${PGID} /data
39+
EOF
40+
41+
COPY --chmod=755 docker/bin/lhctl /usr/local/bin
42+
COPY --chmod=755 docker/bin/lhci /usr/local/bin
43+
COPY --chmod=644 docker/lib/utils.sh /usr/local/lib
44+
45+
# -------------------------------------
46+
# LHCI Builder Image
47+
# -------------------------------------
48+
FROM base as builder
49+
50+
# (re)-set args
51+
ARG PUID
52+
ARG PGID
53+
54+
WORKDIR /app
55+
COPY package*.json ./
56+
RUN \
57+
--mount=type=secret,id=npm_auth,dst=./.npmrc \
58+
--mount=type=cache,target=/root/.npm \
59+
npm ci
60+
61+
# -------------------------------------
62+
# LHCI Runner Image
63+
# -------------------------------------
64+
FROM base as runner
65+
66+
# (re)-set args
67+
ARG PUID
68+
ARG PGID
69+
ARG USER
70+
ARG PORT
71+
72+
# create groups/users & give access to /data
73+
RUN \
74+
addgroup -g ${PGID} ${USER}; \
75+
adduser -D -u ${PUID} -G ${USER} ${USER}; \
76+
chown -R ${USER}:${USER} /data
77+
78+
# copy sources
79+
WORKDIR /app
80+
COPY --link --chown=${PUID}:${PGID} . ./
81+
COPY --from=builder --chown=${PUID}:${PGID} /app ./
82+
83+
# remove non-ignorable files
84+
RUN \
85+
rm -rf ./docker
86+
87+
# expose port 9001
88+
EXPOSE ${PORT}
89+
90+
# switch to the lhci user
91+
USER ${USER}
92+
93+
ENTRYPOINT [ "lhctl", "run" ]

README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Lighthouse CI Server <img src="https://raw.githubusercontent.com/GoogleChrome/lighthouse/refs/heads/main/assets/lighthouse-logo_512px.png" alt="Google Lighthouse Logo" align="right" height="auto" width="256"/>
2+
3+
[![License](https://img.shields.io/github/license/fmjstudios/lhci?label=License)](https://opensource.org/license/gpl-3-0)
4+
[![Language](https://img.shields.io/github/languages/top/fmjstudios/lchi?label=JavaScript&logo=javascript)](https://ecma-international.org/publications-and-standards/standards/ecma-262/)
5+
[![GitHub Release](https://img.shields.io/github/v/release/fmjstudios/lchi?label=Release)][github_releases]
6+
[![GitHub Activity](https://img.shields.io/github/commit-activity/m/fmjstudios/lchi?label=Commits)][github_commits]
7+
[![Renovate](https://img.shields.io/badge/Renovate-enabled-brightgreen?logo=renovate&logoColor=1A1F6C)][renovate]
8+
[![PreCommit](https://img.shields.io/badge/PreCommit-enabled-brightgreen?logo=precommit&logoColor=FAB040)][precommit]
9+
10+
**L**ight**h**ouse **CI** (or `LHCI`) is a [Node.js][node.js]-based server for the storage and review of [Google Lighthouse][lighthouse]
11+
report data. The server saves historical Lighthouse data displays it in various dashboards and offers and in-depth build comparison UI to
12+
uncover differences between CI builds. During CI we export the results to the `LHCI` server using a component capable of exporting it to
13+
`LHCI` like the [`lighthouse-ci-action`][lighthouse_ci_action] or different tools like [Unlighthouse][unlighthouse].
14+
15+
## ✨ TL;DR
16+
17+
```shell
18+
# run the latest LHCI image
19+
docker run -p 9000:9001 fmjstudios/lhci:latest
20+
```
21+
22+
### 🔃 Contributing
23+
24+
Refer to our [documentation for contributors][contributing] for contributing guidelines, commit message
25+
formats and versioning tips.
26+
27+
### 📥 Maintainers
28+
29+
This project is owned and maintained by [FMJ Studios][org] refer to the [`AUTHORS`][authors] or [`CODEOWNERS`][owners]
30+
for more information.
31+
32+
### ©️ Copyright
33+
34+
- _Assets provided by:_ **[Google Lighthouse][lighthouse]**
35+
- _Sources provided by:_ **[FMJ Studios][org]** under the **[GPL-3.0 License][license]**
36+
37+
<!-- INTERNAL REFERENCES -->
38+
39+
<!-- Project references -->
40+
41+
<!-- File references -->
42+
43+
[license]: LICENSE
44+
[contributing]: docs/CONTRIBUTING.md
45+
[authors]: .github/AUTHORS
46+
[owners]: .github/CODEOWNERS
47+
48+
<!-- General links -->
49+
50+
[org]: https://github.com/fmjstudios
51+
[node.js]: https://nodejs.org/
52+
[lighthouse]: https://github.com/GoogleChrome/lighthouse
53+
[lighthouse_ci_action]: https://github.com/treosh/lighthouse-ci-action
54+
[unlighthouse]: https://unlighthouse.dev/
55+
[github_releases]: https://github.com/fmjstudios/gopskit/releases
56+
[github_commits]: https://github.com/fmjstudios/gopskit/commits/main/
57+
58+
<!-- Third-party -->
59+
60+
[renovate]: https://renovatebot.com/
61+
[precommit]: https://pre-commit.com/

docker/bin/lhci

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env sh
2+
#
3+
# 'lhci' is a wrapper around the Node.js executable with the same name originating from the LHCI project.
4+
5+
# shellcheck disable=SC3040
6+
set -o errexit -o nounset -o pipefail
7+
8+
# shellcheck source=../lib/utils.sh
9+
. /usr/local/lib/utils.sh
10+
11+
ensure_project_root
12+
13+
"$(pwd)/node_modules/.bin/lhci" "$@"

0 commit comments

Comments
 (0)