-
-
Notifications
You must be signed in to change notification settings - Fork 2k
194 lines (185 loc) · 6.31 KB
/
Copy pathci.yml
File metadata and controls
194 lines (185 loc) · 6.31 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
---
name: ci
on:
workflow_call:
pull_request:
branches:
- main
permissions:
contents: read
env:
SEGMENT_ANALYTICS_KEY: ${{ secrets.SEGMENT_ANALYTICS_KEY }}
LD_CLIENT_ID: ${{ secrets.LD_CLIENT_ID }}
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Build
uses: ConsenSys/github-actions/docs-build@main
case:
name: Check for case being inconsistent
runs-on: ubuntu-latest
strategy:
matrix:
folder: ['docs']
steps:
- uses: actions/checkout@v6
- name: Case check action
uses: ConsenSys/github-actions/docs-case-check@main
with:
DOC_DIR: ${{ matrix.folder }}
SKIP_TEST: true
lint:
name: Lint Code Base
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Lint
uses: ConsenSys/github-actions/docs-lint-all@main
prettier:
name: Prettier
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Changed files (Prettier)
id: changed-files
uses: tj-actions/changed-files@22103cc46bda19c2b464ffe86db46df6922fd323 # 47.0.5; pin matches docs-spelling-check
with:
separator: "\n"
files: |
**/*.md
**/*.mdx
**/*.ts
**/*.tsx
**/*.js
**/*.jsx
**/*.json
**/*.css
**/*.scss
**/*.html
**/*.yml
**/*.yaml
- name: Use Node.js
uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
cache: npm
- name: Install dependencies
run: npm ci
env:
NODE_ENV: development
HUSKY: 0
- name: Check formatting
if: steps.changed-files.outputs.any_changed == 'true'
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
set -euo pipefail
files_to_check=()
while IFS= read -r f || [ -n "$f" ]; do
[ -z "$f" ] && continue
if [ -f "$f" ]; then
files_to_check+=("$f")
fi
done <<< "$ALL_CHANGED_FILES"
if [ ${#files_to_check[@]} -eq 0 ]; then
echo "No existing files to check (skipping)."
exit 0
fi
./node_modules/.bin/prettier --check "${files_to_check[@]}"
- name: No Prettier-scoped files changed
if: steps.changed-files.outputs.any_changed != 'true'
run: echo "No matching changed files; Prettier check skipped."
# Vale checks spelling/style on changed .md/.mdx files and fails on real Vale errors,
# matching what runs locally (scripts/docs-pre-commit-check.sh) so "passes locally"
# means "passes on CI". The matrix keeps the required check names "Spelling (.md)" and
# "Spelling (.mdx)". Vale runs directly (not via the reviewdog-based composite action)
# so large PRs do not hit GitHub's 300-file diff limit, which is an infrastructure
# failure unrelated to content.
spelling:
name: Spelling
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
file-extensions: ['.md', '.mdx']
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Checkout Vale config
uses: actions/checkout@v6
with:
repository: Consensys/github-actions
path: .github-actions
- name: Changed files
id: changed-files
uses: tj-actions/changed-files@22103cc46bda19c2b464ffe86db46df6922fd323 # 47.0.5; pin matches docs-spelling-check
with:
path: .
files: '**/*${{ matrix.file-extensions }}'
separator: ','
- name: Install Vale
if: steps.changed-files.outputs.any_changed == 'true'
env:
VALE_VERSION: '3.15.1'
run: |
set -euo pipefail
curl -sSfL "https://github.com/errata-ai/vale/releases/download/v${VALE_VERSION}/vale_${VALE_VERSION}_Linux_64-bit.tar.gz" -o /tmp/vale.tar.gz
sudo tar -xzf /tmp/vale.tar.gz -C /usr/local/bin vale
vale --version
(cd .github-actions/docs-spelling-check && vale sync)
- name: Run Vale
if: steps.changed-files.outputs.any_changed == 'true'
# Vale is advisory only and must not block merges: it produces false positives on
# valid technical content (code identifiers like `wagmi-tab`, product names,
# intentional ellipses). `continue-on-error` MUST be at the step (not the job) so
# the job still concludes "success" and the required "Spelling" check passes while
# findings stay visible in the logs. Job-level `continue-on-error` does not work
# here: it only keeps the overall run green, but the job's own check run stays
# "failure" and a required status check keeps blocking the merge.
continue-on-error: true
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
set -euo pipefail
files=()
IFS=',' read -ra raw <<< "$ALL_CHANGED_FILES"
for f in "${raw[@]}"; do
f="${f#"${f%%[![:space:]]*}"}"
f="${f%"${f##*[![:space:]]}"}"
[ -z "$f" ] && continue
[ -f "$f" ] && files+=("$f")
done
if [ ${#files[@]} -eq 0 ]; then
echo "No existing ${{ matrix.file-extensions }} files to check."
exit 0
fi
vale --config .github-actions/docs-spelling-check/.vale.ini "${files[@]}"
- name: No spelling-scoped files changed
if: steps.changed-files.outputs.any_changed != 'true'
run: echo 'No matching changed files; Vale check skipped.'
linkCheck:
name: Link Checking
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Use Node.js
uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
- name: Install dependencies
run: npm ci
env:
NODE_ENV: development
HUSKY: 0
- name: Generate Snaps API reference
run: npm run docusaurus snaps:generate
- name: LinkCheck
uses: ConsenSys/github-actions/docs-link-check@main
with:
CONFIG_FILE: '.linkspector.yml'