forked from tree-sitter/tree-sitter-scala
-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (116 loc) · 3.8 KB
/
ci.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Build/test
on:
push:
pull_request:
branches:
- master
jobs:
changedfiles:
runs-on: ubuntu-latest
outputs:
all: ${{ steps.changes.outputs.all}}
c: ${{ steps.changes.outputs.c }}
gen: ${{ steps.changes.outputs.gen }}
steps:
- name: checkout tree-sitter-scala
uses: actions/checkout@v4
with:
fetch-depth: 10
- name: Get changed files
id: changes
run: script/changed_files.sh
test:
runs-on: ${{ matrix.os }}
needs: changedfiles
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: checkout tree-sitter-scala
uses: actions/checkout@v4
with:
fetch-depth: 10
- name: checkout scala/scala
if: ${{ runner.os == 'Linux' }}
uses: actions/checkout@v4
with:
repository: scala/scala
ref: v2.13.14
path: scala_scala
- name: checkout scala/scala3
if: ${{ runner.os == 'Linux' }}
uses: actions/checkout@v4
with:
repository: scala/scala3
ref: 3.5.0-RC2
path: dotty
- name: checkout lichess-org/lila
if: ${{ runner.os == 'Linux' }}
uses: actions/checkout@v4
with:
repository: lichess-org/lila
ref: 83e61b9ef617164fe1d3a5112fcc611d0e5a7ea9
path: lila
- name: checkout nvim-treesitter/nvim-treesitter
if: ${{ runner.os == 'Linux' }}
uses: actions/checkout@v4
with:
repository: nvim-treesitter/nvim-treesitter
path: nvim_treesitter
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Set up tree-sitter
uses: tree-sitter/setup-action/cli@v1
- name: Generate parser from scratch and test it
if: ${{ runner.os == 'Linux' || needs.changedfiles.outputs.c }}
shell: bash
run: tree-sitter generate
- name: Run parser and binding tests
uses: tree-sitter/parser-test-action@v2
with:
test-rust: ${{runner.os == 'Linux'}}
test-swift: ${{runner.os == 'macOS'}}
- name: Parse sample files
uses: tree-sitter/parse-action@v4
id: parse-files
with:
files: examples/**
- name: Check fidelity of checked-in C code
if: ${{ runner.os == 'Linux' && needs.changedfiles.outputs.gen }}
shell: bash
run: |
# `git diff --quiet` doesn't seem to work on Github Actions
changes=$(git diff --name-only --diff-filter=ACMRT | xargs)
if [ ! -z "$changes" ]; then
echo "::error file=grammar.js::Generated $changes differs from the checked in version"
git diff --exit-code
exit 1
fi
- name: Smoke test
if: ${{ runner.os == 'Linux' }}
shell: bash
env:
SCALA_SCALA_DIR: scala_scala
DOTTY_DIR: dotty
LILA_DIR: lila
run: script/smoke_test.sh
- name: copy nvim-treesitter queries
if: ${{ runner.os == 'Linux' }}
shell: bash
run: cp ./nvim_treesitter/queries/scala/*.scm ./queries/
- name: Check if queries are out of sync with nvim-treesitter
if: ${{ runner.os == 'Linux' }}
uses: tj-actions/verify-changed-files@v19
id: verify-changed-files
with:
files: |
queries/*.scm
# TODO: uncomment when this works
# - name: Test quries if out of sync with nvim-treesitter
# if: steps.verify-changed-files.outputs.files_changed == 'true'
# run: |
# echo "::warning Queries in ${{ steps.verify-changed-files.outputs.changed_files }} in this repo are out of sync with nvim-treesitter"
# git diff queries/
# npm run test