66 # The branches below must be a subset of the branches above
77 branches : [master]
88
9+ permissions : {}
10+
911jobs :
1012 build :
1113 runs-on : ubuntu-22.04
@@ -16,53 +18,98 @@ jobs:
1618 strategy :
1719 matrix :
1820 # 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
2025 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
2230 - name : Use Node.js ${{ matrix.node-version }}
23- uses : actions/setup-node@v4
31+ uses : actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
2432 with :
33+ cache : npm
2534 node-version : ${{ matrix.node-version }}
26- - uses : ankane/setup-mysql@v1
35+ - uses : ankane/setup-mysql@0066c6761a230df8a1ce7f26f3f434c7f3405ae7 # v1
2736 with :
2837 mysql-version : 8.0
2938 - 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 | sudo mysql -e
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
3660 code-lint :
3761 name : Code Lint
3862 runs-on : ubuntu-latest
39- timeout-minutes : 60
63+ timeout-minutes : 5
4064 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
4269 - name : Use Node.js 18
43- uses : actions/setup-node@v4
70+ uses : actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
4471 with :
72+ cache : npm
4573 node-version : 18
4674 - name : Bootstrap project
4775 run : |
48- npm ci --ignore-scripts
76+ npm ci \
77+ --ignore-scripts \
78+ --prefer-offline
4979 - name : Verify code linting
50- run : npm run lint
80+ run : |
81+ npm run \
82+ --ignore-script \
83+ lint
5184
5285 commit-lint :
5386 name : Commit Lint
5487 runs-on : ubuntu-latest
55- timeout-minutes : 60
88+ timeout-minutes : 5
5689 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
5894 with :
5995 fetch-depth : 0
6096 - name : Use Node.js 18
61- uses : actions/setup-node@v4
97+ uses : actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
6298 with :
99+ cache : npm
63100 node-version : 18
64101 - name : Bootstrap project
65102 run : |
66- npm ci --ignore-scripts
103+ npm ci \
104+ --ignore-scripts \
105+ --prefer-offline
67106 - 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