-
Notifications
You must be signed in to change notification settings - Fork 982
259 lines (227 loc) · 9.38 KB
/
Copy pathci.yml
File metadata and controls
259 lines (227 loc) · 9.38 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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
name: Continuous Integration
on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
- edited
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
save-pr:
name: Save PR Number
runs-on: ubuntu-latest
steps:
- name: Save PR number
env:
PR_NUMBER: ${{ github.event.number }}
PR_SHA: ${{ github.event.pull_request.head.sha }}
MERGE_SHA: ${{ github.sha }}
run: |
mkdir -p ./pr
echo $PR_NUMBER > ./pr/pr_number
echo $PR_SHA > ./pr/pr_sha
echo $MERGE_SHA > ./pr/merge_sha
- name: Upload PR Number
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08
with:
name: pr_number
path: pr/
htmlproofer:
name: HTMLProofer
runs-on: ubuntu-24.04
steps:
- name: Checkout EIPs
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
repository: ethereum/EIPs
path: ''
fetch-depth: 0
- name: Restore EIPs mtimes from git history
uses: chetan/git-restore-mtime-action@d186aca54f8760da4dec55313195e51ed3ebb0b3 # v2.3
- name: Get EIPs Version
id: eips
run: echo "sha=$(git rev-parse --short=8 HEAD)" >> $GITHUB_OUTPUT
- name: Checkout ERCs
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
repository: ethereum/ERCs
path: ERCs
fetch-depth: 0
- name: Restore ERCs mtimes from git history
uses: chetan/git-restore-mtime-action@d186aca54f8760da4dec55313195e51ed3ebb0b3 # v2.3
with:
working-directory: ERCs
- name: Get Changed Files
id: changed
continue-on-error: true
run: |
ALL_CHANGED=$(gh pr diff ${{ github.event.number }} --name-only --repo ${{ github.repository }})
# Only pure ERC markdown changes are safe for the incremental path.
# Asset changes can otherwise leave stale files in `_site/`.
NON_ERC=$(echo "$ALL_CHANGED" | grep -v -E '^ERCS/erc-[0-9]+\.md$' | grep -v '^\s*$' || true)
if [ -n "$NON_ERC" ]; then
echo "Non-ERC files changed, will run full check"
echo "mode=full" >> $GITHUB_OUTPUT
exit 0
fi
CHANGED_NUMS=$(echo "$ALL_CHANGED" | grep -oE 'erc-[0-9]+' | sed 's/erc-//' | sort -u | tr '\n' ' ')
if [ -z "$CHANGED_NUMS" ]; then
echo "mode=full" >> $GITHUB_OUTPUT
else
echo "mode=incremental" >> $GITHUB_OUTPUT
echo "nums=${CHANGED_NUMS}" >> $GITHUB_OUTPUT
echo "Will check only changed ERCs: ${CHANGED_NUMS}"
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Merge Repos
run: |
mkdir -p $GITHUB_WORKSPACE/ERCs/ERCS
mkdir -p $GITHUB_WORKSPACE/ERCs/EIPS
cp -rp $GITHUB_WORKSPACE/ERCs/ERCS/. $GITHUB_WORKSPACE/EIPS
cp -rp $GITHUB_WORKSPACE/ERCs/EIPS/. $GITHUB_WORKSPACE/EIPS
cp -rp $GITHUB_WORKSPACE/ERCs/assets/. $GITHUB_WORKSPACE/assets
cp -rp $GITHUB_WORKSPACE/ERCs/_layouts/. $GITHUB_WORKSPACE/_layouts 2>/dev/null || true
cd $GITHUB_WORKSPACE/EIPS
find . -name "erc-*.md" -type f -exec sh -c 'echo mv "$1" "$(echo "$1" | sed s/erc/eip/)"' _ {} \; | sh
cd $GITHUB_WORKSPACE/assets
find . -name "erc-*" -type d -exec sh -c 'echo mv "$1" "$(echo "$1" | sed s/erc/eip/)"' _ {} \; | sh
cd $GITHUB_WORKSPACE
rm -rf ERCs
- name: Setup Ruby
uses: ruby/setup-ruby@fb404b9557c186e349162b0d8efb06e2bc36edea # v1.232.0
with:
ruby-version: '3.1'
bundler-cache: true
cache-version: 0
- name: Restore Jekyll Cache
id: cache
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: |
_site
.jekyll-metadata
# PR reruns can reuse their own cache via the current PR merge ref.
# If that misses, GitHub falls back to caches visible from the base/default branch.
key: jekyll-${{ runner.os }}-eips-${{ steps.eips.outputs.sha }}
restore-keys: |
jekyll-${{ runner.os }}-
# See .github/workflows/README.md for how incremental builds and caching work.
# Always use --incremental: it creates .jekyll-metadata for future runs,
# and falls back to a full build when .jekyll-metadata is missing.
- name: Build Website
run: |
bundle exec jekyll doctor
echo "::notice::Jekyll incremental build (mode=${{ steps.changed.outputs.mode }})"
bundle exec jekyll build --incremental
- name: HTML Proofer
run: |
if [ "${{ steps.changed.outputs.mode }}" = "incremental" ]; then
PATHS=()
for num in ${{ steps.changed.outputs.nums }}; do
slug="eip-${num}"
if [ -d "./_site/EIPS/${slug}" ]; then
PATHS+=("./_site/EIPS/${slug}")
elif [ -f "./_site/EIPS/${slug}.html" ]; then
PATHS+=("./_site/EIPS/${slug}.html")
elif [ -d "./_site/${slug}" ]; then
PATHS+=("./_site/${slug}")
elif [ -f "./_site/${slug}.html" ]; then
PATHS+=("./_site/${slug}.html")
fi
done
if [ ${#PATHS[@]} -gt 0 ]; then
printf -v PATHS_NOTICE ' %q' "${PATHS[@]}"
echo "::notice::Running HTMLProofer on changed files only:${PATHS_NOTICE}"
bundle exec htmlproofer --root-dir ./_site --allow-missing-href --disable-external --assume-extension '.html' --log-level=:info --cache='{"timeframe":{"external":"6w"}}' --checks 'Links,Images,Scripts,OpenGraph' --no-check-sri --ignore-empty-alt --no-enforce_https "${PATHS[@]}"
exit $?
fi
echo "::warning::Changed ERC HTML files not found in build output, falling back to full check"
fi
bundle exec htmlproofer --allow-missing-href --disable-external --assume-extension '.html' --log-level=:info --cache='{"timeframe":{"external":"6w"}}' --checks 'Links,Images,Scripts,OpenGraph' --no-check-sri --ignore-empty-alt --no-enforce_https ./_site
- name: DNS Validator
run: bundle exec github-pages health-check
- name: Save Jekyll Cache
if: always()
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: |
_site
.jekyll-metadata
key: jekyll-${{ runner.os }}-eips-${{ steps.eips.outputs.sha }}
link-check:
name: Link Check
runs-on: ubuntu-latest
steps:
- name: Checkout EIP Repository
uses: actions/checkout@47fbe2df0ad0e27efb67a70beac3555f192b062f
- name: Link Checker
uses: gaurav-nelson/github-action-markdown-link-check@d53a906aa6b22b8979d33bc86170567e619495ec
with:
config-file: config/mlc_config.json
use-quiet-mode: no
use-verbose-mode: yes
check-modified-files-only: yes
codespell:
name: CodeSpell
runs-on: ubuntu-latest
steps:
- name: Checkout EIP Repository
uses: actions/checkout@47fbe2df0ad0e27efb67a70beac3555f192b062f
- name: Get Changed Files
id: changed
continue-on-error: true
run: |
echo "CHANGED_FILES<<EOF" >> $GITHUB_ENV
gh pr diff ${{ github.event.number }} --name-only | sed -e 's|$|,|' | xargs -i echo "{}" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run CodeSpell
uses: codespell-project/actions-codespell@57beb9f38f49d773d641ac555d1565c3b6a59938
if: steps.changed.outcome == 'success'
with:
check_filenames: true
ignore_words_file: config/.codespell-whitelist
path: ${{ env.CHANGED_FILES }}
skip: .git,Gemfile.lock,**/*.png,**/*.gif,**/*.jpg,**/*.svg,.codespell-whitelist,vendor,_site,_config.yml,style.css
eipw-validator:
name: EIP Walidator
runs-on: ubuntu-latest
steps:
- name: Checkout EIP Repository
uses: actions/checkout@47fbe2df0ad0e27efb67a70beac3555f192b062f
- uses: ethereum/eipw-action@be3fa642ec311d0b8e1fdb811e5c9b4ada3d3d93
id: eipw
with:
token: ${{ secrets.GITHUB_TOKEN }}
unchecked: 1
path: ERCS/
options-file: config/eipw.toml
markdownlint:
name: Markdown Linter
runs-on: ubuntu-latest
steps:
- name: Checkout EIP Repository
uses: actions/checkout@47fbe2df0ad0e27efb67a70beac3555f192b062f
- name: Get Changed Files
id: changed
continue-on-error: true
run: |
echo "CHANGED_FILES<<EOF" >> $GITHUB_ENV
gh pr diff ${{ github.event.number }} --name-only | grep -E -x '[^/]+\.md|EIPS/eip-[0-9]+\.md' >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Lint
uses: DavidAnson/markdownlint-cli2-action@f5cf187ef11bd3a68a127321b794aa252ff23019
if: steps.changed.outcome == 'success'
with:
command: config
globs: |
config/.markdownlint.yaml
${{ env.CHANGED_FILES }}