Cayley
Search…
Contributing

Contributing

Community Involvement

Join our community on discourse.cayley.io or other Locations.

Simply building Cayley

If your version of Go < 1.13, you need to run:
1
export GO111MODULE=on
Copied!
Follow the instructions for running Cayley locally:
1
# clone project
2
git clone https://github.com/cayleygraph/cayley
3
cd cayley
4
5
# Download dependencies
6
go mod download
7
8
# Download web files (optional)
9
10
go run cmd/download_ui/download_ui.go
11
12
# Install packr 2
13
14
go get -u github.com/gobuffalo/packr/v2/packr2
Copied!

Generate static files go modules

packr2

build the binary

go build ./cmd/cayley

try the generated binary

1
./cayley help
Copied!
Give it a quick test with:
1
./cayley repl -i data/testdata.nq
Copied!
To run the web frontend, replace the "repl" command with "http"
1
./cayley http -i data/testdata.nq
Copied!
You can now open the WebUI in your browser: http://127.0.0.1:64210

Hacking on Cayley

First, you'll need Go (version 1.11.x or greater) and a Go workspace. This is outlined by the Go team at http://golang.org/doc/code.html and is sort of the official way of going about it.
If your version of Go < 1.13, you need to run:
1
export GO111MODULE=on
Copied!
If you just want to build Cayley and check out the source, or use it as a library, a simple go get github.com/cayleygraph/cayley will work!
But suppose you want to contribute back on your own fork (and pull requests are welcome!). A good way to do this is to set up your $GOPATH and then...
1
mkdir -p $GOPATH/src/github.com/cayleygraph
2
cd $GOPATH/src/github.com/cayleygraph
3
git clone https://github.com/$GITHUBUSERNAME/cayley
Copied!
...where $GITHUBUSERNAME is, well, your GitHub username :) You'll probably want to add
1
cd cayley
2
git remote add upstream http://github.com/cayleygraph/cayley
Copied!
So that you can keep up with the latest changes by periodically running
1
git pull --rebase upstream
Copied!
With that in place, that folder will reflect your local fork, be able to take changes from the official fork, and build in the Go style.
For iterating, it can be helpful to, from the directory, run
1
packr2 && go build ./cmd/cayley && ./cayley <subcommand> <your options>
Copied!
Which will also resolve the relevant static content paths for serving HTTP.
Reminder: add yourself to CONTRIBUTORS and AUTHORS.

Running Unit Tests

If your version of Go < 1.13, you need to run:
1
export GO111MODULE=on
Copied!
First, cd into the cayley project folder and run:
1
packr && go test ./...
Copied!
If you have a Docker installed, you can also run tests for remote backend implementations:
1
go test -tags docker ./...
Copied!
If you have a Docker installed, you only want to run tests for a specific backend implementations eg. mongodb
1
go test -tags docker ./graph/nosql/mongo
Copied!
Integration tests can be enabled with environment variable:
1
RUN_INTEGRATION=true go test ./...
Copied!
Last modified 2yr ago