@networkpro/web 1.14.0 → 1.14.2
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/.browserslistrc +5 -0
- package/.editorconfig +65 -0
- package/.env.template +18 -0
- package/.gitattributes +212 -0
- package/.github/COMMIT_GUIDE.md +31 -0
- package/.github/ISSUE_TEMPLATE/bug_report.yml +74 -0
- package/.github/ISSUE_TEMPLATE/config.yml +32 -0
- package/.github/ISSUE_TEMPLATE/feature_request.yml +35 -0
- package/.github/ISSUE_TEMPLATE/legal_review.yml +53 -0
- package/.github/workflows/auto-assign.yml +36 -0
- package/.github/workflows/backup-branch.yml +40 -0
- package/.github/workflows/build-and-publish.yml +220 -0
- package/.github/workflows/check-codeql.yml +42 -0
- package/.github/workflows/check-security-txt-expiry.yml +46 -0
- package/.github/workflows/dependency-review.yml +22 -0
- package/.github/workflows/lighthouse.yml +162 -0
- package/.github/workflows/playwright.yml +65 -0
- package/.github/workflows/publish-test.yml +218 -0
- package/.github/workflows/templates/check-codeql.template.yml +47 -0
- package/.github/workflows/templates/publish.template.yml +228 -0
- package/.lighthouserc.cjs +37 -0
- package/.markdownlint.mjs +31 -0
- package/.md-smart-quotes.js +31 -0
- package/.node-version +1 -0
- package/.nvmrc +1 -0
- package/.prettierignore +55 -0
- package/.prettierrc +35 -0
- package/.stylelintignore +43 -0
- package/.svelte-kit/tsconfig.json +49 -0
- package/.vscode/customData.json +73 -0
- package/.vscode/extensions.json +13 -0
- package/.vscode/extensions.jsonc +24 -0
- package/.vscode/settings.json +80 -0
- package/CHANGELOG.md +60 -1
- package/package.json +19 -19
- package/src/lib/components/ui/.gitkeep +0 -0
- package/src/routes/...404/+page.svelte +26 -0
- package/static/.well-known/dnt-policy.txt +218 -0
- package/static/.well-known/gpc.json +4 -0
- package/static/.well-known/humans.txt +21 -0
- package/static/.well-known/security.txt +12 -0
- package/static/.well-known/security.txt.sig +7 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
# .github/workflows/build-and-publish.yml
|
|
2
|
+
#
|
|
3
|
+
# Copyright © 2025 Network Pro Strategies (Network Pro™)
|
|
4
|
+
# SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
|
|
5
|
+
# This file is part of Network Pro
|
|
6
|
+
|
|
7
|
+
name: Build and Publish to Registries
|
|
8
|
+
|
|
9
|
+
on:
|
|
10
|
+
release:
|
|
11
|
+
types: [created]
|
|
12
|
+
workflow_dispatch:
|
|
13
|
+
|
|
14
|
+
# Allow one concurrent deployment
|
|
15
|
+
concurrency:
|
|
16
|
+
group: 'build-and-publish'
|
|
17
|
+
cancel-in-progress: true
|
|
18
|
+
|
|
19
|
+
permissions:
|
|
20
|
+
actions: read
|
|
21
|
+
contents: read
|
|
22
|
+
|
|
23
|
+
jobs:
|
|
24
|
+
check-codeql:
|
|
25
|
+
uses: ./.github/workflows/check-codeql.yml
|
|
26
|
+
|
|
27
|
+
build:
|
|
28
|
+
needs: check-codeql
|
|
29
|
+
runs-on: ubuntu-24.04
|
|
30
|
+
env:
|
|
31
|
+
ENV_MODE: ci
|
|
32
|
+
|
|
33
|
+
steps:
|
|
34
|
+
- name: Checkout repository
|
|
35
|
+
uses: actions/checkout@v4
|
|
36
|
+
|
|
37
|
+
- name: Set up Node.js
|
|
38
|
+
uses: actions/setup-node@v4
|
|
39
|
+
with:
|
|
40
|
+
node-version: 24
|
|
41
|
+
cache: npm
|
|
42
|
+
cache-dependency-path: package-lock.json
|
|
43
|
+
|
|
44
|
+
- name: Show Node.js and npm versions
|
|
45
|
+
run: |
|
|
46
|
+
echo "Node.js version: $(node -v)"
|
|
47
|
+
echo "npm version: $(npm -v)"
|
|
48
|
+
|
|
49
|
+
- name: Upgrade npm
|
|
50
|
+
run: |
|
|
51
|
+
corepack enable
|
|
52
|
+
npm install -g npm@11.4.2
|
|
53
|
+
|
|
54
|
+
- name: Install Node.js dependencies
|
|
55
|
+
run: npm ci
|
|
56
|
+
|
|
57
|
+
- name: Install jq
|
|
58
|
+
run: sudo apt-get install -y jq
|
|
59
|
+
|
|
60
|
+
- name: Run JSDoc lint check
|
|
61
|
+
id: jsdoc_lint
|
|
62
|
+
continue-on-error: true
|
|
63
|
+
run: |
|
|
64
|
+
set -e
|
|
65
|
+
output=$(npm run lint:jsdoc || true)
|
|
66
|
+
echo "$output" | tee jsdoc-lint-output.txt
|
|
67
|
+
|
|
68
|
+
count=$(echo "$output" | wc -l)
|
|
69
|
+
echo "jsdoc_count=$count" >> "$GITHUB_OUTPUT"
|
|
70
|
+
|
|
71
|
+
- name: ✅ Pass
|
|
72
|
+
if: steps.jsdoc_lint.outputs.jsdoc_count == '0'
|
|
73
|
+
run: echo "JSDoc lint passed successfully!"
|
|
74
|
+
|
|
75
|
+
- name: ⚠️ JSDoc violations detected (non-blocking)
|
|
76
|
+
if: steps.jsdoc_lint.outputs.jsdoc_count != '0'
|
|
77
|
+
run: |
|
|
78
|
+
echo "⚠️ JSDoc lint check failed with ${{ steps.jsdoc_lint.outputs.jsdoc_count }} violations (non-blocking)"
|
|
79
|
+
echo "--- JSDoc Violations ---"
|
|
80
|
+
cat jsdoc-lint-output.txt
|
|
81
|
+
|
|
82
|
+
# Test to ensure the package is working
|
|
83
|
+
- name: Build Node.js project
|
|
84
|
+
run: npm run build
|
|
85
|
+
|
|
86
|
+
# Create Git archive of version-controlled files
|
|
87
|
+
- name: Create clean source archive
|
|
88
|
+
run: git archive --format=tar.gz --output=clean-source.tar.gz HEAD
|
|
89
|
+
|
|
90
|
+
- name: Upload source archive
|
|
91
|
+
uses: actions/upload-artifact@v4
|
|
92
|
+
with:
|
|
93
|
+
name: clean-source
|
|
94
|
+
path: clean-source.tar.gz
|
|
95
|
+
|
|
96
|
+
publish-npmjs:
|
|
97
|
+
needs: build
|
|
98
|
+
runs-on: ubuntu-24.04
|
|
99
|
+
env:
|
|
100
|
+
ENV_MODE: ci
|
|
101
|
+
|
|
102
|
+
steps:
|
|
103
|
+
- name: Download clean source archive
|
|
104
|
+
uses: actions/download-artifact@v4
|
|
105
|
+
with:
|
|
106
|
+
name: clean-source
|
|
107
|
+
path: ./
|
|
108
|
+
|
|
109
|
+
- name: Extract source archive
|
|
110
|
+
run: tar -xzf clean-source.tar.gz
|
|
111
|
+
|
|
112
|
+
- name: Remove extracted source archive
|
|
113
|
+
run: rm clean-source.tar.gz
|
|
114
|
+
|
|
115
|
+
- name: Set up Node.js for npmjs
|
|
116
|
+
uses: actions/setup-node@v4
|
|
117
|
+
with:
|
|
118
|
+
node-version: 24
|
|
119
|
+
registry-url: https://registry.npmjs.org/
|
|
120
|
+
cache: npm
|
|
121
|
+
cache-dependency-path: package-lock.json
|
|
122
|
+
|
|
123
|
+
- name: Show Node.js and npm versions
|
|
124
|
+
run: |
|
|
125
|
+
echo "Node.js version: $(node -v)"
|
|
126
|
+
echo "npm version: $(npm -v)"
|
|
127
|
+
|
|
128
|
+
- name: Upgrade npm
|
|
129
|
+
run: |
|
|
130
|
+
corepack enable
|
|
131
|
+
npm install -g npm@11.4.2
|
|
132
|
+
|
|
133
|
+
- name: Install Node.js dependencies
|
|
134
|
+
run: npm ci
|
|
135
|
+
|
|
136
|
+
- name: Set up Git user
|
|
137
|
+
run: |
|
|
138
|
+
git config --global user.email "github@sl.neteng.cc"
|
|
139
|
+
git config --global user.name "SunDevil311"
|
|
140
|
+
|
|
141
|
+
- name: Verify version not already published
|
|
142
|
+
run: |
|
|
143
|
+
PACKAGE_NAME=$(node -p "require('./package.json').name")
|
|
144
|
+
PACKAGE_VERSION=$(node -p "require('./package.json').version")
|
|
145
|
+
echo "Checking if $PACKAGE_NAME@$PACKAGE_VERSION is already published..."
|
|
146
|
+
|
|
147
|
+
npm view $PACKAGE_NAME@$PACKAGE_VERSION > /dev/null && {
|
|
148
|
+
echo "❌ Version $PACKAGE_VERSION already exists on npm. Exiting..."
|
|
149
|
+
exit 1
|
|
150
|
+
} || echo "✅ Version is new. Proceeding with publish."
|
|
151
|
+
|
|
152
|
+
- name: Publish package to npmjs
|
|
153
|
+
run: npm publish --access public
|
|
154
|
+
env:
|
|
155
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_NETPRO }}
|
|
156
|
+
|
|
157
|
+
publish-gpr:
|
|
158
|
+
needs: build
|
|
159
|
+
runs-on: ubuntu-24.04
|
|
160
|
+
env:
|
|
161
|
+
ENV_MODE: ci
|
|
162
|
+
|
|
163
|
+
steps:
|
|
164
|
+
- name: Download clean source archive
|
|
165
|
+
uses: actions/download-artifact@v4
|
|
166
|
+
with:
|
|
167
|
+
name: clean-source
|
|
168
|
+
path: ./
|
|
169
|
+
|
|
170
|
+
- name: Extract source archive
|
|
171
|
+
run: tar -xzf clean-source.tar.gz
|
|
172
|
+
|
|
173
|
+
- name: Remove extracted source archive
|
|
174
|
+
run: rm clean-source.tar.gz
|
|
175
|
+
|
|
176
|
+
- name: Set up Node.js for GPR
|
|
177
|
+
uses: actions/setup-node@v4
|
|
178
|
+
with:
|
|
179
|
+
node-version: 24
|
|
180
|
+
registry-url: https://npm.pkg.github.com/
|
|
181
|
+
cache: npm
|
|
182
|
+
cache-dependency-path: package-lock.json
|
|
183
|
+
|
|
184
|
+
- name: Show Node.js and npm versions
|
|
185
|
+
run: |
|
|
186
|
+
echo "Node.js version: $(node -v)"
|
|
187
|
+
echo "npm version: $(npm -v)"
|
|
188
|
+
|
|
189
|
+
- name: Upgrade npm
|
|
190
|
+
run: |
|
|
191
|
+
corepack enable
|
|
192
|
+
npm install -g npm@11.4.2
|
|
193
|
+
|
|
194
|
+
- name: Install Node.js dependencies
|
|
195
|
+
run: npm ci
|
|
196
|
+
|
|
197
|
+
- name: Set up Git user
|
|
198
|
+
run: |
|
|
199
|
+
git config --global user.email "github@sl.neteng.cc"
|
|
200
|
+
git config --global user.name "SunDevil311"
|
|
201
|
+
|
|
202
|
+
- name: Update package name for GPR
|
|
203
|
+
run: |
|
|
204
|
+
sed -i 's/"name": ".*"/"name": "@netwk-pro\/web"/' package.json
|
|
205
|
+
|
|
206
|
+
- name: Verify version not already published
|
|
207
|
+
run: |
|
|
208
|
+
PACKAGE_NAME=$(node -p "require('./package.json').name")
|
|
209
|
+
PACKAGE_VERSION=$(node -p "require('./package.json').version")
|
|
210
|
+
echo "Checking if $PACKAGE_NAME@$PACKAGE_VERSION is already published..."
|
|
211
|
+
|
|
212
|
+
npm view $PACKAGE_NAME@$PACKAGE_VERSION > /dev/null && {
|
|
213
|
+
echo "❌ Version $PACKAGE_VERSION already exists on npm. Exiting..."
|
|
214
|
+
exit 1
|
|
215
|
+
} || echo "✅ Version is new. Proceeding with publish."
|
|
216
|
+
|
|
217
|
+
- name: Publish package to GPR
|
|
218
|
+
run: npm publish
|
|
219
|
+
env:
|
|
220
|
+
NODE_AUTH_TOKEN: ${{ secrets.NWPRO_GPR }}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# .github/workflows/check-codeql.template.yml
|
|
2
|
+
#
|
|
3
|
+
# Copyright © 2025 Network Pro Strategies (Network Pro™)
|
|
4
|
+
# SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
|
|
5
|
+
# This file is part of Network Pro
|
|
6
|
+
|
|
7
|
+
name: CodeQL Status Check
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
actions: read
|
|
11
|
+
contents: read
|
|
12
|
+
|
|
13
|
+
on:
|
|
14
|
+
workflow_call:
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
check:
|
|
18
|
+
name: Check CodeQL Status
|
|
19
|
+
runs-on: ubuntu-24.04
|
|
20
|
+
env:
|
|
21
|
+
ENV_MODE: ci
|
|
22
|
+
|
|
23
|
+
steps:
|
|
24
|
+
- name: Check CodeQL Workflow
|
|
25
|
+
env:
|
|
26
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
27
|
+
run: |
|
|
28
|
+
gh --version
|
|
29
|
+
|
|
30
|
+
if ! gh run list --repo "${GITHUB_REPOSITORY}" --workflow "CodeQL" --limit 1 --json conclusion --jq '.[0].conclusion' > codeql_status.txt; then
|
|
31
|
+
echo "::error title=CodeQL Check Failed::Could not retrieve CodeQL run status. Blocking deployment."
|
|
32
|
+
exit 1
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
CODEQL_STATUS=$(cat codeql_status.txt)
|
|
36
|
+
echo "CodeQL status: $CODEQL_STATUS"
|
|
37
|
+
if [[ "$CODEQL_STATUS" != "success" ]]; then
|
|
38
|
+
echo "::error title=CodeQL Check Failed::Latest CodeQL run did not succeed. Blocking deployment."
|
|
39
|
+
exit 1
|
|
40
|
+
fi
|
|
41
|
+
|
|
42
|
+
rm -f codeql_status.txt
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
name: Check security.txt expiry
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
schedule:
|
|
5
|
+
- cron: '0 7 * * 0' # Every Sunday at 0700 UTC (midnight MST)
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
check-expiry:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
name: Validate .well-known/security.txt expiration
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- name: Checkout repo
|
|
18
|
+
uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Check security.txt expiration
|
|
21
|
+
run: |
|
|
22
|
+
FILE="static/.well-known/security.txt"
|
|
23
|
+
if [ ! -f "$FILE" ]; then
|
|
24
|
+
echo "::error ::security.txt file not found!"
|
|
25
|
+
exit 1
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
EXP_DATE=$(grep -i '^Expires:' "$FILE" | cut -d' ' -f2- | tr -d '\r')
|
|
29
|
+
if [ -z "$EXP_DATE" ]; then
|
|
30
|
+
echo "::error ::Expires field not found in security.txt"
|
|
31
|
+
exit 1
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
EXP_TIMESTAMP=$(date --utc --date="$EXP_DATE" +%s || true)
|
|
35
|
+
NOW_TIMESTAMP=$(date --utc +%s)
|
|
36
|
+
SECONDS_LEFT=$(( EXP_TIMESTAMP - NOW_TIMESTAMP ))
|
|
37
|
+
DAYS_LEFT=$(( SECONDS_LEFT / 86400 ))
|
|
38
|
+
|
|
39
|
+
if [ "$DAYS_LEFT" -lt 0 ]; then
|
|
40
|
+
echo "::error ::security.txt has expired!"
|
|
41
|
+
exit 1
|
|
42
|
+
elif [ "$DAYS_LEFT" -lt 30 ]; then
|
|
43
|
+
echo "::warning ::security.txt expires in less than 30 days ($DAYS_LEFT days left)"
|
|
44
|
+
else
|
|
45
|
+
echo "✅ security.txt is valid for another $DAYS_LEFT days."
|
|
46
|
+
fi
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# .github/workflows/dependency-review.yml
|
|
2
|
+
#
|
|
3
|
+
# Copyright © 2025 Network Pro Strategies (Network Pro™)
|
|
4
|
+
# SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
|
|
5
|
+
# This file is part of Network Pro
|
|
6
|
+
|
|
7
|
+
name: 'Dependency Review'
|
|
8
|
+
on: [pull_request]
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
dependency-review:
|
|
15
|
+
runs-on: ubuntu-24.04
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- name: 'Checkout Repository'
|
|
19
|
+
uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- name: 'Dependency Review'
|
|
22
|
+
uses: actions/dependency-review-action@v4
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# .github/workflows/lighthouse.yml
|
|
2
|
+
#
|
|
3
|
+
# Copyright © 2025 Network Pro Strategies (Network Pro™)
|
|
4
|
+
# SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
|
|
5
|
+
# This file is part of Network Pro
|
|
6
|
+
|
|
7
|
+
name: Lighthouse Audit
|
|
8
|
+
|
|
9
|
+
on:
|
|
10
|
+
push:
|
|
11
|
+
branches: [master]
|
|
12
|
+
pull_request:
|
|
13
|
+
branches: [master]
|
|
14
|
+
workflow_dispatch:
|
|
15
|
+
|
|
16
|
+
# cspell:ignore tostring
|
|
17
|
+
|
|
18
|
+
# Sets permissions of the GITHUB_TOKEN to allow read access to repo and write
|
|
19
|
+
# permission for PRs for comment summary
|
|
20
|
+
permissions:
|
|
21
|
+
contents: read
|
|
22
|
+
pull-requests: write
|
|
23
|
+
|
|
24
|
+
jobs:
|
|
25
|
+
audit:
|
|
26
|
+
name: Run Lighthouse CI
|
|
27
|
+
runs-on: ubuntu-24.04
|
|
28
|
+
env:
|
|
29
|
+
ENV_MODE: ci
|
|
30
|
+
timeout-minutes: 10
|
|
31
|
+
|
|
32
|
+
steps:
|
|
33
|
+
- name: Checkout Repository
|
|
34
|
+
uses: actions/checkout@v4
|
|
35
|
+
|
|
36
|
+
- name: Authenticate GitHub CLI
|
|
37
|
+
run: gh auth status
|
|
38
|
+
env:
|
|
39
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
40
|
+
|
|
41
|
+
- name: Log ENV_MODE
|
|
42
|
+
run: 'echo "ENV_MODE is set to: $ENV_MODE"'
|
|
43
|
+
|
|
44
|
+
- name: Setup Node.js
|
|
45
|
+
uses: actions/setup-node@v4
|
|
46
|
+
with:
|
|
47
|
+
node-version: 24
|
|
48
|
+
cache: npm
|
|
49
|
+
cache-dependency-path: package-lock.json
|
|
50
|
+
|
|
51
|
+
- name: Upgrade npm
|
|
52
|
+
run: |
|
|
53
|
+
corepack enable
|
|
54
|
+
npm install -g npm@11.4.2
|
|
55
|
+
|
|
56
|
+
- name: Clean previous Lighthouse reports
|
|
57
|
+
run: |
|
|
58
|
+
if [ -d ".lighthouseci" ]; then
|
|
59
|
+
COUNT=$(find .lighthouseci -type f | wc -l)
|
|
60
|
+
echo "🧹 Removing $COUNT file(s) from .lighthouseci/"
|
|
61
|
+
rm -rf .lighthouseci
|
|
62
|
+
else
|
|
63
|
+
echo "🧹 No previous .lighthouseci/ directory to clean."
|
|
64
|
+
fi
|
|
65
|
+
|
|
66
|
+
- name: Install Dependencies
|
|
67
|
+
run: npm ci
|
|
68
|
+
|
|
69
|
+
- name: Build Site
|
|
70
|
+
run: npm run build
|
|
71
|
+
|
|
72
|
+
- name: Install Google Chrome
|
|
73
|
+
run: |
|
|
74
|
+
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
|
|
75
|
+
sudo apt install -y ./google-chrome-stable_current_amd64.deb
|
|
76
|
+
|
|
77
|
+
- name: Record Chrome version and timestamp
|
|
78
|
+
run: |
|
|
79
|
+
mkdir -p .lighthouseci
|
|
80
|
+
{
|
|
81
|
+
echo "Chrome Version: $(google-chrome --version)"
|
|
82
|
+
echo "Audit Timestamp: $(date -u +'%Y-%m-%dT%H:%M:%SZ')"
|
|
83
|
+
} > .lighthouseci/chrome-version.txt
|
|
84
|
+
|
|
85
|
+
- name: Collect Lighthouse results
|
|
86
|
+
run: |
|
|
87
|
+
npx @lhci/cli collect \
|
|
88
|
+
--chrome-path="$(which google-chrome)" \
|
|
89
|
+
--config=.lighthouserc.cjs
|
|
90
|
+
|
|
91
|
+
- name: Log Chrome version used
|
|
92
|
+
run: cat .lighthouseci/chrome-version.txt
|
|
93
|
+
|
|
94
|
+
- name: Check for budget.json
|
|
95
|
+
run: |
|
|
96
|
+
if [ ! -f budget.json ]; then
|
|
97
|
+
echo "❌ ERROR: budget.json not found. LHCI budget assertions will be skipped."
|
|
98
|
+
exit 1
|
|
99
|
+
else
|
|
100
|
+
echo "✅ Found budget.json"
|
|
101
|
+
fi
|
|
102
|
+
|
|
103
|
+
- name: Assert Lighthouse results (non-blocking)
|
|
104
|
+
run: npx @lhci/cli assert --config=.lighthouserc.cjs
|
|
105
|
+
continue-on-error: true
|
|
106
|
+
|
|
107
|
+
- name: Annotate and Comment on Lighthouse Budget Failures
|
|
108
|
+
if: always()
|
|
109
|
+
continue-on-error: true
|
|
110
|
+
env:
|
|
111
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
112
|
+
run: |
|
|
113
|
+
REPORT=$(ls -t .lighthouseci/*.report.json .lighthouseci/lhr-*.json 2>/dev/null | head -n 1)
|
|
114
|
+
|
|
115
|
+
if [ -z "$REPORT" ]; then
|
|
116
|
+
echo "::warning ::No valid Lighthouse report found for annotation step."
|
|
117
|
+
exit 0
|
|
118
|
+
fi
|
|
119
|
+
|
|
120
|
+
echo "🔍 Parsing $REPORT for failing audits..."
|
|
121
|
+
|
|
122
|
+
if ! jq -e '.audits' "$REPORT" > /dev/null; then
|
|
123
|
+
echo "::warning ::The selected report is not a valid Lighthouse output (missing .audits key)."
|
|
124
|
+
exit 0
|
|
125
|
+
fi
|
|
126
|
+
|
|
127
|
+
FAILURES=$(jq -r '.audits | to_entries[] | select(.value.score < 1 and .value.score != null) | [.key, .value.title, (.value.score | tostring)] | @tsv' "$REPORT")
|
|
128
|
+
|
|
129
|
+
if [ -z "$FAILURES" ]; then
|
|
130
|
+
echo "✅ No failing audits found. Lighthouse budgets passed."
|
|
131
|
+
exit 0
|
|
132
|
+
fi
|
|
133
|
+
|
|
134
|
+
echo "⚠️ Failing Lighthouse audits:"
|
|
135
|
+
COMMENT_BODY="### ⚠️ Lighthouse Budget Issues Detected"
|
|
136
|
+
|
|
137
|
+
while IFS=$'\t' read -r key title score; do
|
|
138
|
+
echo "::warning file=.lighthouseci/report.json,line=1,title=Lighthouse Budget Issue::$title (score: $score)"
|
|
139
|
+
COMMENT_BODY="${COMMENT_BODY}"$'\n'"- ${title} (score: ${score})"
|
|
140
|
+
done <<< "$FAILURES"
|
|
141
|
+
|
|
142
|
+
COMMENT_BODY="${COMMENT_BODY}"$'\n\n'"View the full report in the workflow artifacts or in \`.lighthouseci/report.html\`."
|
|
143
|
+
|
|
144
|
+
if [ "${{ github.event_name }}" = "pull_request" ]; then
|
|
145
|
+
gh pr comment ${{ github.event.pull_request.number }} --body "$COMMENT_BODY" || echo "::warning ::Failed to post PR comment"
|
|
146
|
+
else
|
|
147
|
+
echo "Not a PR — skipping GitHub comment post."
|
|
148
|
+
fi
|
|
149
|
+
|
|
150
|
+
- name: Upload Lighthouse results
|
|
151
|
+
run: npx @lhci/cli upload --config=.lighthouserc.cjs
|
|
152
|
+
|
|
153
|
+
- name: List contents of .lighthouseci
|
|
154
|
+
run: ls -al .lighthouseci
|
|
155
|
+
|
|
156
|
+
- name: Upload full .lighthouseci output
|
|
157
|
+
uses: actions/upload-artifact@v4
|
|
158
|
+
with:
|
|
159
|
+
name: lighthouse-reports
|
|
160
|
+
path: .lighthouseci/
|
|
161
|
+
include-hidden-files: true
|
|
162
|
+
if-no-files-found: error
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# .github/workflows/playwright.yml
|
|
2
|
+
#
|
|
3
|
+
# Copyright © 2025 Network Pro Strategies (Network Pro™)
|
|
4
|
+
# SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
|
|
5
|
+
# This file is part of Network Pro
|
|
6
|
+
|
|
7
|
+
name: Playwright Tests
|
|
8
|
+
on:
|
|
9
|
+
push:
|
|
10
|
+
branches: [master]
|
|
11
|
+
pull_request:
|
|
12
|
+
branches: [master]
|
|
13
|
+
workflow_dispatch:
|
|
14
|
+
|
|
15
|
+
# ✅ Least-privilege access
|
|
16
|
+
permissions:
|
|
17
|
+
contents: read # Required for actions/checkout
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
test:
|
|
21
|
+
timeout-minutes: 30
|
|
22
|
+
runs-on: ubuntu-24.04
|
|
23
|
+
env:
|
|
24
|
+
NODE_ENV: test
|
|
25
|
+
ENV_MODE: ci
|
|
26
|
+
|
|
27
|
+
steps:
|
|
28
|
+
- name: Checkout repository
|
|
29
|
+
uses: actions/checkout@v4
|
|
30
|
+
|
|
31
|
+
- name: Log ENV_MODE
|
|
32
|
+
run: 'echo "ENV_MODE is set to: $ENV_MODE"'
|
|
33
|
+
|
|
34
|
+
- name: Set up Node.js
|
|
35
|
+
uses: actions/setup-node@v4
|
|
36
|
+
with:
|
|
37
|
+
node-version: 24
|
|
38
|
+
cache: npm
|
|
39
|
+
cache-dependency-path: package-lock.json
|
|
40
|
+
|
|
41
|
+
- name: Upgrade npm
|
|
42
|
+
run: |
|
|
43
|
+
corepack enable
|
|
44
|
+
npm install -g npm@11.4.2
|
|
45
|
+
|
|
46
|
+
- name: Install Node.js dependencies
|
|
47
|
+
run: npm ci
|
|
48
|
+
|
|
49
|
+
- name: Build site
|
|
50
|
+
run: npm run build
|
|
51
|
+
|
|
52
|
+
- name: Install Playwright Browsers
|
|
53
|
+
run: npx playwright install --with-deps
|
|
54
|
+
|
|
55
|
+
- name: Run Playwright tests
|
|
56
|
+
run: NODE_ENV=test npx playwright test
|
|
57
|
+
|
|
58
|
+
- name: Upload Playwright report
|
|
59
|
+
if: always()
|
|
60
|
+
uses: actions/upload-artifact@v4
|
|
61
|
+
with:
|
|
62
|
+
name: playwright-report
|
|
63
|
+
path: playwright-report/
|
|
64
|
+
if-no-files-found: ignore
|
|
65
|
+
retention-days: 30
|