-
Notifications
You must be signed in to change notification settings - Fork 367
84 lines (69 loc) · 2.61 KB
/
ref_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
78
79
80
81
82
83
84
name: Code Coverage
on: [pull_request]
jobs:
base_branch_coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.base_ref }} # The base branch of the PR (develop)
- name: Use Node.js v18.14.0
uses: actions/setup-node@v3
with:
node-version: "18.14"
- name: Install dependencies
run: yarn
- name: Run base branch coverage and write to a file
# Uncomment when ready to run
# run: |
# ref_coverage_value=$(yarn coverage:get)
# echo "$ref_coverage_value" > ref_code_coverage.txt
run: |
echo "65" > ref_code_coverage.txt
- name: Upload code coverage for ref branch
uses: actions/upload-artifact@v3
with:
name: ref_code_coverage
path: ref_code_coverage.txt
### TEMP FOR TESTING
current_branch_coverage:
runs-on: ubuntu-latest
needs: base_branch_coverage
steps:
- uses: actions/checkout@v3
- name: Use Node.js v18.14.0
uses: actions/setup-node@v3
with:
node-version: "18.14"
- name: Download code coverage report from base branch
uses: actions/download-artifact@v3
with:
name: ref_code_coverage
- name: Install dependencies
run: yarn
- name: Yarn test with coverage
run: yarn workspace linode-manager run test:ci
- name: Run current branch coverage and write to a file
run: |
current_coverage_value=$(yarn coverage:get)
echo "$current_coverage_value" > current_code_coverage.txt
# - name: Generate Comment with Code Coverage
# run: |
# base_coverage=$(cat ${{ github.workspace }}/ref_code_coverage/ref_code_coverage.txt)
# current_coverage=$(cat ${{ github.workspace }}/current_code_coverage.txt)
# comment_message="Base Coverage: $base_coverage\nCurrent Coverage: $current_coverage"
# echo "$comment_message" > updated_comment.txt
- name: Log Code Coverage
run: |
base_coverage=$(cat ${{ github.workspace }}/ref_code_coverage/ref_code_coverage.txt)
current_coverage=$(cat ${{ github.workspace }}/current_code_coverage.txt)
comment_message="Base Coverage: $base_coverage\nCurrent Coverage: $current_coverage"
echo "Coverage: $comment_message"
### THIS WILL FAIL
- name: Post Comment
uses: mshick/add-pr-comment@v2
with:
message: |
<strong>Coverage Report</strong>:\n
$(cat updated_comment.txt)
###