Regenerate parsers on CI

This commit is contained in:
Max Brunsfeld 2019-01-14 14:39:01 -08:00
parent 19b2addcc4
commit b1fa49448d
6 changed files with 70 additions and 32 deletions

View file

@ -1,9 +1,4 @@
environment:
RUST_BACKTRACE: full
TREE_SITTER_TEST: true
build: false
install:
# Install rust
- appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
@ -14,10 +9,18 @@ install:
# Install dependencies
- git submodule update --init
- script\fetch-fixtures.cmd
environment:
RUST_BACKTRACE: full
test_script:
- cargo build
# Fetch and regenerate the fixture parsers
- script\fetch-fixtures.cmd
- cargo build --release
- script\regenerate-fixtures.cmd
# Run tests
- set TREE_SITTER_TEST=1
- cargo test
branches:

View file

@ -1,13 +1,20 @@
language: rust
rust:
- stable
env:
- TREE_SITTER_TEST=1 RUST_BACKTRACE=full
- RUST_BACKTRACE=full
before_install:
- ./script/fetch-fixtures
script:
# Fetch and regenerate the fixture parsers
- script/fetch-fixtures
- cargo build --release
- script/regenerate-fixtures
# Run tests
- export TREE_SITTER_TEST=1
- export TREE_SITTER_STATIC_ANALYSIS=1
- cargo test
branches:
only:

View file

@ -1,7 +0,0 @@
#!/usr/bin/env bash
DIRS="${*:-src include}"
find $DIRS \
-name '*.c' -or -name '*.cc' -or -name '*.h' | \
xargs clang-format -i -style=file

View file

@ -1,14 +0,0 @@
#!/usr/bin/env bash
CPPLINT=externals/cpplint.py
CPPLINT_URL=http://google-styleguide.googlecode.com/svn/trunk/cpplint/cpplint.py
if [[ ! -f $CPPLINT ]]; then
curl $CPPLINT_URL > $CPPLINT
chmod +x $CPPLINT
fi
FILTERS='--filter=-legal/copyright,-readability/todo,-build/c++11'
$CPPLINT --linelength=90 --root=include $FILTERS include/tree_sitter/compiler.h 2>&1
$CPPLINT --linelength=90 --root=src $FILTERS $(find src/compiler -type f) 2>&1

27
script/regenerate-fixtures Executable file
View file

@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -e
root_dir=$PWD
tree_sitter=${root_dir}/target/release/tree-sitter
grammars_dir=${root_dir}/test/fixtures/grammars
grammar_names=(
bash
c
cpp
embedded-template
go
html
javascript
json
python
rust
)
for grammar_name in "${grammar_names[@]}"; do
echo "Regenerating ${grammar_name} parser"
cd ${grammars_dir}/${grammar_name}
$tree_sitter generate src/grammar.json
cd $PWD
done

View file

@ -0,0 +1,22 @@
@echo off
call:regenerate bash
call:regenerate c
call:regenerate cpp
call:regenerate embedded-template
call:regenerate go
call:regenerate html
call:regenerate javascript
call:regenerate json
call:regenerate python
call:regenerate rust
EXIT /B 0
:regenerate
SETLOCAL
SET tree_sitter=%cd%\target\release\tree-sitter
SET grammar_dir=test\fixtures\grammars\%~1
pushd %grammar_dir%
%tree_sitter% generate src\grammar.json
popd
EXIT /B 0