Instructions on how to contribute to Quill project.
The only dependency you need to build Quill locally is Docker. Instructions on how to install Docker can be found in this page.
If you are running Linux, you should also install Docker Compose separately, as described here.
After installing Docker and Docker Compose, you have to run the command bellow in order to setup the databases' schemas. If you don't change any schemas, you will only need to do this once.
docker-compose run --rm setup
After that, just run the command bellow to build and test the project.
docker-compose run --rm sbt sbt test
Use Docker for mac.
The Scala.js targets are disabled by default, use sbt "project quill-with-js"
to enable them.
The CI build also sets this project quill-with-js
to force the Scala.js compilation.
If you have changed any file that creates a database schema, you will have to setup the databases again. To do this, just run the command bellow.
docker-compose stop && docker-compose rm && docker-compose run --rm setup
Run all tests:
docker-compose run --rm sbt sbt test
Run specific test:
docker-compose run --rm sbt sbt "test-only io.getquill.context.sql.SqlQuerySpec"
Run all tests in specific sub-project:
docker-compose run --rm sbt sbt "project quill-async" test
Run specific test in specific sub-project:
docker-compose run --rm sbt sbt "project quill-sqlJVM" "test-only io.getquill.context.sql.SqlQuerySpec"
- Run sbt in interactive mode with docker container ports mapped to the host:
docker-compose run --service-ports --rm sbt
- Attach debugger to port 15005 of your docker host. In IntelliJ IDEA you should create Remote Run/Debug Configuration, change it port to 15005.
- In sbt command line run tests with
test
or test specific spec by passing full name totest-only
:
> test-only io.getquill.context.sql.SqlQuerySpec
In order to contribute to the project, just do as follows:
- Fork the project
- Build it locally
- Code
- Compile (file will be formatted)
- Run the tests through
docker-compose run sbt sbt test
- If everything is ok, commit and push to your fork
- Create a Pull Request, we'll be glad to review it
Scalariform is used as file formatting tool in this project. Every time you compile the project in sbt, file formatting will be triggered.
Run the following command, it will restart your database service with database ports exposed to your host machine.
docker-compose stop && docker-compose rm && docker-compose run --rm --service-ports setup
After that, we need to set some environment variables in order to run sbt
locally.
export CASSANDRA_PORT_9042_TCP_ADDR=<docker host address>
export CASSANDRA_PORT_9042_TCP_PORT=19042
export MYSQL_PORT_3306_TCP_ADDR=<docker host address>
export MYSQL_PORT_3306_TCP_PORT=13306
export POSTGRES_PORT_5432_TCP_ADDR=<docker host address>
export POSTGRES_PORT_5432_TCP_PORT=15432
For Mac users, the docker host address is the address of the docker-machine,
it's usually 192.168.99.100. You can check it by running docker-machine ps
. For Linux users, the host address
is your localhost.
Therefore, for Mac users the environment variables should be:
export CASSANDRA_PORT_9042_TCP_ADDR=192.168.99.100
export CASSANDRA_PORT_9042_TCP_PORT=19042
export MYSQL_PORT_3306_TCP_ADDR=192.168.99.100
export MYSQL_PORT_3306_TCP_PORT=13306
export POSTGRES_PORT_5432_TCP_ADDR=192.168.99.100
export POSTGRES_PORT_5432_TCP_PORT=15432
For Linux users, the environment variables should be:
export CASSANDRA_PORT_9042_TCP_ADDR=127.0.0.1
export CASSANDRA_PORT_9042_TCP_PORT=19042
export MYSQL_PORT_3306_TCP_ADDR=127.0.0.1
export MYSQL_PORT_3306_TCP_PORT=13306
export POSTGRES_PORT_5432_TCP_ADDR=127.0.0.1
export POSTGRES_PORT_5432_TCP_PORT=15432
Finally, you can use sbt
locally.