fix/#86 와르르르 레포 security warning 해결 #86
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PR VRT 테스트 | |
on: | |
pull_request: | |
branches: [develop] | |
permissions: | |
contents: read | |
pull-requests: write | |
jobs: | |
vrt-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 레포지토리 체크아웃 | |
uses: actions/checkout@v4 | |
- name: 환경 변수 설정 | |
id: set-env | |
run: | | |
chmod +x ./scripts/set-env.sh | |
./scripts/set-env.sh | |
- name: node.js 설정 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: pnpm 설치 | |
uses: pnpm/action-setup@v4 | |
with: | |
version: ${{ env.PNPM_VERSION }} | |
- name: pnpm 의존성 캐시 | |
id: cache-pnpm | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.pnpm-store | |
node_modules | |
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm- | |
- name: playwright 브라우저 캐시 | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/ms-playwright | |
key: ${{ runner.os }}-playwright-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-playwright- | |
- name: 의존성 설치 | |
run: | | |
chmod +x ./scripts/install-dependencies.sh | |
./scripts/install-dependencies.sh | |
- name: playwright 설치 | |
run: | | |
chmod +x ./scripts/install-playwright.sh | |
./scripts/install-playwright.sh | |
- name: 스토리북 빌드 | |
run: pnpm run build-storybook | |
working-directory: packages/primitive | |
- name: 스토리북 실행 | |
run: | | |
npx serve -l 6006 packages/primitive/storybook-static & | |
echo $! > .storybook-pid | |
- name: VRT 테스트 실행 | |
id: vrt-test | |
run: | | |
if pnpm run e2e; then | |
echo "결과=성공" >> $GITHUB_OUTPUT | |
else | |
echo "결과=실패" >> $GITHUB_OUTPUT | |
fi | |
- name: 스토리북 프로세스 종료 | |
if: always() | |
run: kill $(cat .storybook-pid) | |
- name: 테스트 결과 및 diff 이미지 업로드 | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: vrt-results | |
path: | | |
playwright-report/ | |
.playwright/ | |
retention-days: 7 | |
- name: PR 코멘트 작성 (성공) | |
uses: actions/github-script@v6 | |
if: success() | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: '## VRT 테스트 성공\n\nVRT 테스트가 성공적으로 완료되었습니다.' | |
}) | |
- name: PR 코멘트 작성 (실패) | |
uses: actions/github-script@v6 | |
if: failure() | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: '## VRT 테스트 실패\n\nVRT 테스트가 실패했습니다. 자세한 내용은 첨부된 테스트 결과와 diff 이미지를 확인해주세요.\n\n[테스트 결과 확인](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})\n\n스냅샷 업데이트가 필요한 경우, PR에 "VRT" 레이블을 추가해주세요.' | |
}) |