-
-
Notifications
You must be signed in to change notification settings - Fork 2
198 lines (185 loc) · 6.29 KB
/
front-end.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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow
name: "Front-end"
# ECMAScript version: ES5 (2009), ES6 (2015), ECMAScript 2016, 2017, 2018 ...
# Node.js version: 18.12
# npm version: 9.2
#
# https://github.com/tc39/proposals/blob/main/finished-proposals.md
# https://kangax.github.io/compat-table/es6/
# https://nodejs.dev/en/about/releases/
# https://www.npmjs.com/package/npm?activeTab=versions
# Set engine versions in package.json
# {
# "engines": {
# "node": "^18.12",
# "npm": "please-use-yarn",
# "yarn": "^1.22.19"
# }
# }
# Yarn is a better package manager.
on: # yamllint disable-line rule:truthy
pull_request: null
push:
branches:
- "master"
# Add [skip ci] to commit message to skip CI.
permissions: {} # yamllint disable-line rule:braces
#permissions: "read-all"
#permissions:
# contents: "read" # Private repositories need read permission
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
js_syntax_errors:
name: "𝟏 JavaScript Syntax Errors"
runs-on: "ubuntu-22.04"
timeout-minutes: 5
steps:
-
name: "Checkout repository"
uses: "actions/[email protected]"
-
name: "Set up Node.js"
uses: "actions/[email protected]"
with:
node-version: "18"
check-latest: true
cache: "npm"
# cache: "yarn"
-
name: "Enable strict engine checking"
run: "npm config set engine-strict true"
#run: "yarn config set engine-strict true"
-
name: "Install all dependencies"
run: "npm ci"
#run: "yarn install --non-interactive --pure-lockfile"
-
name: "Check JavaScript files for syntax errors"
run: |
git ls-files --cached -z -- 'resources/js/*.js' \
| xargs --null -- npx acorn --ecma2015 --module --silent
js_coding_standards:
name: "𝟐 JavaScript Coding Standards"
needs:
- "js_syntax_errors"
permissions:
checks: "write"
contents: "read"
pull-requests: "read"
runs-on: "ubuntu-22.04"
timeout-minutes: 5
steps:
-
name: "Checkout repository"
uses: "actions/[email protected]"
-
name: "Set up Node.js"
uses: "actions/[email protected]"
with:
node-version: "18"
cache: "npm"
# cache: "yarn"
-
name: "Enable strict engine checking"
run: "npm config set engine-strict true"
#run: "yarn config set engine-strict true"
-
name: "Install all dependencies"
run: "npm ci"
#run: "yarn install --non-interactive --pure-lockfile"
-
name: "Run ESLint"
run: "npm run js:eslint -- --format json --output-file '${{ runner.temp }}/eslint-report.json'"
#run: "yarn run js:eslint --format json --output-file '${{ runner.temp }}/eslint-report.json'"
continue-on-error: true
-
name: "Annotate ESLint Results"
uses: "ataylorme/[email protected]"
with:
check-name: "𝕩 ESLint Annotations"
repo-token: "${{ github.token }}"
report-json: "${{ runner.temp }}/eslint-report.json"
scss_coding_standards:
name: "𝟑 Sassy CSS Coding Standards"
runs-on: "ubuntu-22.04"
timeout-minutes: 5
steps:
-
name: "Checkout repository"
uses: "actions/[email protected]"
-
name: "Set up Node.js"
uses: "actions/[email protected]"
with:
node-version: "18"
cache: "npm"
# cache: "yarn"
-
name: "Enable strict engine checking"
run: "npm config set engine-strict true"
#run: "yarn config set engine-strict true"
-
name: "Install all dependencies"
run: "npm ci"
#run: "yarn install --non-interactive --pure-lockfile"
-
name: "Detect coding standards violations"
run: "npm run scss:cs -- --formatter github"
#run: "yarn run scss:cs --formatter github"
svg:
name: "𝟒 SVG validity"
runs-on: "ubuntu-22.04"
timeout-minutes: 1
steps:
-
name: "Checkout repository"
uses: "actions/[email protected]"
-
name: "Validate SVG files"
uses: "szepeviktor/[email protected]"
with:
svg_path: "public/**/*.svg"
build:
name: "𝟓 Build"
needs:
- "js_coding_standards"
- "scss_coding_standards"
- "svg"
runs-on: "ubuntu-22.04"
timeout-minutes: 5
steps:
-
name: "Checkout repository"
uses: "actions/[email protected]"
-
name: "Set up Node.js"
uses: "actions/[email protected]"
with:
node-version: "18"
cache: "npm"
# cache: "yarn"
-
name: "Enable strict engine checking"
run: "npm config set engine-strict true"
#run: "yarn config set engine-strict true"
-
name: "Install production dependencies"
run: "npm ci --omit=dev"
#run: "yarn install --non-interactive --pure-lockfile --production=true"
-
name: "Checks for security vulnerability advisories"
run: "npm audit --omit=dev"
#run: "yarn audit"
-
name: "Build front-end"
run: "npm run prod:build"
#run: "yarn run prod:build"
-
name: "Check differences to repository"
run: "git diff --exit-code"
# Job numbers: https://en.wikipedia.org/wiki/Mathematical_Alphanumeric_Symbols
# JavaScript documentation: https://jsdoc.app/ https://www.npmjs.com/package/eslint-plugin-jsdoc
# Validate HTML: https://www.npmjs.com/package/html-validate
# Validate JSON schema: https://www.npmjs.com/package/ajv