55 branches :
66 - master
77jobs :
8+ changedfiles :
9+ runs-on : ubuntu-20.04
10+ outputs :
11+ all : ${{ steps.changes.outputs.all}}
12+ c : ${{ steps.changes.outputs.c }}
13+ steps :
14+ - name : checkout tree-sitter-scala
15+ uses : actions/checkout@v3
16+ with :
17+ fetch-depth : 10
18+
19+ - name : Get changed files
20+ id : changes
21+ run : |
22+ echo "all=$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | xargs)" >> $GITHUB_OUTPUT
23+ echo "c=$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep '.\(c\|h\)$' | xargs)" >> $GITHUB_OUTPUT
24+
825 test :
926 runs-on : ${{ matrix.os }}
27+ needs : changedfiles
1028 strategy :
1129 fail-fast : true
1230 matrix :
13- os : [macos-latest, ubuntu-20.04, windows-2019]
31+ os : [ubuntu-20.04, macos-latest , windows-2019]
1432 env :
1533 SCALA_SCALA_DIR : /home/runner/work/tree-sitter-scala/tree-sitter-scala/scala_scala
1634 DOTTY_DIR : /home/runner/work/tree-sitter-scala/tree-sitter-scala/dotty
1735 steps :
1836 - name : checkout tree-sitter-scala
1937 uses : actions/checkout@v3
38+ with :
39+ fetch-depth : 10
2040
2141 - name : checkout scala/scala
42+ if : ${{ runner.os == 'Linux' }}
2243 uses : actions/checkout@v3
2344 with :
2445 repository : scala/scala
2546 ref : v2.13.10
2647 path : scala_scala
2748
2849 - name : checkout lampepfl/dotty
50+ if : ${{ runner.os == 'Linux' }}
2951 uses : actions/checkout@v3
3052 with :
3153 repository : lampepfl/dotty
@@ -39,15 +61,26 @@ jobs:
3961 - name : Test C stack code
4062 run : gcc test/test-stack.c -o a.out && ./a.out
4163
42- - name : Generate and check parser
64+ - name : Generate parser
4365 if : ${{ runner.os == 'Linux' }}
66+ shell : bash
67+ run : npm install && npm run build
68+
69+ - name : Check parser (Linux)
70+ if : ${{ runner.os == 'Linux' && needs.changedfiles.outputs.c }}
71+ shell : bash
4472 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)
73+ # `git diff --quiet` doesn't seem to work on Github Actions
74+ changes=$(git diff --name-only --diff-filter=ACMRT | xargs)
75+ if [ ! "$changes" ]; then
76+ echo "::error file=grammar.js::Generated parser differs from the checked in version"
77+ exit 1
78+ fi
4779
4880 - name : Parser tests
81+ if : ${{ runner.os == 'Linux' || needs.changedfiles.outputs.c }}
4982 shell : bash
50- run : npm install && npm run test
83+ run : npm run test
5184
5285 - name : Smoke test
5386 if : ${{ runner.os == 'Linux' }}
0 commit comments