forked from privacyguides/privacyguides.org
-
-
Notifications
You must be signed in to change notification settings - Fork 0
243 lines (221 loc) · 7.87 KB
/
tests.yml
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
name: Code tests
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
FONTAWESOME_NPM_AUTH_TOKEN: ${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }}
jobs:
deps:
name: "Dependency Install"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- uses: actions/setup-node@v2
with:
node-version: '14'
- run: npm install
- run: tar cvf node_modules.tar node_modules
- name: Upload node_modules for Jekyll build
uses: actions/upload-artifact@v2
with:
name: node_modules
path: node_modules.tar
build:
name: "Jekyll Build"
runs-on: ubuntu-latest
needs: deps
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- uses: actions/setup-node@v2
with:
node-version: '14'
- name: Cache Jekyll build
uses: actions/cache@v2
with:
path: |
.jekyll-cache
.sass-cache
key: ${{ runner.os }}-jekyll-${{ hashFiles('**/*.??m[ld]') }}
restore-keys: |
${{ runner.os }}-jekyll-
- name: Set Date and Time
run: |
sed -i "s/^ date:.*$/ date: $(TZ=UTC date "+%Y-%m-%d")/" _config.yml
sed -i "s/^ time:.*$/ time: $(TZ=UTC date "+%H:%M:%S %Z")/" _config.yml
- name: Download node_modules
uses: actions/download-artifact@v2
with:
name: node_modules
- run: tar xvf node_modules.tar
- name: Generate Website
run: npm run build
- run: tar cvf site.tar _site
- name: Upload generated Jekyll site
uses: actions/upload-artifact@v2
with:
name: generated-site
path: site.tar
link:
name: "Broken Hyperlinks (Internal)"
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
- name: Download generated Jekyll site
uses: actions/download-artifact@v2
with:
name: generated-site
- run: tar xvf site.tar
- name: Copy built site to production
run: |
mv ${{ github.workspace }}/_site /tmp/
mkdir -p /tmp/src
mv ${{ github.workspace }}/* /tmp/src/
mkdir -p ${{ github.workspace }}/src
mv /tmp/src/* ${{ github.workspace }}/src/
mv /tmp/_site ${{ github.workspace }}/
- name: Internal link checker
uses: untitaker/[email protected]
with:
args: _site/ --sources src/
extlink:
name: "Broken Hyperlinks (External)"
runs-on: ubuntu-latest
needs: [build, link]
steps:
- uses: actions/checkout@v2
- name: Download generated Jekyll site
uses: actions/download-artifact@v2
with:
name: generated-site
- run: tar xvf site.tar
- name: Cache HTMLProofer
id: cache-htmlproofer
uses: actions/cache@v2
with:
path: tmp/.htmlproofer
key: ${{ runner.os }}-htmlproofer-${{ hashFiles('_site/**.html') }}
restore-keys: |
${{ runner.os }}-htmlproofer-
${{ runner.os }}-htmlproofer
- name: Check All External Links (Informational, Soft-Fail)
uses: chabad360/[email protected]
with:
directory: ${{ github.workspace }}/_site
arguments: --assume-extension --external_only --internal-domains privacyguides.org,www.privacyguides.org --timeframe 30d --url-ignore '/https:\/\/developers\.cloudflare\.com\//,/https:\/\/github\.com\/privacyguides\/privacyguides\.org\/(edit|tree|blob)\/main/'
continue-on-error: true
- name: Check External Links (Only 4XX)
uses: chabad360/[email protected]
with:
directory: ${{ github.workspace }}/_site
arguments: --assume-extension --external_only --only_4xx --http-status-ignore 429 --internal-domains privacyguides.org,www.privacyguides.org --timeframe 30d --url-ignore '/https:\/\/developers\.cloudflare\.com\//,/https:\/\/github\.com\/privacyguides\/privacyguides\.org\/(edit|tree|blob)\/main/'
https:
name: "Require HTTPS Internal Images"
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
- name: Download generated Jekyll site
uses: actions/download-artifact@v2
with:
name: generated-site
- run: tar xvf site.tar
- name: Check Images
uses: chabad360/[email protected]
with:
directory: ${{ github.workspace }}/_site
arguments: --assume-extension --check-img-http --internal-domains privacyguides.org,www.privacyguides.org --disable-external --checks-to-ignore LinkCheck,ScriptCheck
scripts:
name: "Script Reference Checks"
runs-on: ubuntu-latest
needs: [build, link]
steps:
- uses: actions/checkout@v2
- name: Download generated Jekyll site
uses: actions/download-artifact@v2
with:
name: generated-site
- run: tar xvf site.tar
- name: Check HTML
uses: chabad360/[email protected]
with:
directory: ${{ github.workspace }}/_site
arguments: --assume-extension --check-html --disable-external --check-sri --report-script-embeds --internal-domains privacyguides.org,www.privacyguides.org --checks-to-ignore LinkCheck,ImageCheck,HtmlCheck
tags:
name: "HTML Tag Test"
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
- name: Download generated Jekyll site
uses: actions/download-artifact@v2
with:
name: generated-site
- run: tar xvf site.tar
- name: Validate HTML
uses: chabad360/[email protected]
with:
directory: ${{ github.workspace }}/_site
arguments: --assume-extension --check-html --disable-external --allow-hash-href --internal-domains privacyguides.org,www.privacyguides.org --report-invalid-tags --report-eof-tags --report-mismatched-tags --checks-to-ignore LinkCheck,ImageCheck,ScriptCheck
entity:
name: "HTML Entity Names Test"
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
- name: Download generated Jekyll site
uses: actions/download-artifact@v2
with:
name: generated-site
- run: tar xvf site.tar
- name: Validate HTML
uses: chabad360/[email protected]
with:
directory: ${{ github.workspace }}/_site
arguments: --assume-extension --check-html --disable-external --allow-hash-href --internal-domains privacyguides.org,www.privacyguides.org --report-missing-names --checks-to-ignore LinkCheck,ImageCheck,ScriptCheck
misc:
name: "Misc HTML Test"
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
- name: Download generated Jekyll site
uses: actions/download-artifact@v2
with:
name: generated-site
- run: tar xvf site.tar
- name: Validate HTML
uses: chabad360/[email protected]
with:
directory: ${{ github.workspace }}/_site
arguments: --assume-extension --check-html --disable-external --internal-domains privacyguides.org,www.privacyguides.org --report-missing-doctype --checks-to-ignore LinkCheck,ImageCheck,ScriptCheck
opengraph:
name: "OpenGraph Test"
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
- name: Download generated Jekyll site
uses: actions/download-artifact@v2
with:
name: generated-site
- run: tar xvf site.tar
- name: Check OpenGraph
uses: chabad360/[email protected]
with:
directory: ${{ github.workspace }}/_site
arguments: --assume-extension --disable-external --check-opengraph --checks-to-ignore LinkCheck,ImageCheck,ScriptCheck