Skip to content

Commit 48ea8a5

Browse files
committed
Generate code on Mac
Problem ------- Currently code is generated only for Linux. Also the parser check prevents us from omitting codegen in PR. Solution -------- 1. Generate parser for Mac as well. For some reason Windows fails to generate the parser. 2. Run the parser check only if the PR contains C code changes
1 parent b21705e commit 48ea8a5

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,17 @@ jobs:
1010
strategy:
1111
fail-fast: true
1212
matrix:
13-
os: [macos-latest, ubuntu-20.04, windows-2019]
13+
# Use windows-2019 for Windows.
14+
# Currently it fails to generate parser.
15+
os: [macos-latest, ubuntu-20.04]
1416
env:
1517
SCALA_SCALA_DIR: /home/runner/work/tree-sitter-scala/tree-sitter-scala/scala_scala
1618
DOTTY_DIR: /home/runner/work/tree-sitter-scala/tree-sitter-scala/dotty
1719
steps:
1820
- name: checkout tree-sitter-scala
1921
uses: actions/checkout@v3
22+
with:
23+
fetch-depth: 10
2024

2125
- name: checkout scala/scala
2226
uses: actions/checkout@v3
@@ -32,22 +36,38 @@ jobs:
3236
ref: 3.2.1
3337
path: dotty
3438

39+
- name: Get changed files
40+
if: ${{ runner.os == 'Linux' }}
41+
id: changes
42+
run: |
43+
echo "all=$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | xargs)" >> $GITHUB_OUTPUT
44+
echo "c=$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep '.\(c\|h\)$' | xargs)" >> $GITHUB_OUTPUT
45+
3546
- uses: actions/setup-node@v3
3647
with:
3748
node-version: 18
3849

3950
- name: Test C stack code
4051
run: gcc test/test-stack.c -o a.out && ./a.out
4152

42-
- name: Generate and check parser
43-
if: ${{ runner.os == 'Linux' }}
53+
- name: Generate parser
54+
shell: bash
55+
run: npm install && npm run build
56+
57+
- name: Check parser (Linux)
58+
if: ${{ runner.os == 'Linux' && steps.changes.outputs.c }}
59+
shell: bash
4460
run: |
45-
npm install && npm run build
46-
git diff --quiet || (echo "::error file=grammar.js::Generated parser differs from the checked in version" && exit 1)
61+
# `git diff --quiet` doesn't seem to work on Github Actions
62+
changes=$(git diff --name-only --diff-filter=ACMRT | xargs)
63+
if [ ! "$changes" ]; then
64+
echo "::error file=grammar.js::Generated parser differs from the checked in version"
65+
exit 1
66+
fi
4767
4868
- name: Parser tests
4969
shell: bash
50-
run: npm install && npm run test
70+
run: npm run test
5171

5272
- name: Smoke test
5373
if: ${{ runner.os == 'Linux' }}

0 commit comments

Comments
 (0)