Skip to content

Commit 6130b88

Browse files
committed
DRY
1 parent 1f58aed commit 6130b88

File tree

4 files changed

+6
-21
lines changed

4 files changed

+6
-21
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ jobs:
2323
node-version: ${{ env.NODE_VER }}
2424
- uses: actions/checkout@v6
2525
- run: npm install
26-
- name: Set MySQL credentials for CI
27-
run: |
28-
sed -i 's/^user\s*=.*/user = "root"/' conf.d/mysql.toml
29-
sed -i 's/^password\s*=.*/password = "root"/' conf.d/mysql.toml
3026
- name: Initialize MySQL
3127
run: sh sql/init-mysql.sh
3228
- name: run coverage
@@ -68,10 +64,6 @@ jobs:
6864
node-version: ${{ matrix.node-version }}
6965
- run: sh sql/init-mysql.sh
7066
- run: npm install
71-
- name: Set MySQL credentials for CI
72-
run: |
73-
sed -i 's/^user\s*=.*/user = "root"/' conf.d/mysql.toml
74-
sed -i 's/^password\s*=.*/password = "root"/' conf.d/mysql.toml
7567
- run: npm test
7668

7769
test-mac:
@@ -93,10 +85,6 @@ jobs:
9385
node-version: ${{ matrix.node-version }}
9486
- run: sh sql/init-mysql.sh
9587
- run: npm install
96-
- name: Set MySQL credentials for CI
97-
run: |
98-
sed -i '' 's/^user[[:space:]]*=.*/user = "root"/' conf.d/mysql.toml
99-
sed -i '' 's/^password[[:space:]]*=.*/password = "root"/' conf.d/mysql.toml
10088
- run: npm test
10189

10290
test-win:
@@ -119,8 +107,4 @@ jobs:
119107
node-version: ${{ matrix.node-version }}
120108
- run: sh sql/init-mysql.sh
121109
- run: npm install
122-
- name: Set MySQL credentials for CI
123-
run: |
124-
sed -i 's/^user\s*=.*/user = "root"/' conf.d/mysql.toml
125-
sed -i 's/^password\s*=.*/password = "root"/' conf.d/mysql.toml
126110
- run: sh test.sh

.github/workflows/publish.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ jobs:
1919
node-version: ${{ env.node-version }}
2020
- run: sh sql/init-mysql.sh
2121
- run: npm install
22-
- name: Set MySQL credentials for CI
23-
run: |
24-
sed -i 's/^user\s*=.*/user = "root"/' conf.d/mysql.toml
25-
sed -i 's/^password\s*=.*/password = "root"/' conf.d/mysql.toml
2622
- run: npm test
2723

2824
publish-npm:

conf.d/http.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ clearInvalid = true
1515
isSameSite = "Strict"
1616
isSecure = true
1717
isHttpOnly = false
18-
# password = "" # hint: openssl rand -hex 16
18+
password = "" # hint: openssl rand -hex 16

test.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
set -eu
44

5+
if [ "${CI:-}" = "true" ]; then
6+
sed -i.bak 's/^user[[:space:]]*=.*/user = "root"/' conf.d/mysql.toml && rm -f conf.d/mysql.toml.bak
7+
sed -i.bak 's/^password[[:space:]]*=.*/password = "root"/' conf.d/mysql.toml && rm -f conf.d/mysql.toml.bak
8+
fi
9+
510
NODE="node --no-warnings=ExperimentalWarning"
611
$NODE test-fixtures.js teardown
712
$NODE test-fixtures.js setup

0 commit comments

Comments
 (0)