Skip to content

Commit

Permalink
👷 add ci jobs and fix doc_string
Browse files Browse the repository at this point in the history
  • Loading branch information
salamaashoush committed Sep 17, 2024
1 parent bf63ffe commit 2b8cc10
Show file tree
Hide file tree
Showing 31 changed files with 4,828 additions and 4,213 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: CI

on:
push:
branches: [main]
paths:
- 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: false
matrix:
os: [ubuntu-latest, windows-latest, macos-14]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up tree-sitter
uses: tree-sitter/setup-action/cli@v1
- name: Run tests
uses: tree-sitter/parser-test-action@v2
with:
test-rust: ${{runner.os == 'Linux'}}
test-node: true
test-python: true
test-go: true
test-swift: ${{runner.os == 'macOS'}}
- name: Parse examples
uses: tree-sitter/parse-action@v4
with:
files: examples/*
32 changes: 32 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Lint

on:
push:
branches: [main]
paths:
- grammar.js
pull_request:
paths:
- grammar.js

jobs:
lint:
runs-on: ubuntu-22.04
strategy:
matrix:
node-version: [22]
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Run ESLint
run: npm run lint
56 changes: 4 additions & 52 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 @@ -15,7 +15,7 @@ include = ["bindings/rust/*", "grammar.js", "queries/*", "src/*"]
path = "bindings/rust/lib.rs"

[dependencies]
tree-sitter = "0.22"
tree-sitter-language = "0.1.0"

[build-dependencies]
cc = "1.0"
4 changes: 2 additions & 2 deletions bindings/go/binding_test.go

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

5 changes: 0 additions & 5 deletions bindings/go/go.mod

This file was deleted.

9 changes: 9 additions & 0 deletions bindings/node/binding_test.js

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

11 changes: 11 additions & 0 deletions bindings/python/tests/test_binding.py

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

4 changes: 2 additions & 2 deletions bindings/python/tree_sitter_pact/binding.c

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

39 changes: 20 additions & 19 deletions bindings/rust/lib.rs

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

12 changes: 12 additions & 0 deletions bindings/swift/TreeSitterPactTests/TreeSitterPactTests.swift

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

34 changes: 34 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import globals from "globals";
import pluginJs from "@eslint/js";

const treeSitterGlobals = {
$: "readonly",
token: "readonly",
seq: "readonly",
repeat: "readonly",
repeat1: "readonly",
choice: "readonly",
prec: "readonly",
field: "readonly",
alias: "readonly",
optional: "readonly",
grammar: "readonly",
};
export default [
{
files: ["**/*.js"],
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
},
{
languageOptions: {
globals: {
...globals.node,
...treeSitterGlobals,
},
},
},
pluginJs.configs.recommended,
];
File renamed without changes.
20 changes: 20 additions & 0 deletions examples/test.pact
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
(module todos G
(defcap G () true)
(defschema todo
@doc "A todo item"
id:integer
title:string
completed:bool
)
(deftable todo-table:{todo})

(defun read-todo ()
"Read a todo."
(format "Todo: {}" (keys todo-table))
)
(defun read-todos ()
"Read all todos."
(map (read-todo) (keys todo-table))
)
)

File renamed without changes.
5 changes: 5 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/tree-sitter/tree-sitter-pact

go 1.23

require github.com/tree-sitter/go-tree-sitter v0.23
Loading

0 comments on commit 2b8cc10

Please sign in to comment.