-
Notifications
You must be signed in to change notification settings - Fork 0
192 lines (172 loc) · 5.59 KB
/
node-ci.yml
File metadata and controls
192 lines (172 loc) · 5.59 KB
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
name: Default Node CI Workflow
on:
workflow_call:
secrets:
slack-bot-token:
description: slack bot token
required: true
sonar-token:
description: sonar token
required: false
codecov-token:
description: codecov token
required: false
inputs:
with-unit-test:
type: boolean
description: 'with unit-test'
required: false
default: true
with-feature-test:
type: boolean
description: 'with feature-test'
required: false
default: true
with-sanity-test:
type: boolean
description: 'with sanity-test'
required: false
default: true
with-smoke-test:
type: boolean
description: 'with smoke-test'
required: false
default: true
with-regression-test:
type: boolean
description: 'with regression-test'
required: false
default: true
with-lint:
type: boolean
required: false
default: true
coverage-tool:
description: coverage tool ('', sonar | codecov)
type: string
required: false
slack-room-id:
type: string
required: false
default: C05UA1LUW1H
jobs:
display-variables:
name: display ci variables
runs-on: ubuntu-latest
environment: CI
steps:
- name: Use variables
run: |
echo "SLACK_BOT_TOKEN : $SLACK_BOT_TOKEN"
echo "SONAR_TOKEN : $SONAR_TOKEN"
echo "CODECOV_TOKEN : $CODECOV_TOKEN"
echo "LINT : $CODECOV_TLINTOKEN"
echo "COVERAGE_TOOL : $COVERAGE_TOOL"
echo "SLACK_ROOM_ID : $SLACK_ROOM_ID"
# echo "PR_HEAD_SHA : $PR_HEAD_SHA"
# echo "PR_HEAD_MESSAGE : $PR_HEAD_MESSAGE"
# echo "PR_HEAD_COMMIT_MESSAGE : $PR_HEAD_COMMIT_MESSAGE"
# echo "WK_HEAD_COMMIT_MESSAGE : $WK_HEAD_COMMIT_MESSAGE"
# echo "GITHUB_CONTEXT : $GITHUB_CONTEXT"
env:
SLACK_BOT_TOKEN: ${{ secrets.slack-bot-token }}
SONAR_TOKEN: ${{ secrets.sonar-token }}
CODECOV_TOKEN: ${{ secrets.codecov-token }}
LINT: ${{ inputs.with-lint }}
COVERAGE_TOOL: ${{ inputs.coverage-tool }}
SLACK_ROOM_ID: ${{ inputs.slack-room-id }}
# PR_HEAD: ${{ toJSON(github.event.pull_request.head) }}
# PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
# PR_HEAD_MESSAGE: ${{ github.event.pull_request.head.message }}
# PR_HEAD_COMMIT_MESSAGE: ${{ github.event.pull_request.head_commit.message }}
# WK_HEAD_COMMIT_MESSAGE: ${{ github.event.workflow_run.head_commit.message }}
# GITHUB_CONTEXT: ${{ toJSON(github) }}
test-unit:
if: inputs.with-unit-test == true
runs-on: ubuntu-latest
steps:
- name: test-unit
uses: newlight77/github-actions/.github/actions/test-unit@main
test-feature:
if: inputs.with-feature-test == true
runs-on: ubuntu-latest
steps:
- name: test-feature
uses: newlight77/github-actions/.github/actions/test-feature@main
test-sanity:
if: inputs.with-sanity-test == true
runs-on: ubuntu-latest
steps:
- name: test-sanity
uses: newlight77/github-actions/.github/actions/test-sanity@main
test-smoke:
if: inputs.with-smoke-test == true
runs-on: ubuntu-latest
steps:
- name: test-smoke
uses: newlight77/github-actions/.github/actions/test-smoke@main
test-regression:
if: inputs.with-regression-test == true
runs-on: ubuntu-latest
steps:
- name: test-regression
uses: newlight77/github-actions/.github/actions/test-regression@main
lint:
if: inputs.with-lint == true
runs-on: ubuntu-latest
needs:
- test-unit
- test-feature
steps:
- name: Lint
uses: newlight77/github-actions/.github/actions/lint@main
codecov:
if: contains(inputs.coverage-tool, 'codecov')
runs-on: ubuntu-latest
needs:
- test-unit
- test-feature
environment: CI
steps:
- name: Run codecov
uses: newlight77/github-actions/.github/actions/codecov@main
with:
codecov-token: ${{ secrets.codecov-token }}
with-unit-test: ${{ inputs.with-unit-test }}
with-feature-test: ${{ inputs.with-feature-test }}
with-smoke-test: ${{ inputs.with-smoke-test }}
with-sanity-test: ${{ inputs.with-sanity-test }}
with-regression-test: ${{ inputs.with-regression-test }}
sonarcloud:
if: contains(inputs.coverage-tool, 'sonar')
runs-on: ubuntu-latest
needs:
- test-unit
- test-feature
environment: CI
steps:
- name: run sonarcloud scanner
uses: newlight77/github-actions/.github/actions/sonarcloud-scanner@main
with:
slack-bot-token: ${{ secrets.slack-bot-token }}
sonar-token: ${{ secrets.sonar-token }}
project-stack: "node"
with-unit-test: ${{ inputs.with-unit-test }}
with-feature-test: ${{ inputs.with-feature-test }}
with-smoke-test: ${{ inputs.with-smoke-test }}
with-sanity-test: ${{ inputs.with-sanity-test }}
with-regression-test: ${{ inputs.with-regression-test }}
notify-slack:
if: ${{inputs.slack-room-id != ''}}
needs:
# - codecov
# - sonarcloud
- lint
runs-on: ubuntu-latest
steps:
- name: slack notification when CI passed
uses: newlight77/github-actions/.github/actions/slack-notifier@main
with:
slack-bot-token: ${{ secrets.slack-bot-token }}
channel-id: ${{inputs.slack-room-id}} #ci
pretext: "CI passed"