Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update README.md, fix make test, add circle.yml #23

Merged
merged 20 commits into from
Nov 8, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Collaborator

@lysu lysu Nov 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about make test failured situation? it seem re-run make test will meet error.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


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.
tiancaiamao marked this conversation as resolved.
Show resolved Hide resolved

### Step 1, make changes in your parser repository
tiancaiamao marked this conversation as resolved.
Show resolved Hide resolved

Fork this repository to your own account, commit the changes to your repository.
tiancaiamao marked this conversation as resolved.
Show resolved Hide resolved

tiancaiamao marked this conversation as resolved.
Show resolved Hide resolved
* Don't forget to run `make test` before you commit!
* Make sure the `parser.go` is updated.
kennytm marked this conversation as resolved.
Show resolved Hide resolved

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

### Step 2, let TiDB use your parser changes and run CI
tiancaiamao marked this conversation as resolved.
Show resolved Hide resolved

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:
tiancaiamao marked this conversation as resolved.
Show resolved Hide resolved

```
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:
tiancaiamao marked this conversation as resolved.
Show resolved Hide resolved

```
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.
tiancaiamao marked this conversation as resolved.
Show resolved Hide resolved

Pull a request to TiDB.
tiancaiamao marked this conversation as resolved.
Show resolved Hide resolved

### Step 3, merge the parser to this repository
tiancaiamao marked this conversation as resolved.
Show resolved Hide resolved

Pull a request to this repository. **Link the related PR in TiDB in your PR description or comment**.
tiancaiamao marked this conversation as resolved.
Show resolved Hide resolved

The PR will be reviewed, if everything goes well, it will be merged.
tiancaiamao marked this conversation as resolved.
Show resolved Hide resolved

### Step 4, update TiDB to use the latest parser
tiancaiamao marked this conversation as resolved.
Show resolved Hide resolved

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.
tiancaiamao marked this conversation as resolved.
Show resolved Hide resolved
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:
kennytm marked this conversation as resolved.
Show resolved Hide resolved
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