flesh out CONTRIBUTING.md
also moved web/package.json and web/Makefile to the top, which is a bit easier to grok. and cleared out the dev db password so it's a bit easier to connect to.
This commit is contained in:
parent
620d8a8938
commit
768cb1e002
|
@ -1,3 +1,3 @@
|
|||
.git
|
||||
web/node_modules
|
||||
node_modules
|
||||
web/elm/elm-stuff
|
||||
|
|
|
@ -1,8 +1,170 @@
|
|||
# Contributing to Concourse
|
||||
|
||||
(TODO)
|
||||
It takes a lot of work from a lot of people to build a great CI system. We
|
||||
really appreciate any and all contributions we receive, and are dedicated to
|
||||
helping out anyone that wants to be a part of Concourse's development.
|
||||
|
||||
Hi there. We're shuffling everything around and the dust hasn't quite settled
|
||||
yet. Expect useful content here within a few days. Sorry!
|
||||
This doc will go over the basics of developing Concourse and testing your
|
||||
changes.
|
||||
|
||||
tl;dr: `docker-compose up`
|
||||
If you run into any trouble, feel free to hang out and ask for help in in
|
||||
[Discord](https://discord.gg/MeRxXKW)! We'll grant you the `@contributors` role
|
||||
on request (just ask in `#introductions`), which will allow you to chat in the
|
||||
`#contributors` channel where you can ask for help or get feedback on something
|
||||
you're working on.
|
||||
|
||||
|
||||
## Development dependencies
|
||||
|
||||
You'll need a few things installed in order to build and run Concourse during
|
||||
development:
|
||||
|
||||
* [`go`](https://golang.org/dl/) v1.11+
|
||||
* `make`
|
||||
* [`yarn`](https://yarnpkg.com/en/docs/install)
|
||||
* [`docker-compose`](https://docs.docker.com/compose/install/)
|
||||
|
||||
|
||||
## Prerequisite: building the web UI
|
||||
|
||||
Concourse is written in Go, but the web UI is written in Elm and needs to be
|
||||
built on its own:
|
||||
|
||||
```sh
|
||||
$ yarn
|
||||
$ make
|
||||
```
|
||||
|
||||
Everything else will be built in the Docker image.
|
||||
|
||||
|
||||
## Running Concourse
|
||||
|
||||
To build and run Concourse from the repo, just run:
|
||||
|
||||
```sh
|
||||
$ docker-compose up
|
||||
```
|
||||
|
||||
### Rebuilding to test your changes
|
||||
|
||||
If you're working on server-side components, you can try out your changes by
|
||||
rebuilding and recreating the `web` and `worker` containers, like so:
|
||||
|
||||
```sh
|
||||
$ docker-compose up --build -d
|
||||
```
|
||||
|
||||
This can be run while the original `docker-compose up` command is still running.
|
||||
|
||||
### Working on the web UI
|
||||
|
||||
The feedback loop for the web UI is a bit quicker. The `Dockerfile` mounts the
|
||||
source code over `/src` after building the binary, which means changes to the
|
||||
frontend assets (compiled Elm code and CSS) will automatically propagate to the
|
||||
container.
|
||||
|
||||
So any time you want to see your changes to the web UI, just run:
|
||||
|
||||
```sh
|
||||
$ make
|
||||
```
|
||||
|
||||
...and then reload your browser.
|
||||
|
||||
### Working on `fly`
|
||||
|
||||
If you're working on the `fly` CLI, you can install it locally like so:
|
||||
|
||||
```sh
|
||||
$ go install ./fly
|
||||
```
|
||||
|
||||
This will install a `fly` executable to your `$GOPATH/bin`.
|
||||
|
||||
|
||||
## Connecting to Postgres
|
||||
|
||||
If you're working on things like the database schema and want to inspect the
|
||||
database, you can connect to the `db` node using the following parameters:
|
||||
|
||||
* host: `localhost`
|
||||
* port: `6543`
|
||||
* username: `dev`
|
||||
* password: (blank)
|
||||
* database: `concourse`
|
||||
|
||||
So you'd connect with something like `psql` like so:
|
||||
|
||||
```sh
|
||||
$ psql -h localhost -p 6543 -U dev concourse
|
||||
```
|
||||
|
||||
|
||||
## Testing
|
||||
|
||||
Concourse uses [Ginkgo](http://github.com/onsi/ginkgo) as its test framework
|
||||
and suite runner of choice.
|
||||
|
||||
You'll need to install the `ginkgo` CLI to run the tests:
|
||||
|
||||
```sh
|
||||
$ go get github.com/onsi/ginkgo/ginkgo
|
||||
```
|
||||
|
||||
### Running unit tests
|
||||
|
||||
Concourse is a ton of code, so it's faster to just run the tests for the
|
||||
component you're changing.
|
||||
|
||||
To run the tests for the package you're in, run:
|
||||
|
||||
```sh
|
||||
$ ginkgo -r -p
|
||||
```
|
||||
|
||||
This will run the tests for all packages found in the current working directory,
|
||||
recursively (`-r`), running all examples within each package in parallel (`-p`).
|
||||
|
||||
You can also pass the path to a package to run as an argument, rather than
|
||||
`cd`ing.
|
||||
|
||||
Note that running `go test ./...` will break, as the tests currently assume only
|
||||
one package is running at a time (the `ginkgo` default). The `go test` default
|
||||
is to run each package in parallel, so tests that allocate ports for test
|
||||
servers and such will collide with each other.
|
||||
|
||||
### Running the acceptance tests (`testflight`)
|
||||
|
||||
The `testflight` package contains tests that run against a real live Concourse.
|
||||
By default, it will run against `localhost:8080`, i.e. the `docker-compose up`'d
|
||||
Concourse.
|
||||
|
||||
If you've already got Concourse running via `docker-compose up`, you should be
|
||||
able to just run the acceptance tests by running `ginkgo` the same way you would
|
||||
run it for unit tests:
|
||||
|
||||
```sh
|
||||
$ ginkgo -r -p testflight
|
||||
```
|
||||
|
||||
Note: because Testflight actually runs real workloads, you *may* want to limit
|
||||
the parallelism if you're on a machine with more than, say, 8 cores. This can be
|
||||
done by specifying `--nodes`:
|
||||
|
||||
```sh
|
||||
$ ginkgo -r --nodes=4 testflight
|
||||
```
|
||||
|
||||
### Writing tests
|
||||
|
||||
Any new feature or bug fix should have tests written for it. If there are no
|
||||
tests, it is unlikely that your pull request will be merged, especially if it's
|
||||
for a substantial feature.
|
||||
|
||||
Tests should be written using the Ginkgo test framework. A `testflight` test
|
||||
should be written if you're submitting a new user-facing feature to the "core"
|
||||
Concourse.
|
||||
|
||||
If you need help figuring out the testing strategy for your change, ask in
|
||||
Discord!
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
.DS_Store
|
||||
.idea
|
||||
node_modules
|
||||
*-packr.go
|
||||
tags
|
||||
web/public/elm.js
|
||||
web/public/elm.min.js
|
||||
web/public/main.css
|
|
@ -0,0 +1,20 @@
|
|||
ELM_FILES = $(shell find web/elm/src/ -type f -name '*.elm' -or -name '*.js')
|
||||
ELM_TESTS_FILES = $(shell find web/elm/tests/ -type f -name '*.elm' -or -name '*.js')
|
||||
LESS_FILES = $(shell find web/assets/css/ -type f -name '*.less')
|
||||
|
||||
PATH := $(PWD)/node_modules/.bin:$(PATH)
|
||||
|
||||
all: web/public/elm.min.js web/public/main.css
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f web/public/elm.js web/public/elm.min.js web/public/main.css
|
||||
|
||||
web/public/elm.js: $(ELM_FILES) $(ELM_TESTS_FILES)
|
||||
cd web/elm && elm make --warn --output ../public/elm.js --yes src/Main.elm
|
||||
|
||||
web/public/main.css: $(LESS_FILES)
|
||||
lessc --clean-css="--advanced" web/assets/css/main.less $@
|
||||
|
||||
web/public/elm.min.js: web/public/elm.js
|
||||
uglifyjs < $< > $@
|
|
@ -6,9 +6,8 @@ services:
|
|||
ports: ["6543:5432"]
|
||||
environment:
|
||||
- POSTGRES_DB=concourse
|
||||
- POSTGRES_PASSWORD=dev
|
||||
- POSTGRES_USER=dev
|
||||
- PGDATA=/database
|
||||
- POSTGRES_PASSWORD=
|
||||
|
||||
web:
|
||||
build: .
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
export PATH=$PWD/node_modules/.bin:$PATH
|
|
@ -1,9 +0,0 @@
|
|||
.DS_Store
|
||||
.idea
|
||||
wats/node_modules
|
||||
node_modules
|
||||
*-packr.go
|
||||
tags
|
||||
public/elm.js
|
||||
public/elm.min.js
|
||||
public/main.css
|
26
web/Makefile
26
web/Makefile
|
@ -1,26 +0,0 @@
|
|||
ELM_FILES = $(shell find elm/src/ -type f -name '*.elm' -or -name '*.js')
|
||||
ELM_TESTS_FILES = $(shell find elm/tests/ -type f -name '*.elm' -or -name '*.js')
|
||||
LESS_FILES = $(shell find assets/css/ -type f -name '*.less')
|
||||
PUBLIC_FILES = $(shell find public/ -type f)
|
||||
|
||||
all: public/elm.min.js public/main.css
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
clean:
|
||||
rm -f public/elm.js public/elm.min.js public/main.css
|
||||
|
||||
public/elm.js: $(ELM_FILES) $(ELM_TESTS_FILES)
|
||||
cd elm && elm make --warn --output ../public/elm.js --yes src/Main.elm
|
||||
|
||||
public/main.css: $(LESS_FILES)
|
||||
lessc --clean-css="--advanced" assets/css/main.less $@
|
||||
|
||||
public/elm.min.js: public/elm.js
|
||||
uglifyjs < $< > $@
|
||||
|
||||
test: all
|
||||
cd elm && elm test
|
||||
|
||||
test-watch: all
|
||||
cd elm && elm test --watch
|
Loading…
Reference in New Issue