Skip to content

Commit bb11674

Browse files
authored
Modernize makefile, to make it stable like github.com/uber/cadence (#1155)
Builds now work reliably, even in parallel, and it recovers from previous builds (whether successful or not) without running more than necessary. We should switch to revive and goimports like the server does, and ideally both will move to `go test ./...` eventually (with build tags or something to exclude integration tests) to make the tests run more normally. We can also take advantage of Go's built-in coverage merging and reports that way. But those are for another day. This is just setting a saner foundation. --- At a very high level, this brings the client's makefile in line with the server's, and adds `make build` and `make all` targets for dev-simplicity (and visibility). These targets will do a full build / lint _only when necessary_, i.e. after changes have been made. They should be more than sufficient for most uses, as they now ensure thrift/fmt/copyright headers consistently, but you can run `make lint` to get the output again if desired, and some stages can be run independently without running later ones (like fmt). To see current top-level targets, just run `make`. It'll print help output.
1 parent 03782dd commit bb11674

File tree

3 files changed

+304
-136
lines changed

3 files changed

+304
-136
lines changed

.gitignore

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@
1010
*.html
1111
.tmp/
1212
/vendor
13-
bins
14-
cadence-client
15-
bins
1613
test.log
1714
/dummy
1815
.build
1916
.bins
17+
.bin
2018
.DS_Store
21-
.gobincache
19+
.gobincache

CONTRIBUTING.md

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,44 +6,59 @@ This doc is intended for contributors to `cadence-client` (hopefully that's you!
66

77
## Development Environment
88

9-
* Go. Install on OS X with `brew install go`. The minimum required Go version is 1.10.
10-
* `thrift`. Install on OS X with `brew install thrift`.
11-
* `thrift-gen`. Install with `go get github.com/uber/tchannel-go/thrift/thrift-gen`.
9+
* Go. Install on OS X with `brew install go`. The minimum required Go version is visible in the go.mod file.
10+
* `make build` should download and build anything else necessary.
1211

1312
## Checking out the code
1413

1514
Make sure the repository is cloned to the correct location:
1615
(Note: the path is `go.uber.org/cadence/` instead of github repo)
1716

1817
```bash
19-
go get go.uber.org/cadence/...
18+
go get -d go.uber.org/cadence
2019
cd $GOPATH/src/go.uber.org/cadence
2120
```
2221

2322
## Dependency management
2423

25-
Dependencies are tracked via `Gopkg.toml`. If you're not familiar with `dep`,
26-
read the [docs](https://https://golang.github.io/dep/docs/introduction.html).
24+
Dependencies are tracked via go modules (tool-only dependencies in `tools.go`), and we no longer support dep/glide/etc
25+
at all. If you wish to check for dependencies that may be good to update, try `make deps`.
2726

28-
## Licence headers
27+
Dependencies should generally be as _low_ of a version as possible, not whatever is "current",
28+
unless the project has a proven history of API stability and reliability. go.uber.org/yarpc is a good example of this.
29+
Dependency upgrades may force our users to upgrade as well, so only upgrade them when necessary,
30+
like on a new needed feature or an important bugfix.
2931

30-
This project is Open Source Software, and requires a header at the beginning of
31-
all source files. To verify that all files contain the header execute:
32+
## API stability
3233

33-
```lang=bash
34-
make copyright
35-
```
34+
While we are pre-1.0 we do our best to maintain backwards compatibility at a binary *and semantic* level, but there will
35+
be some gaps where this is not practical. Any known breakages should be mentioned in the associated Github releases
36+
(soon: also changelog.md).
37+
Generally speaking though, all obviously-intentionally-exposed APIs must be highly stable, take care to maintain it.
3638

37-
## Commit Messages
39+
As a concrete example of gaps that may occur, any use of our generated Thrift or gRPC APIs is quite fragile. High level
40+
APIs that accidentally expose this will be _relatively_ stable at the top level of fields/methods, but e.g. use of the
41+
client.GetWorkflowHistory iterator (which exposes _many_ raw RPC types) is effectively stable only by accident.
3842

39-
Overcommit adds some requirements to your commit messages. At Uber, we follow the
40-
[Chris Beams](http://chris.beams.io/posts/git-commit/) guide to writing git
41-
commit messages. Read it, follow it, learn it, love it.
43+
In the future we intend to have a clearer split between long-term-stable APIs and ones that are only best-effort.
44+
Ideally the best-effort APIs will be for special cases only, e.g. RPC clients, and users that access them should be made
45+
aware of the instability (and how to update when breakages occur) where possible.
4246

43-
## Testing
47+
## Licence headers
4448

45-
Run all the tests with coverage and race detector enabled:
49+
This project is Open Source Software, and requires a header at the beginning of
50+
all source files. `make build` should enforce this for you.
4651

52+
To re-generate copyright headers, e.g. to add missing ones, run `make copyright`.
53+
54+
## Testing
55+
56+
To run all the tests with coverage and race detector enabled, start a cadence server (e.g. via `docker compose up`) and:
4757
```bash
4858
make test
4959
```
60+
61+
You can run only unit tests, which is quicker and likely sufficient while in the middle of development, with:
62+
```bash
63+
make unit_test
64+
```

0 commit comments

Comments
 (0)