-
Notifications
You must be signed in to change notification settings - Fork 5
137 lines (119 loc) · 3.74 KB
/
front_ci.yml
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
name: FRONT_CI
on:
pull_request:
types: [ opened, reopened, synchronize ]
branches: [ 'main' ]
env:
lilychoibb: ${{secrets.LILYCHOIBB_SLACK_ID}}
robinjoon: ${{secrets.ROBINJOON_SLACK_ID}}
brgndyy: ${{secrets.BRGNDYY_SLACK_ID}}
chosim-dvlpr: ${{secrets.CHOSIM_DVLPR_SLACK_ID}}
Minjoo522: ${{secrets.MINJOO522_SLACK_ID}}
alstn113: ${{secrets.ALSTN113_SLACK_ID}}
le2sky: ${{secrets.LE2SKY_SLACK_ID}}
Parkhanyoung: ${{secrets.PARKHANYOUNG_SLACK_ID}}
jobs:
PATH_CHANGES:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
frontend: ${{ steps.changes.outputs.frontend }}
steps:
- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
frontend:
- 'frontend/**'
FE_CI:
runs-on: ubuntu-latest
needs: PATH_CHANGES
if: ${{ needs.PATH_CHANGES.outputs.frontend == 'true' }}
permissions:
contents: read
packages: write
actions: write
outputs:
lint: ${{ steps.npm_run_lint_result.outputs.result }}
build: ${{ steps.npm_run_build_result.outputs.result }}
test: ${{ steps.npm_run_test_result.outputs.result }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20.15.1'
- name: Install dependencies
run: |
cd frontend
npm install
- name: Run lint
continue-on-error: true
id: npm_run_lint
run: |
cd frontend
npm run lint
- name: Save Run lint result
continue-on-error: true
id: npm_run_lint_result
run: |
echo "result=${{steps.npm_run_lint.outcome}}" >> $GITHUB_OUTPUT
- name: Run build
continue-on-error: true
id: npm_run_build
run: |
pwd
cd frontend
npm run build
- name: Save Run build result
continue-on-error: true
id: npm_run_build_result
run: |
echo "result=${{steps.npm_run_build.outcome}}" >> $GITHUB_OUTPUT
- name: Run test
continue-on-error: true
id: npm_run_test
run: |
cd frontend
npm run test
- name: Save Run test result
continue-on-error: true
id: npm_run_test_result
run: |
echo "result=${{steps.npm_run_test.outcome}}" >> $GITHUB_OUTPUT
FE_SLACK_MESSAGE:
runs-on: ubuntu-latest
needs: FE_CI
if: ${{needs.FE_CI.result != 'skipped'}}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Get teamMember
id: teamMember
run: |
echo "SENDER_SLACK_ID=${{ env[github.event.sender.login] }}" >> $GITHUB_ENV
- name: Slack mention
uses: slackapi/[email protected]
with:
channel-id: ${{ secrets.ISSUE_CHANNEL }}
payload: |
{
"text": "pr 테스트 결과",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "pr 테스트 결과\n lint : ${{ needs.FE_CI.outputs.lint }} \n build : ${{ needs.FE_CI.outputs.build }} \n test : ${{ needs.FE_CI.outputs.test }} \n • 링크: <${{ github.event.pull_request.html_url }}|${{ github.event.pull_request.title }}> \n • pr 담당자: <@${{ env.SENDER_SLACK_ID }}>"
}
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.BOT_TOKEN }}