6
6
# The branches below must be a subset of the branches above
7
7
branches : [master]
8
8
9
+ permissions : {}
10
+
9
11
jobs :
10
12
build :
11
13
runs-on : ubuntu-22.04
@@ -16,53 +18,98 @@ jobs:
16
18
strategy :
17
19
matrix :
18
20
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
19
- node-version : [18, 20]
21
+ node-version :
22
+ - 18
23
+ - 20
24
+ - 21
20
25
steps :
21
- - uses : actions/checkout@v4
26
+ - uses : step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0
27
+ with :
28
+ egress-policy : audit
29
+ - uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
22
30
- name : Use Node.js ${{ matrix.node-version }}
23
- uses : actions/setup-node@v4
31
+ uses : actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
24
32
with :
33
+ cache : npm
25
34
node-version : ${{ matrix.node-version }}
26
- - uses : ankane/setup-mysql@v1
35
+ - uses : ankane/setup-mysql@0066c6761a230df8a1ce7f26f3f434c7f3405ae7 # v1
27
36
with :
28
37
mysql-version : 8.0
29
38
- run : |
30
- sudo mysql -e "CREATE USER '$MYSQL_USER'@'localhost' IDENTIFIED BY '$MYSQL_PASSWORD'"
31
- sudo mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO '$MYSQL_USER'@'localhost'"
32
- sudo mysql -u root -e "ALTER USER '$MYSQL_USER'@'localhost' IDENTIFIED WITH mysql_native_password by '$MYSQL_PASSWORD'"
33
- sudo mysql -u root -e "FLUSH PRIVILEGES"
34
- - run : npm install
35
- - run : npm test
39
+ cat <<EOF | mysql --user=root
40
+ CREATE USER
41
+ '$MYSQL_USER'@'localhost'
42
+ IDENTIFIED BY '$MYSQL_PASSWORD';
43
+
44
+ GRANT ALL PRIVILEGES
45
+ ON *.*
46
+ TO '$MYSQL_USER'@'localhost';
47
+
48
+ ALTER USER
49
+ '$MYSQL_USER'@'localhost'
50
+ IDENTIFIED WITH mysql_native_password
51
+ BY '$MYSQL_PASSWORD';
52
+
53
+ FLUSH PRIVILEGES;
54
+ EOF
55
+ - run : |
56
+ npm ci \
57
+ --ignore-scripts \
58
+ --prefer-offline
59
+ - run : npm test --ignore-scripts
36
60
code-lint :
37
61
name : Code Lint
38
62
runs-on : ubuntu-latest
39
- timeout-minutes : 60
63
+ timeout-minutes : 5
40
64
steps :
41
- - uses : actions/checkout@v4
65
+ - uses : step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0
66
+ with :
67
+ egress-policy : audit
68
+ - uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
42
69
- name : Use Node.js 18
43
- uses : actions/setup-node@v4
70
+ uses : actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
44
71
with :
72
+ cache : npm
45
73
node-version : 18
46
74
- name : Bootstrap project
47
75
run : |
48
- npm ci --ignore-scripts
76
+ npm ci \
77
+ --ignore-scripts \
78
+ --prefer-offline
49
79
- name : Verify code linting
50
- run : npm run lint
80
+ run : |
81
+ npm run \
82
+ --ignore-script \
83
+ lint
51
84
52
85
commit-lint :
53
86
name : Commit Lint
54
87
runs-on : ubuntu-latest
55
- timeout-minutes : 60
88
+ timeout-minutes : 5
56
89
steps :
57
- - uses : actions/checkout@v4
90
+ - uses : step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0
91
+ with :
92
+ egress-policy : audit
93
+ - uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
58
94
with :
59
95
fetch-depth : 0
60
96
- name : Use Node.js 18
61
- uses : actions/setup-node@v4
97
+ uses : actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
62
98
with :
99
+ cache : npm
63
100
node-version : 18
64
101
- name : Bootstrap project
65
102
run : |
66
- npm ci --ignore-scripts
103
+ npm ci \
104
+ --ignore-scripts \
105
+ --prefer-offline
67
106
- name : Verify commit linting
68
- run : npx commitlint --from origin/master --to HEAD --verbose
107
+ run : |
108
+ npm exec \
109
+ --package=@commitlint/cli \
110
+ -- \
111
+ commitlint \
112
+ --from=origin/master \
113
+ --to=HEAD \
114
+ --verbose
115
+
0 commit comments