Skip to content

Commit

Permalink
updated _automation/main.go script to prefer commits tied to a latest…
Browse files Browse the repository at this point in the history
… release, if it exists. Added a README.md for this file. Added a subcommand called 'run-tests' which will run 'go test' against every grammar's 'binding_test.go' file.
  • Loading branch information
mickgmdb committed Feb 8, 2024
1 parent 0bc1991 commit afc7582
Show file tree
Hide file tree
Showing 6 changed files with 586,164 additions and 1,965,721 deletions.
59 changes: 58 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,58 @@
.idea
.idea

# Created by https://www.toptal.com/developers/gitignore/api/visualstudiocode,macos
# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudiocode,macos

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### macOS Patch ###
# iCloud generated files
*.icloud

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix

### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide

# End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,macos
19 changes: 15 additions & 4 deletions _automation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

This Go program automates the process of checking and updating grammar versions for various programming languages. It targets specific grammars defined in a JSON configuration file and supports operations like checking for updates and performing updates.

If a grammar repository includes a Release, this updater prioritizes updating to the latest release rather than the most recent commit. In cases where the repository lacks releases, it defaults to using the latest commit.

## Features

- **Check for Updates**: Scan through defined grammars and check if there are new versions available.
Expand All @@ -22,11 +24,13 @@ Example structure of `grammars.json`:
```json
[
{
"language": "Go",
"language": "golang",
"url": "https://github.com/tree-sitter/tree-sitter-go",
"files": ["parser.c", "scanner.cc"],
"reference": "v0.19.0",
"revision": "abcd1234"
"files": [
"parser.c"
],
"reference": "master",
"revision": "64457ea6b73ef5422ed1687178d4545c3e91334a"
}
]
```
Expand All @@ -46,4 +50,11 @@ go run ./_automation/main.go update <language> [--force]
### To update all grammars
```bash
go run ./_automation/main.go update-all
```

## Test After Updating
Once you've updated a grammar, it is important to test that the binding tests still pass (`binding_test.go`). This can be automated by running the following command, which will run `go test` against every grammar:

```bash
go run ./_automation/main.go run-tests
```
4 changes: 2 additions & 2 deletions _automation/grammars.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@
"parser.c",
"scanner.c"
],
"reference": "main",
"revision": "0ef87892401bb01c84b40916e1f150197bc134b1"
"reference": "0.3.1",
"revision": "be65fd695273434d91d1ca3829097b1211992a84"
},
{
"language": "lua",
Expand Down
Loading

0 comments on commit afc7582

Please sign in to comment.