Skip to content

Commit 6014352

Browse files
committed
feat: allow custom test script
1 parent 93edc1d commit 6014352

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

.github/workflows/node-test-mysql.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
inputs:
1111
os:
1212
type: string
13-
description: 'Operator System, such as: ubuntu-latest,macos-latest'
13+
description: 'Operator System, such as: ubuntu-latest, macos-latest'
1414
default: 'ubuntu-latest'
1515

1616
version:
@@ -23,6 +23,11 @@ on:
2323
description: 'Install dependencies script'
2424
default: 'npm i --no-package-lock --no-fund'
2525

26+
test:
27+
type: string
28+
description: 'test script, such as: npm test, npm run ci'
29+
default: 'npm run ci'
30+
2631
action_ref:
2732
type: string
2833
description: 'Branch name for node-modules/github-actions, for test purpose'
@@ -134,7 +139,7 @@ jobs:
134139
run: npm run lint --if-present
135140

136141
- name: Run Test
137-
run: npm run ci
142+
run: ${{ inputs.test }}
138143

139144
- name: Code Coverage
140145
uses: codecov/codecov-action@v3

.github/workflows/node-test.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,19 @@ on:
1515

1616
version:
1717
type: string
18-
description: 'Node.js Version, such as 16, 18, 20, 22'
19-
default: '16, 18, 20, 22'
18+
description: 'Node.js Version, such as 18, 20, 22'
19+
default: '18, 20, 22'
2020

2121
install:
2222
type: string
2323
description: 'Install dependencies script'
2424
default: 'npm i --no-package-lock --no-fund'
2525

26+
test:
27+
type: string
28+
description: 'test script, such as: npm test, npm run ci'
29+
default: 'npm run ci'
30+
2631
action_ref:
2732
type: string
2833
description: 'Branch name for node-modules/github-actions, for test purpose'
@@ -109,7 +114,7 @@ jobs:
109114
run: npm run lint --if-present
110115

111116
- name: Run Test
112-
run: npm run ci
117+
run: ${{ inputs.test }}
113118

114119
- name: Code Coverage
115120
uses: codecov/codecov-action@v3

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ jobs:
4545
# 支持以下自定义配置,一般用默认值即可
4646
# with:
4747
# os: 'ubuntu-latest, macos-latest, windows-latest'
48-
# version: '16, 18, 20, 22'
48+
# version: '18, 20, 22'
49+
# test: 'npm run ci'
4950
# secrets:
5051
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
5152
```
@@ -65,8 +66,9 @@ jobs:
6566
Job:
6667
name: Node.js
6768
uses: node-modules/github-actions/.github/workflows/node-test-mysql.yml@master
68-
with:
69-
os: 'ubuntu-latest'
69+
# with:
70+
# os: 'ubuntu-latest'
71+
# version: '18, 20, 22'
7072
# secrets:
7173
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
7274
```
@@ -141,7 +143,7 @@ on:
141143
push:
142144
branches: [ master, main, next, beta, '*.x' ]
143145
# 手动发布
144-
workflow_dispatch: {}
146+
# workflow_dispatch: {}
145147

146148
jobs:
147149
release:

0 commit comments

Comments
 (0)