build 타임 최적화 및 테스트 파일 cicd 파일 최적화 #13
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: 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 }}% |