-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (46 loc) · 1.67 KB
/
unit.test.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
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 }}%