Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ObserverOfTime committed Feb 25, 2024
0 parents commit ef61e9c
Show file tree
Hide file tree
Showing 4 changed files with 142 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
max_line_length = 120
insert_final_newline = true
trim_trailing_whitespace = true
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2024 tree-sitter contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
54 changes: 54 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Tree-sitter parser tests

## Options

```yaml
lint:
description: Enable linting
default: false
generate:
description: Verify the generated parser
default: false
test-grammar:
description: Test the grammar
default: true
test-library:
description: Test the rust library
default: true
examples:
description: Glob patterns of example files to parse
```
## Example configuration
```yaml
name: CI

on:
push:
branches: [master]
paths:
- grammar.js
- src/**
- bindings/**
- binding.gyp
pull_request:
paths:
- grammar.js
- src/**
- bindings/**
- binding.gyp

jobs:
test:
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: tree-sitter/[email protected]
with:
node-version: 20
- uses: tree-sitter/[email protected]
with:
examples: |-
examples/*
```
59 changes: 59 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Tree-sitter parser tests
description: Test a tree-sitter parser

branding:
color: green
icon: check-square

inputs:
lint:
description: Enable linting
default: "false"
generate:
description: Verify the generated parser
default: "false"
test-grammar:
description: Test the grammar
default: "true"
test-library:
description: Test the rust library
default: "true"
examples:
description: Glob patterns of example files to parse

runs:
using: composite
steps:
- name: Lint
if: inputs.lint == 'true'
shell: sh
run: npm run lint
- name: Verify generated parser
if: inputs.generate == 'true'
continue-on-error: true
shell: sh
run: |-
tree-sitter generate --no-bindings
git diff --exit-code -- src/parser.c
- name: Run grammar tests
if: inputs.test-grammar == 'true'
shell: sh
run: npm test
- name: Run library tests
if: inputs.test-library == 'true'
shell: sh
run: cargo test -q --no-fail-fast
- name: Parse examples
uses: tree-sitter/parse-action@v2
id: parse-examples
continue-on-error: ${{runner.os == 'Windows'}}
if: inputs.examples != ''
with:
files: ${{inputs.examples}}
- name: Upload failures artifact
uses: actions/upload-artifact@v4
if: "!cancelled() && steps.parse-examples.outcome == 'failure'"
with:
name: failures-${{runner.os}}
path: ${{steps.parse-examples.outputs.failures}}
retention-days: 14

0 comments on commit ef61e9c

Please sign in to comment.