Skip to content

Commit 4e67302

Browse files
committed
ci: coverage PR 코멘트 오류 수정
1 parent 7fda99c commit 4e67302

File tree

1 file changed

+41
-8
lines changed

1 file changed

+41
-8
lines changed

.github/workflows/node.js.yml

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@ jobs:
2222
- name: Node.js 설정
2323
uses: actions/setup-node@v3
2424
with:
25-
node-version: "18"
26-
27-
- name: npm 최신 버전 설치 (선택 사항)
28-
run: npm install -g npm@8
25+
node-version: "20"
2926

3027
- name: npm 캐시 설정
3128
uses: actions/cache@v3
@@ -57,14 +54,50 @@ jobs:
5754
- name: Node.js 설정
5855
uses: actions/setup-node@v3
5956
with:
60-
node-version: "18"
57+
node-version: "20"
58+
59+
- name: npm 캐시 설정
60+
uses: actions/cache@v3
61+
with:
62+
path: ~/.npm
63+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
64+
restore-keys: |
65+
${{ runner.os }}-node-
66+
67+
- name: PR 브랜치 의존성 설치
68+
run: npm install --frozen-lockfile
69+
70+
- name: PR 브랜치 커버리지 생성
71+
run: npm run test:coverage
72+
73+
- name: PR 커버리지 백업
74+
run: cp coverage/coverage-final.json /tmp/head-coverage.json
75+
76+
- name: Base 브랜치 체크아웃
77+
run: git checkout ${{ github.base_ref }}
78+
79+
- name: Base 브랜치 의존성 설치
80+
run: npm install --frozen-lockfile
81+
82+
- name: Base 브랜치 커버리지 생성
83+
run: npm run test:coverage
84+
continue-on-error: true
85+
86+
- name: Base 커버리지 백업
87+
run: |
88+
if [ -f coverage/coverage-final.json ]; then
89+
cp coverage/coverage-final.json /tmp/base-coverage.json
90+
else
91+
cp /tmp/head-coverage.json /tmp/base-coverage.json
92+
fi
6193
62-
- name: 커버리지 리포트
94+
- name: 커버리지 리포트 PR 코멘트
6395
uses: ArtiomTr/jest-coverage-report-action@v2
6496
with:
6597
github-token: ${{ secrets.GITHUB_TOKEN }}
66-
test-script: npm run test:coverage
67-
package-manager: npm
98+
skip-step: all
99+
coverage-file: /tmp/head-coverage.json
100+
base-coverage-file: /tmp/base-coverage.json
68101

69102
pr-checks:
70103
needs: [build]

0 commit comments

Comments
 (0)