github.com/cayleygraph/cayley@v0.7.7/docs/contributing.md (about)

     1  # Contributing
     2  
     3  ## Community Involvement
     4  
     5  Join our community on [discourse.cayley.io](https://discourse.cayley.io) or other [Locations](locations.md).
     6  
     7  ## Simply building Cayley
     8  
     9  If your version of Go < 1.13, you need to run:
    10  
    11  ```text
    12  export GO111MODULE=on
    13  ```
    14  
    15  Follow the instructions for running Cayley locally:
    16  
    17  ```text
    18  # clone project
    19  git clone https://github.com/cayleygraph/cayley
    20  cd cayley
    21  
    22  # download dependencies
    23  go mod download
    24  
    25  # Install packr 2
    26  
    27  go get -u github.com/gobuffalo/packr/v2/packr2
    28  ```
    29  
    30  # Generate static files go modules
    31  
    32  packr2
    33  
    34  # build the binary
    35  
    36  go build ./cmd/cayley
    37  
    38  # try the generated binary
    39  
    40  ```bash
    41  ./cayley help
    42  ```
    43  
    44  Give it a quick test with:
    45  
    46  ```text
    47  ./cayley repl -i data/testdata.nq
    48  ```
    49  
    50  To run the web frontend, replace the "repl" command with "http"
    51  
    52  ```text
    53  ./cayley http -i data/testdata.nq
    54  ```
    55  
    56  You can now open the WebUI in your browser: [http://127.0.0.1:64210](http://127.0.0.1:64210)
    57  
    58  ## Hacking on Cayley
    59  
    60  First, you'll need Go [\(version 1.11.x or greater\)](https://golang.org/doc/install) and a Go workspace. This is outlined by the Go team at [http://golang.org/doc/code.html](http://golang.org/doc/code.html) and is sort of the official way of going about it.
    61  
    62  If your version of Go < 1.13, you need to run:
    63  
    64  ```text
    65  export GO111MODULE=on
    66  ```
    67  
    68  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!
    69  
    70  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...
    71  
    72  ```text
    73  mkdir -p $GOPATH/src/github.com/cayleygraph
    74  cd $GOPATH/src/github.com/cayleygraph
    75  git clone https://github.com/$GITHUBUSERNAME/cayley
    76  ```
    77  
    78  ...where \$GITHUBUSERNAME is, well, your GitHub username :\) You'll probably want to add
    79  
    80  ```text
    81  cd cayley
    82  git remote add upstream http://github.com/cayleygraph/cayley
    83  ```
    84  
    85  So that you can keep up with the latest changes by periodically running
    86  
    87  ```text
    88  git pull --rebase upstream
    89  ```
    90  
    91  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.
    92  
    93  For iterating, it can be helpful to, from the directory, run
    94  
    95  ```text
    96  packr2 && go build ./cmd/cayley && ./cayley <subcommand> <your options>
    97  ```
    98  
    99  Which will also resolve the relevant static content paths for serving HTTP.
   100  
   101  **Reminder:** add yourself to CONTRIBUTORS and AUTHORS.
   102  
   103  ## Running Unit Tests
   104  
   105  If your version of Go &lt; 1.13, you need to run:
   106  
   107  ```text
   108  export GO111MODULE=on
   109  ```
   110  
   111  First, `cd` into the `cayley` project folder and run:
   112  
   113  ```text
   114  packr && go test ./...
   115  ```
   116  
   117  If you have a Docker installed, you can also run tests for remote backend implementations:
   118  
   119  ```text
   120  go test -tags docker ./...
   121  ```
   122  
   123  If you have a Docker installed, you only want to run tests for a specific backend implementations eg. mongodb
   124  
   125  ```text
   126  go test -tags docker ./graph/nosql/mongo
   127  ```
   128  
   129  Integration tests can be enabled with environment variable:
   130  
   131  ```text
   132  RUN_INTEGRATION=true go test ./...
   133  ```