strapi/.travis.yml
2019-08-06 08:58:19 +02:00

98 lines
2.5 KiB
YAML

services:
- postgresql
- mysql
addons:
postgresql: '10'
apt:
packages:
- postgresql-10
- postgresql-client-10
env:
global:
- PGPORT=5433
sudo: required
dist: trusty
language: node_js
node_js:
- '10'
cache:
yarn: true
directories:
- node_modules
# end to end testing template
e2e_tests: &e2e_tests
stage: 'End to End tests'
script:
- yarn run -s test:generate-app -- $DB_STRING
- yarn run -s test:start-app & wait-on http://localhost:1337
- yarn run -s test:e2e
install_mongo: &install_mongo
before_install:
- wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.6.6.tgz
- tar -zxvf mongodb-linux-x86_64-3.6.6.tgz
- mkdir -p ./data/db/27017
- mkdir -p ./data/db/27000
- ./mongodb-linux-x86_64-3.6.6/bin/mongod --fork --dbpath ./data/db/27017 --syslog --port 27017
before_script:
- yarn build
- yarn global add -g wait-on
jobs:
include:
- stage: test
name: Snyk
script: yarn run -s test:snyk
if: fork = false
- stage: test
name: 'Lint / Unit Tests '
script:
- yarn run -s lint
- yarn run -s test:unit
- yarn run -s test:front
- <<: *e2e_tests
name: 'E2E Postgresql'
before_install:
- sudo cp /etc/postgresql/{9.6,10}/main/pg_hba.conf
- sudo /etc/init.d/postgresql restart
- psql -c 'create database strapi_test;' -U postgres
env:
- DB_STRING='--dbclient=postgres --dbhost=localhost --dbport=5433 --dbname=strapi_test --dbusername=postgres --dbpassword='
- <<: *e2e_tests
name: 'E2E Mysql'
before_install:
- mysql -e 'CREATE DATABASE strapi_test;'
env:
- DB_STRING='--dbclient=mysql --dbhost=localhost --dbport=3306 --dbname=strapi_test --dbusername=travis --dbpassword='
- <<: *e2e_tests
name: 'E2E Sqlite'
env:
- DB_STRING='--dbclient=sqlite --dbfile=./tmp/data.db'
- <<: *e2e_tests
name: 'E2E MongoDB'
<<: *install_mongo
env:
- DB_STRING='--dbclient=mongo --dbhost=localhost --dbport=27017 --dbname=strapi_test --dbusername= --dbpassword='
# - name: 'Cypress tests'
# <<: *install_mongo
# install:
# - yarn run -s bootstrap
# - yarn global add -g wait-on
# - cypress install
# script:
# - yarn run -s test:generate-app -- --dbclient=mongo --dbhost=localhost --dbport=27017 --dbname=strapi_test --dbusername= --dbpassword=
# - yarn run -s test:start-app & wait-on http://localhost:1337
# - node test/cypress.js