-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ef61e9c
Showing
4 changed files
with
142 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/* | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |