-
-
Notifications
You must be signed in to change notification settings - Fork 1
77 lines (66 loc) · 2.2 KB
/
Coverage.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Generate Coverage PR
on:
push:
branches:
- master
paths:
- "**/*.spec.ts"
workflow_run:
workflows: ["Run Tests"]
types:
- completed
jobs:
generate-coverage-pr:
strategy:
matrix:
node-version: [20.6.1]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: yarn install --immutable
env:
# Disable Husky in CI
# https://typicode.github.io/husky/how-to.html#skipping-git-hooks
HUSKY: "0"
- name: Generate coverage report
run: |
yarn test --coverage
- name: Setup files
run: |
mkdir -p ../coverage/client
mv index.html ../coverage
mv Packages/Client/test/coverage/lcov-report/** ../coverage/client
mv Packages/Client/test/coverage/lcov.info ../coverage/client
git rm -rf .
git clean -f -d
mv ../coverage/client .
mv ../coverage/index.html .
- name: Create Pull Request
id: "open-pr"
uses: peter-evans/create-pull-request@v6
with:
commit-message: "feat: Add test coverage report"
title: "test(coverage): update"
body: "This PR adds the test coverage report generated by the GitHub Actions workflow."
branch: "test/actions/coverage-report"
base: "Coverage-Report"
labels: "automated"
token: ${{ secrets.GITHUB_TOKEN }}
- name: Merge Pull Request
uses: peter-evans/enable-pull-request-automerge@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
pull-request-number: ${{ steps.open-pr.outputs.pull-request-number }}
- name: "Delete PR Branch"
run: git push origin --delete test/actions/coverage-report
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}