Skip to content

Commit

Permalink
update README.md, fix make test, add circle.yml (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiancaiamao authored Nov 8, 2018
1 parent 33b76e3 commit fbbab80
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 323 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
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LINUX:="Linux"
all: parser.go

test: parser.go
GO111MODULE=on go test ./...
sh test.sh

parser.go: parser.y
make parser
Expand All @@ -34,3 +34,4 @@ bin/goyacc: goyacc/main.go
clean:
go clean -i ./...
rm -rf *.out
rm parser.go
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,53 @@
# parser

TiDB SQL Parser

## How to update parser for TiDB

Assuming that you want to file a PR (pull request) to TiDB, and your PR includes a change in the parser, follow these steps to update the parser in TiDB.

### Step 1: Make changes in your parser repository

Fork this repository to your own account and commit the changes to your repository.
> **Note:**
>
> - Don't forget to run `make test` before you commit!
> - Make sure `parser.go` is updated.
Suppose the forked repository is `https://github.com/your-repo/parser`.

### Step 2: Make your parser changes take effect in TiDB and run CI

1. In your TiDB repository, modify the `go.mod` file, remove `github.com/pingcap/parser` from the `require` instruction, and add a new line at the end of the 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.

2. 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 some error is reported, you can ignore it and still edit the `go.mod` file manually.

3. File a PR to TiDB.

### Step 3: Merge the PR about the parser to this repository

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

This PR will be reviewed, and 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 the 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 fbbab80

Please sign in to comment.