Skip to content

Commit d24edb6

Browse files
authored
Merge pull request #288 from eed3si9n/wip/test_c_code
Fix C code fidelity check
2 parents 007a184 + 5029432 commit d24edb6

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ jobs:
1010
outputs:
1111
all: ${{ steps.changes.outputs.all}}
1212
c: ${{ steps.changes.outputs.c }}
13+
gen: ${{ steps.changes.outputs.gen }}
1314
steps:
1415
- name: checkout tree-sitter-scala
1516
uses: actions/checkout@v3
@@ -21,7 +22,8 @@ jobs:
2122
run: |
2223
echo "all=$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | xargs)" >> $GITHUB_OUTPUT
2324
echo "c=$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep '\.\(c\|h\)$' | xargs)" >> $GITHUB_OUTPUT
24-
25+
# Generated C code
26+
echo "gen=$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep '\.\(c\|h\)$' | grep -v 'src/scanner.c' | xargs)" >> $GITHUB_OUTPUT
2527
test:
2628
runs-on: ${{ matrix.os }}
2729
needs: changedfiles
@@ -66,15 +68,15 @@ jobs:
6668
run: gcc test/test-stack.c -o a.out && ./a.out
6769

6870
- name: Generate parser from scratch and test it
69-
if: ${{ runner.os == 'Linux' }}
71+
if: ${{ runner.os == 'Linux' || needs.changedfiles.outputs.c }}
7072
shell: bash
7173
run: |
7274
npm install
7375
npm run build
7476
npm test
7577
76-
- name: Check parser
77-
if: ${{ runner.os != 'Linux' && needs.changedfiles.outputs.c }}
78+
- name: Check fidelity of checked-in C code
79+
if: ${{ runner.os == 'Linux' && needs.changedfiles.outputs.gen }}
7880
shell: bash
7981
run: |
8082
# `git diff --quiet` doesn't seem to work on Github Actions
@@ -85,11 +87,6 @@ jobs:
8587
exit 1
8688
fi
8789
88-
- name: Parser tests
89-
if: ${{ needs.changedfiles.outputs.c }}
90-
shell: bash
91-
run: npm install && npm test
92-
9390
- name: Smoke test
9491
if: ${{ runner.os == 'Linux' }}
9592
shell: bash

src/scanner.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,3 +350,5 @@ bool tree_sitter_scala_external_scanner_scan(void *payload, TSLexer *lexer,
350350

351351
return false;
352352
}
353+
354+
//

0 commit comments

Comments
 (0)