-
Notifications
You must be signed in to change notification settings - Fork 1.8k
136 lines (119 loc) · 4.12 KB
/
check-links.yml
File metadata and controls
136 lines (119 loc) · 4.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Links
# cSpell:ignore minisearch otelbot
on:
merge_group:
pull_request:
permissions:
contents: read
env:
PR_NUM: ${{ github.event.pull_request.number }}
USER_EMAIL: 197425009+otelbot@users.noreply.github.com
USER_NAME: otelbot
jobs:
# Build site first because htmltest checks the generated HTML files
build:
name: BUILD
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Create NPM cache-hash input file
run: |
mkdir -p tmp
jq '{devDependencies, dependencies, engines, gitHubActionCacheKey}' package.json > tmp/package-ci.json
- name: Create and use reduced-dependencies package.json
run: |
jq '.devDependencies |= with_entries(
select(.key | test("prefix|hugo|css"))
)
| .dependencies |= with_entries(
select(.key | test("minisearch")))
| del(.optionalDependencies)' \
package.json > tmp/package-min.json
cp tmp/package-min.json package.json
- uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
cache: npm
cache-dependency-path: tmp/package-ci.json
- run: |
npm install --omit=optional
git restore package.json
- name: Git submodules properly pinned?
run: |
npm run seq pin:submodule
echo "If the diff check below fails, then update .gitmodules by pinning the named git"
echo "submodule(s); or undo the submodule update(s) if it happened by mistake."
npm run _diff:fail
- name: Build the site
run: npm run log:build
continue-on-error: true
- uses: actions/upload-artifact@v5
with:
name: build-artifacts
path: |
public/
tmp/build-log.txt
tmp/package*.json
check-links:
name: CHECK LINKS (${{ matrix.shard.id }})
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
shard:
# Each entry in this list is a shard, with:
# id: identifier for the shard (used in job name and artifact name)
# regex: regex to add to IgnoreDirs in .htmltest.yml for this shard
#
# Each shard ignores a subset of locale directories, so that all shards
# together cover all locale directories but each shard checks fewer links.
- id: en
regex: '^../' # Ignore all locale directories. This works because
# English docs folders have more than two characters in their names
- id: locales-A-to-M
# Regex to ignore English doc folders and locales n to z.
regex: '^(..[^/]|[n-z]./)'
- id: locales-N-to-Z
# Regex to ignore English doc folders and locales a to m.
regex: '^(..[^/]|[a-m]./)'
steps:
- uses: actions/checkout@v5
- uses: actions/download-artifact@v6
with: { name: build-artifacts }
- uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
cache: npm
cache-dependency-path: tmp/package-ci.json
- name: Check links for shard
run: |
.github/scripts/check-links-shard.sh '${{ matrix.shard.id }}' '${{ matrix.shard.regex }}'
- uses: actions/upload-artifact@v5
with:
name: refcache-${{ matrix.shard.id }}
path: |
static/refcache.json
tmp/*log.txt
check-refcache:
name: REFCACHE updates?
needs: check-links
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/download-artifact@v6
with:
pattern: refcache-*
path: tmp/check-refcache
- run: ls -lR tmp
- name: Does the refcache need updating?
run: .github/scripts/check-refcache.sh
check-build-log-for-issues:
name: WARNINGS in build log?
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/download-artifact@v6
with: { name: build-artifacts }
- run: cat tmp/build-log.txt
- run: scripts/check-build-log.sh