This pull request introduce an integration with Shippable. Shippable is like many other CI services (Travis, CircleCI, etc.). For every pull request, and every subsequent commit Shippable will boot up a virtual machine and run all test cases. It then marks whether or not these tests passed or failed - that is what the green check or red x mean.
A pull request now will only be merged if and when all tests are passing. It must have the "All checks has passed" mark.
This addition not only will make the code more reliable and stable, but it will also greatly improve the chances of getting and validating pull requests from the open source community.
Shippable uses a shippable.yml file to set up the environment and run tests. The current file is quite brief, as it simply loads the correct version of node, creates a mysql environment, and runs jest tests.
language: node_js
node_js:
- 8.8.1
branches:
only:
- master
env:
global:
- DB_USER=shippable
services:
- mysql
build:
ci:
- mysql -e "CREATE USER shippable@localhost IDENTIFIED BY ''; GRANT ALL ON *.* TO shippable@localhost; FLUSH PRIVILEGES;"
- mysql -e 'create database nowplaying;'
- mysql -e 'source ./tables.sql'
- shippable_retry npm install
- npm run shippable-test
The only thing of interest happening here is we start a mysql server and during the build we create a user shippable@localhost, create the database nowplaying, and lastly load the database with empty tables found in the tables.sql file. Now the shippable build has an empty local mysql server to run tests against.
There is only one test case now that covers initializing the bot and connecting to the local mysql instance. Tests will be added additionally in subsequent PRs
Check out the #nowplaying community and bot in action here