-
Notifications
You must be signed in to change notification settings - Fork 183
115 lines (108 loc) · 3.21 KB
/
ci.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
name: Continous Integration
on:
push:
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
permissions: {}
jobs:
build:
runs-on: ubuntu-22.04
env:
MYSQL_HOST: '127.0.0.1'
MYSQL_USER: myUser
MYSQL_PASSWORD: myPass
strategy:
matrix:
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
node-version:
- 18
- 20
- 21
steps:
- uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0
with:
egress-policy: audit
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
with:
cache: npm
node-version: ${{ matrix.node-version }}
- uses: ankane/setup-mysql@0066c6761a230df8a1ce7f26f3f434c7f3405ae7 # v1
with:
mysql-version: 8.0
- run: |
cat <<EOF | sudo mysql -e
CREATE USER
'$MYSQL_USER'@'localhost'
IDENTIFIED BY '$MYSQL_PASSWORD';
GRANT ALL PRIVILEGES
ON *.*
TO '$MYSQL_USER'@'localhost';
ALTER USER
'$MYSQL_USER'@'localhost'
IDENTIFIED WITH mysql_native_password
BY '$MYSQL_PASSWORD';
FLUSH PRIVILEGES;
EOF
- run: |
npm ci \
--ignore-scripts \
--prefer-offline
- run: npm test --ignore-scripts
code-lint:
name: Code Lint
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0
with:
egress-policy: audit
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Use Node.js 18
iuses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
with:
cache: npm
node-version: 18
- name: Bootstrap project
run: |
npm ci \
--ignore-scripts \
--prefer-offline
- name: Verify code linting
run: |
npm run \
--ignore-script \
lint
commit-lint:
name: Commit Lint
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0
with:
egress-policy: audit
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
- name: Use Node.js 18
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
with:
cache: npm
node-version: 18
- name: Bootstrap project
run: |
npm ci \
--ignore-scripts \
--prefer-offline
- name: Verify commit linting
run: |
npm exec \
--package=@commitlint/cli \
-- \
commitlint \
--from=origin/master \
--to=HEAD \
--verbose