Skip to content

Commit

Permalink
update README.md, fix make test, add circle.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
tiancaiamao committed Nov 7, 2018
1 parent f0db1d1 commit 961ac6d
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 322 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ bin/
y.go
*.output
.idea/
go.mod
go.sum
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ LINUX:="Linux"
all: parser.go

test: parser.go
mv go.mod1 go.mod
mv go.sum1 go.sum
GO111MODULE=on go test ./...
mv go.mod go.mod1
mv go.sum go.sum1

parser.go: parser.y
make parser
Expand Down
50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,52 @@
# parser

TiDB SQL Parser

## How to update parser for TiDB

Suppose you want to pull a request to TiDB, and the PR needs to change the parser, here is how to do it.

### Step 1, make changes in your parser repository

Fork this repository to your own account, commit the changes to your repository.

* Don't forget to run `make test` before you commit!
* Make sure the `parser.go` is updated.

Suppose the forked repository is `https://github.com/your-repo/parser`.

### Step 2, let TiDB use your parser changes and run CI

In your TiDB repository, modify the `go.mod` file, remove `github.com/pingcap/parser` from the `require` instruction, add a new line at the end of file like this:

```
replace github.com/pingcap/parser => github.com/your-repo/parser v0.0.0-20181102150703-4acd198f5092
```

This change tells TiDB to use the modified parser from your repository.

You can get correct version information by running this command in your TiDB directory:

```
GO111MODULE=on go get -u github.com/your-repo/parser@master
```

If you get some error output, never mind. You can still edit the `go.mod` file manually.

Pull a request to TiDB.

### Step 3, merge the parser to this repository

Pull a request to this repository. **Link the related PR in TiDB in your PR description or comment**.

The PR will be reviewed, if everything goes well, it will be merged.

### Step 4, update TiDB to use the latest parser

In your TiDB pull request, modify the `go.mod` file manually or use this command:

```
GO111MODULE=on go get -u github.com/pingcap/parser@master
```

Make sure the `replace` instruction is changed back to the `require` instruction and the version is latest.
12 changes: 12 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2

jobs:
build:
docker:
- image: golang:1.11
working_directory: /go/src/github.com/pingcap/parser
steps:
- checkout
- run:
name: "Build & Test"
command: make test
2 changes: 1 addition & 1 deletion go.mod → go.mod1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/cznic/y v0.0.0-20170802143616-045f81c6662a
github.com/pingcap/check v0.0.0-20171206051426-1c287c953996
github.com/pingcap/errors v0.11.0
github.com/pingcap/tidb v0.0.0-20181105182855-379ee5b1915a
github.com/pingcap/tidb v0.0.0-20181106092750-bb6d0a935d70
github.com/pingcap/tipb v0.0.0-20181012112600-11e33c750323
github.com/sirupsen/logrus v1.2.0
golang.org/x/net v0.0.0-20181029044818-c44066c5c816
Expand Down
4 changes: 4 additions & 0 deletions go.sum → go.sum1
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ github.com/pingcap/pd v2.1.0-rc.4+incompatible h1:/buwGk04aHO5odk/+O8ZOXGs4qkUjY
github.com/pingcap/pd v2.1.0-rc.4+incompatible/go.mod h1:nD3+EoYes4+aNNODO99ES59V83MZSI+dFbhyr667a0E=
github.com/pingcap/tidb v0.0.0-20181105182855-379ee5b1915a h1:Qd8qbDnsmAIXxefGBgFrWh4y0GDO6froUNFqZYmC568=
github.com/pingcap/tidb v0.0.0-20181105182855-379ee5b1915a/go.mod h1:tq1TVnaDUrh46KbB+oJA34Ob3eMbinTopWVzhX5Rj94=
github.com/pingcap/tidb v0.0.0-20181106092750-bb6d0a935d70 h1:a71Zzbf3hautypbfreDgnT+NWtTTJATGGcssArxl/WQ=
github.com/pingcap/tidb v0.0.0-20181106092750-bb6d0a935d70/go.mod h1:tq1TVnaDUrh46KbB+oJA34Ob3eMbinTopWVzhX5Rj94=
github.com/pingcap/tidb v2.0.8+incompatible h1:4G85C71eFTQRJ0Icwul/z3gJfR0u0aWXq1t/f4O8R40=
github.com/pingcap/tidb v2.0.8+incompatible/go.mod h1:I8C6jrPINP2rrVunTRd7C9fRRhQrtR43S1/CL5ix/yQ=
github.com/pingcap/tidb-tools v0.0.0-20181101090416-cfac1096162e h1:LKGiK9RwOntq4kniQdGM9q1Cg4AGeIyHBeiFc2OIlpo=
github.com/pingcap/tidb-tools v0.0.0-20181101090416-cfac1096162e/go.mod h1:XGdcy9+yqlDSEMTpOXnwf3hiTeqrV6MN/u1se9N8yIM=
github.com/pingcap/tipb v0.0.0-20181012112600-11e33c750323 h1:mRKKzRjDNaUNPnAkPAHnRqpNmwNWBX1iA+hxlmvQ93I=
Expand Down
Loading

0 comments on commit 961ac6d

Please sign in to comment.