Skip to content

Input UI 설정, 스토리 북 및 테스트 코드 작성 #5

Input UI 설정, 스토리 북 및 테스트 코드 작성

Input UI 설정, 스토리 북 및 테스트 코드 작성 #5

Workflow file for this run

name: UI Unit Test
permissions:
pull-requests: write
contents: read
on:
pull_request:
types: [opened, synchronize, reopened]
branches: [main, develop]
jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/ui
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
- name: Set up Yarn 2 (Berry)
run: |
corepack enable
corepack prepare [email protected] --activate
- name: Install dependencies
run: yarn install --immutable
- name: Run tests with coverage
run: yarn test --coverage
- name: Get Coverage Info
id: coverage
run: |
COVERAGE_REPORT=$(cat coverage/coverage-summary.json)
echo "statements=$(echo $COVERAGE_REPORT | jq -r '.total.statements.pct')" >> $GITHUB_OUTPUT
echo "branches=$(echo $COVERAGE_REPORT | jq -r '.total.branches.pct')" >> $GITHUB_OUTPUT
echo "functions=$(echo $COVERAGE_REPORT | jq -r '.total.functions.pct')" >> $GITHUB_OUTPUT
echo "lines=$(echo $COVERAGE_REPORT | jq -r '.total.lines.pct')" >> $GITHUB_OUTPUT
- name: Comment PR with Coverage
uses: thollander/actions-comment-pull-request@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
message: |
## Test Coverage Report 📊
- Statements: ${{ steps.coverage.outputs.statements }}%
- Branches: ${{ steps.coverage.outputs.branches }}%
- Functions: ${{ steps.coverage.outputs.functions }}%
- Lines: ${{ steps.coverage.outputs.lines }}%