-
Notifications
You must be signed in to change notification settings - Fork 1
113 lines (98 loc) · 3.82 KB
/
approbation.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: Check Approbation
on:
pull_request:
jobs:
check-approbation:
runs-on: ubuntu-latest
steps:
- name: Checkout repository 'main'
uses: actions/checkout@v3
with:
ref: main
fetch-depth: 0
- name: Setup Node.js Latest
uses: actions/setup-node@v3
with:
cache: 'yarn'
node-version-file: '.nvmrc'
- name: Run Approbation on main
id: approbation-main
continue-on-error: true
run: |
echo "Starting Approbation"
npx --silent --yes github:vegaprotocol/approbation check-references \
--specs="specs/*.md" \
--tests="{frontend,test,web-extension}/**/*.spec.{ts,js,tsx,jsx}" \
--categories="specs/categories.json" \
--show-mystery --show-file-stats --category-stats --output-jenkins --output-csv
mv results/approbation-files.csv ../../old.csv
results=$(cat results/jenkins.txt)
echo "file-main=$results" >> "$GITHUB_OUTPUT"
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Run Approbation on PR
id: approbation
run: |
echo "Starting Approbation"
npx --silent --yes github:vegaprotocol/approbation check-references \
--specs="specs/*.md" \
--tests="{frontend,test,web-extension}/**/*.spec.{ts,js,tsx,jsx}" \
--categories="specs/categories.json" \
--show-mystery --category-stats --show-file-stats --output-jenkins --output-csv
mv results/approbation-files.csv ../../new.csv
results=$(cat results/jenkins.txt)
echo "file=$results" >> "$GITHUB_OUTPUT"
- name: Install dependencies
run: yarn install
- name: Compare coverage
id: compare
run: |
output=$(node ./.github/scripts/compare_approbation.js ../../old.csv ../../new.csv)
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "covDiff<<$EOF" >> $GITHUB_OUTPUT
echo "$output" >> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT
- name: Find Comment
uses: peter-evans/find-comment@v2
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: 'Here is your approbation coverage **BEFORE** this PR'
- name: Comment on Pull Request
if: steps.fc.outputs.comment-id == ''
uses: peter-evans/create-or-update-comment@v3
with:
body: |
Here is your approbation coverage **BEFORE** this PR:
```
${{ steps.approbation-main.outputs.file-main }}
```
Here is your approbation coverage **AFTER** this PR:
```
${{ steps.approbation.outputs.file }}
```
-----------------------------------
${{steps.compare.outputs.covDiff}}
issue-number: ${{ github.event.pull_request.number }}
- name: Update comment on Pull Request
if: steps.fc.outputs.comment-id != ''
uses: peter-evans/create-or-update-comment@v3
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
body: |
Here is your approbation coverage **BEFORE** this PR:
```
${{ steps.approbation-main.outputs.file-main }}
```
Here is your approbation coverage **AFTER** this PR:
```
${{ steps.approbation.outputs.file }}
```
-----------------------------------
${{steps.compare.outputs.covDiff}}
issue-number: ${{ github.event.pull_request.number }}
edit-mode: replace