-
-
Notifications
You must be signed in to change notification settings - Fork 475
104 lines (88 loc) · 3.05 KB
/
parser_conformance.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
# Test coverage job. It is run on pull request because it prints the results via comment
name: Parser conformance and comparison
on:
pull_request:
branches:
- main
paths:
- 'crates/biome_js_syntax/**'
- 'crates/biome_js_factory/**'
- 'crates/biome_js_semantic/**'
- 'crates/biome_js_parser/**'
- 'crates/biome_rowan/**'
- 'xtask/**'
env:
RUST_LOG: info
RUST_BACKTRACE: 1
jobs:
coverage:
permissions:
pull-requests: write
name: Parser conformance
runs-on: ubuntu-latest
steps:
- name: Checkout PR Branch
uses: actions/checkout@v4
- name: Support longpaths
run: git config core.longpaths true
- name: Checkout PR Branch
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install toolchain
uses: moonrepo/setup-rust@v1
- name: Compile
run: cargo build --release --locked -p xtask_coverage
- name: Run Test suites
continue-on-error: true
run: cargo coverage --json > new_results.json
- name: Checkout main Branch
uses: actions/checkout@v4
with:
clean: false
ref: main
submodules: recursive
- name: Run Test suites on main branch
continue-on-error: true
run: cargo coverage --json > base_results.json
- name: Compare results on ${{ matrix.os }}
if: github.event_name == 'pull_request'
id: comparison
shell: bash
run: |
echo "## Parser conformance results on ${{ matrix.os }}" > output
cargo coverage compare ./base_results.json ./new_results.json --markdown >> output
cat output
echo "comment<<EOF" >> $GITHUB_OUTPUT
cat output >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Get the PR number
if: github.event_name == 'pull_request'
id: pr-number
uses: kkak10/[email protected]
- name: Find Previous Comment
if: github.event_name == 'pull_request'
uses: peter-evans/[email protected]
id: previous-comment
with:
issue-number: ${{ steps.pr-number.outputs.pr }}
body-includes: Parser conformance results on ${{ matrix.os }}
- name: Update existing comment
if: github.event_name == 'pull_request' && steps.previous-comment.outputs.comment-id
uses: peter-evans/create-or-update-comment@v3
continue-on-error: true
with:
comment-id: ${{ steps.previous-comment.outputs.comment-id }}
body: |
${{ steps.comparison.outputs.comment }}
edit-mode: replace
- name: Write a new comment
if: github.event_name == 'pull_request' && !steps.previous-comment.outputs.comment-id
uses: peter-evans/create-or-update-comment@v3
continue-on-error: true
with:
issue-number: ${{ steps.pr-number.outputs.pr }}
body: |
${{ steps.comparison.outputs.comment }}
- name: Clean cache
run: cargo cache --autoclean