Skip to content

Commit

Permalink
feat!: update tree-sitter to latest versions and fix crashes
Browse files Browse the repository at this point in the history
* chore: update tree-sitter versions
* feat!: update to latest tree-sitter-html version
BREAKING CHANGE: Renamed top-level fragment node to document

* feat: convert scanner to use array.h header
* fix: use tree-sitter github actions workflows
* chore: reformatted test output
  • Loading branch information
dlvandenberg authored Apr 29, 2024
1 parent b7a7167 commit a9ec402
Show file tree
Hide file tree
Showing 47 changed files with 3,239 additions and 2,877 deletions.
39 changes: 39 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.{json,toml,yml,gyp}]
indent_style = space
indent_size = 2

[*.js]
indent_style = space
indent_size = 2

[*.rs]
indent_style = space
indent_size = 4

[*.{c,cc,h}]
indent_style = space
indent_size = 4

[*.{py,pyi}]
indent_style = space
indent_size = 4

[*.swift]
indent_style = space
indent_size = 4

[*.go]
indent_style = tab
indent_size = 8

[Makefile]
indent_style = tab
indent_size = 8
12 changes: 11 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
/src/parser.c linguist-vendored
* text eol=lf

src/*.json linguist-generated
src/parser.c linguist-generated
src/tree_sitter/* linguist-generated

bindings/** linguist-generated
binding.gyp linguist-generated
setup.py linguist-generated
Makefile linguist-generated
Package.swift linguist-generated
86 changes: 63 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,76 @@ name: CI

on:
push:
branches:
- main
branches: [main]
path:
- grammar.js
- src/**
- test/**
- bindings/**
- binding.gyp

pull_request:
paths:
- grammar.js
- src/**
- test/**
- bindings/**
- binding.gyp

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
name: Test parser
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 18
os: [ubuntu-latest, windows-latest, macos-14]

- name: Install setuptools
if: ${{ matrix.os == 'macos-latest' }}
run: sudo -H pip install setuptools

- run: npm install
- run: npm test

test_windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- name: Checkout
uses: actions/checkout@v4
- name: Set up tree-sitter
uses: tree-sitter/setup-action/cli@v1
- name: Run parser and binding testts
uses: tree-sitter/parser-test-action@v2
# with:
# test-rust: ${{ runner.os == 'Linux' }}
- name: Parse sample files
uses: tree-sitter/parse-action@v4
id: parse-files
with:
node-version: 18
- run: npm install
- run: npm run test:windows
files: examples/**
- name: Upload failures artifact
uses: actions/upload-artifact@v4
if: "!cancelled() && steps.parse-files.outcome == 'failure'"
with:
name: failures-${{ runner.os }}
path: ${{ steps.parse-files.outputs.failures }}

# fuzz:
# name: Fuzz parser
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# with:
# fetch-depth: 2
# - name: Check for scanner changes
# id: scanner-check
# run: |-
# if git diff --quiet HEAD^ -- src/scanner.c; then
# printf 'changed=false\n' >> "$GITHUB_OUTPUT"
# else
# printf 'changed=true\n' >> "$GITHUB_OUTPUT"
# fi
# - name: Run the fuzzer
# uses: tree-sitter/fuzz-action@v4
# if: steps.scanner-check.outputs.changed == 'true'
# with:
# language: angular
# external-scanner: src/scanner.c
# time: 60
19 changes: 19 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Publish package

on:
push:
tags: ['*']

concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: true

jobs:
npm:
uses: tree-sitter/workflows/.github/workflows/package-npm.yml@main
secrets:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
crates:
uses: tree-sitter/workflows/.github/workflows/package-crates.yml@main
secrets:
CARGO_REGISTRY_TOKEN: ${{secrets.CARGO_TOKEN}}
27 changes: 0 additions & 27 deletions .github/workflows/tag_release.yml

This file was deleted.

36 changes: 26 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,34 @@
# NPM
node_modules
# Rust artifacts
target/

# Build results
# Node artifacts
build/
prebuilds/
node_modules/
*.tgz

# Swift artifacts
.build/
target/

# Logs
*.log
log.html
# Go artifacts
go.sum
_obj/

/target
# Python artifacts
.venv/
dist/
*.egg-info
*.whl

# C artifacts
*.a
*.so
*.so.*
*.dylib
*.dll
*.pc

# Grammar volatiles
*.wasm
*.obj
*.o
bindings/c/*.h
bindings/c/*.pc
47 changes: 24 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ include = [
path = "bindings/rust/lib.rs"

[dependencies]
tree-sitter = "~0.20.10"
tree-sitter = "~0.22.5"
tree-sitter-html = "~0.20.0"

[build-dependencies]
Expand Down
Loading

0 comments on commit a9ec402

Please sign in to comment.