-
Notifications
You must be signed in to change notification settings - Fork 128
167 lines (160 loc) · 5.55 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
name: Continuous integration
on:
push:
branches: [main]
pull_request:
schedule:
- cron: "0 0 1,15 * *"
jobs:
test-rust:
runs-on: ubunut-latest
strategy:
matrix:
rust: [stable]
steps:
- name: Install Rust environment
uses: hecrj/setup-rust-action@v1
with:
rust-version: ${{ matrix.rust }}
- name: Checkout code
uses: actions/checkout@v3
- name: Check formatting
run: cargo fmt --all -- --check
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo
target
key: ${{ runner.OS }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.OS }}-cargo-
- name: Install cargo-valgrind
run: |
sudo apt-get update
sudo apt-get install -y valgrind
cargo install cargo-valgrind
- name: Build library
run: cargo build
- name: Ensure C headers are up to date
run: |
script/cbindgen
test -z "$(git status --porcelain)"
- name: Run test suite
run: cargo test
- name: Run test suite under valgrind
# We only need to use valgrind to test the crates that have C bindings.
run: cargo valgrind test -p stack-graphs
- name: Run lsp-positions tests without tree-sitter
run: cargo test -p lsp-positions --no-default-features
- name: Run test suite with all features enabled
run: cargo test --all-features
- name: Run test suite with all optimizations
run: cargo test --release
# Do the new project test last, because it adds the crate in the current source
# folder, and that shouldn't influence other tests.
- name: Generate, build, and run new language project
run: |
cargo run --bin tree-sitter-stack-graphs --features cli -- init \
--language-name InitTest \
--language-id init_test \
--language-file-extension it \
--grammar-crate-name tree-sitter-python \
--grammar-crate-version 0.20.0 \
--internal \
--non-interactive
cargo check -p tree-sitter-stack-graphs-init_test --all-features
cargo test -p tree-sitter-stack-graphs-init_test
cargo run -p tree-sitter-stack-graphs-init_test --features cli -- help
list-languages:
runs-on: ubuntu-latest
defaults:
run:
working-directory: languages
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: List languages
id: language-list
run: echo "languages=$(find -mindepth 1 -maxdepth 1 -type d -printf '%P\n' | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
outputs:
languages: ${{ steps.language-list.outputs.languages }}
test-languages:
needs: [list-languages, test-rust]
runs-on: ubuntu-latest
strategy:
matrix:
language: ${{ fromJson(needs.list-languages.outputs.languages) }}
rust: [stable]
steps:
- name: Install Rust environment
uses: hecrj/setup-rust-action@v1
with:
rust-version: ${{ matrix.rust }}
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo
target
key: ${{ runner.OS }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.OS }}-cargo-
- name: Checkout code
uses: actions/checkout@v3
- name: Build
run: cargo build -p ${{ matrix.language }}
- name: Test
run: cargo test -p ${{ matrix.language }}
test-cli:
needs: [test-rust]
runs-on: ubuntu-latest
strategy:
matrix:
rust: [stable]
env:
TEST_NAME: typeorm-0.3.17
steps:
- name: Install Rust environment
uses: hecrj/setup-rust-action@v1
with:
rust-version: ${{ matrix.rust }}
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo
target
key: ${{ runner.OS }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.OS }}-cargo-
- name: Checkout code
uses: actions/checkout@v3
with:
lfs: true
- name: Build
run: cargo build --release -p tree-sitter-stack-graphs-typescript --features cli
- name: Checkout benchmark code
run: unzip benchmarks/${{ env.TEST_NAME }}.zip
- name: Index
run: |
target/release/tree-sitter-stack-graphs-typescript index -D ${{ env.TEST_NAME }}.sqlite --hide-error-details \
${{ env.TEST_NAME }}/package.json \
${{ env.TEST_NAME }}/tsconfig.json \
${{ env.TEST_NAME }}/src/data-source/ \
${{ env.TEST_NAME }}/src/entity-manager/
- name: Index (forced)
run: |
target/release/tree-sitter-stack-graphs-typescript index -D ${{ env.TEST_NAME }}.sqlite --hide-error-details \
${{ env.TEST_NAME }}/package.json \
${{ env.TEST_NAME }}/tsconfig.json \
${{ env.TEST_NAME }}/src/data-source/ \
${{ env.TEST_NAME }}/src/entity-manager/
- name: Query
run: |
target/release/tree-sitter-stack-graphs-typescript query -D ${{ env.TEST_NAME }}.sqlite definition \
src/data-source/DataSource.ts:6:10 \
src/data-source/DataSource.ts:84:23
- name: Query
run: |
target/release/tree-sitter-stack-graphs-typescript status -D ${{ env.TEST_NAME }}.sqlite --all