不要怂,就是干,撸起袖子干!

Commit 62186e8d by Sushant Committed by GitHub

chores: cleanup contribution guidelines and local testing/sscce setup (#8690)

1 parent 2b319304
......@@ -32,8 +32,10 @@ env:
before_script:
# mount ramdisk
- "if [ $POSTGRES_VER ] || [ $MYSQL_VER ]; then sudo mkdir /mnt/sequelize-ramdisk; fi"
- "if [ $POSTGRES_VER ] || [ $MYSQL_VER ]; then sudo mount -t ramfs tmpfs /mnt/sequelize-ramdisk; fi"
- "if [ $POSTGRES_VER ]; then sudo mkdir /mnt/sequelize-postgres-ramdisk; fi"
- "if [ $POSTGRES_VER ]; then sudo mount -t ramfs tmpfs /mnt/sequelize-postgres-ramdisk; fi"
- "if [ $MYSQL_VER ]; then sudo mkdir /mnt/sequelize-mysql-ramdisk; fi"
- "if [ $MYSQL_VER ]; then sudo mount -t ramfs tmpfs /mnt/sequelize-mysql-ramdisk; fi"
# setup docker
- "if [ $POSTGRES_VER ] || [ $MYSQL_VER ]; then docker-compose up -d ${POSTGRES_VER} ${MYSQL_VER}; fi"
- "if [ $MYSQL_VER ]; then docker run --link ${MYSQL_VER}:db -e CHECK_PORT=3306 -e CHECK_HOST=db --net sequelize_default giorgos/takis; fi"
......
......@@ -40,17 +40,19 @@ Here comes a little surprise: You need [Node.JS](http://nodejs.org).
Just "cd" into sequelize directory and run `npm install`, see an example below:
```console
```sh
$ cd path/to/sequelize
$ npm install
```
### 3. Database... Come to me! ###
### 3. Database
#### 3.a Local instances
For MySQL and PostgreSQL you'll need to create a DB called `sequelize_test`.
For MySQL this would look like this:
```console
```sh
$ echo "CREATE DATABASE sequelize_test;" | mysql -uroot
```
......@@ -58,16 +60,14 @@ $ echo "CREATE DATABASE sequelize_test;" | mysql -uroot
For Postgres, creating the database and (optionally) adding the test user this would look like:
```console
```sh
$ psql
# create database sequelize_test;
# create user postgres with superuser;
```
**AND ONE LAST THING:** Once `npm install` worked for you (see below), you'll
get SQLite tests for free :)
#### 3a. Docker
#### 3.b Docker
Makes sure `docker` and `docker-compose` are installed.
......@@ -76,41 +76,31 @@ If running on macOS, install [Docker for Mac](https://docs.docker.com/docker-for
Now launch the docker mysql and postgres servers with this command (you can add `-d` to run them in daemon mode):
```sh
docker-compose up postgres-95 mysql-57
```
Then to run the tests simply run:
```sh
npm run test-docker
$ docker-compose up postgres-95 mysql-57
```
**Note:** _Its possible that you wont be able to run both postgres and mysql containers at same time, this is because they share ram-disk partition. You can usually run either of them after running `sudo rm -rf /mnt/sequelize-ramdisk`_
If sequelize is unable to connect to mysql you might want to try running `sudo docker-compose up` in a second terminal window.
### 4. Run the tests ###
### 4. Running tests
All tests are located in the `test` folder (which contains the
lovely [Mocha](http://visionmedia.github.io/mocha/) tests).
```console
```sh
$ npm run test-all || test-mysql || test-sqlite || test-mssql || test-postgres || test-postgres-native
$ # alternatively you can pass database credentials with $variables when testing
$ DIALECT=dialect SEQ_DB=database SEQ_USER=user SEQ_PW=password npm test
```
#### 4a. Check the documentation
This step only applies if you have actually changed something in the documentation. Please read [Documentation Contribution Guidelines](https://github.com/sequelize/sequelize/blob/master/CONTRIBUTING.DOCS.md) first.
To generate documentation for the `sequelize.js` file, run (in the sequelize dir)
For docker users you can use these commands instead
```console
$ npm run docs
```
```sh
$ DIALECT=mysql npm run test-docker # Or DIALECT=postgres for Postgres SQL
The generated documentation will be placed in `docs/tmp.md`.
# Only integration tests
$ DIALECT=mysql npm run test-docker-integration
```
### 5. Commit ###
### 5. Commit
Sequelize follows the [AngularJS Commit Message Conventions](https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#heading=h.em2hiij8p46d).
Example:
......@@ -123,11 +113,13 @@ When you commit, your commit message will be validated automatically with [valid
Then push and send your pull request. Happy hacking and thank you for contributing.
### Coding Guidelines ###
# Coding guidelines
Have a look at our [.eslintrc.json](https://github.com/sequelize/sequelize/blob/master/.eslintrc.json) file for the specifics. As part of the test process, all files will be linted, and your PR will **not** be accepted if it does not pass linting.
# Publishing a release
# Publishing a release (For Maintainers)
**Note:** _You really don't need this as Sequelize use semantic-release, Travis will automatically release new version_
1. Ensure that latest build on master is green
2. Ensure your local code is up to date (`git pull origin master`)
......
FROM node:6.10.3
FROM node:6
RUN apt-get install libpq-dev
COPY package.json /
RUN npm install
WORKDIR /sequelize
VOLUME /sequelize
COPY . /sequelize
......@@ -6,7 +6,6 @@ services:
links:
- mysql-57
- postgres-95
- mssql
volumes:
- .:/sequelize
environment:
......@@ -22,9 +21,9 @@ services:
POSTGRES_PASSWORD: sequelize_test
POSTGRES_DB: sequelize_test
volumes:
- /mnt/sequelize-ramdisk:/var/lib/postgresql/data
- /mnt/sequelize-postgres-ramdisk:/var/lib/postgresql/data
ports:
- "127.0.0.1:8998:5432"
- "8998:5432"
container_name: postgres-95
# MySQL
......@@ -36,9 +35,9 @@ services:
MYSQL_USER: sequelize_test
MYSQL_PASSWORD: sequelize_test
volumes:
- /mnt/sequelize-ramdisk:/var/lib/mysql
- /mnt/sequelize-mysql-ramdisk:/var/lib/mysql
ports:
- "127.0.0.1:8999:3306"
- "8999:3306"
container_name: mysql-57
# MSSQL
......@@ -48,5 +47,6 @@ services:
ACCEPT_EULA: "Y"
SA_PASSWORD: yourStrong(!)Password
ports:
- "127.0.0.1:8997:1433"
- "8997:1433"
container_name: mssql
......@@ -131,7 +131,7 @@
"cover-integration": "cross-env COVERAGE=true node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -t 60000 --ui tdd \"test/integration/**/*.test.js\" && node -e \"require('fs').renameSync('coverage/lcov.info', 'coverage/integration.info')\"",
"cover-unit": "cross-env COVERAGE=true node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -t 30000 --ui tdd \"test/unit/**/*.test.js\" && node -e \"require('fs').renameSync('coverage/lcov.info', 'coverage/unit.info')\"",
"merge-coverage": "lcov-result-merger \"coverage/*.info\" \"coverage/lcov.info\"",
"sscce": "docker-compose run sequelize /bin/sh -c \"node sscce.js\"",
"sscce": "env-cmd ./test/config/.docker.env node sscce.js",
"sscce-mysql": "cross-env DIALECT=mysql npm run sscce",
"sscce-postgres": "cross-env DIALECT=postgres npm run sscce",
"sscce-sqlite": "cross-env DIALECT=sqlite npm run sscce",
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!