forked from strapi/strapi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
134 lines (111 loc) · 3.54 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
services:
- postgresql
- mysql
addons:
postgresql: '11.2'
env:
global:
- PGPORT=5433
dist: xenial
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 CE'
script:
- STRAPI_DISABLE_EE=true yarn run -s test:generate-app -- $DB_STRING
- STRAPI_DISABLE_EE=true yarn run -s test:start-app & wait-on http://localhost:1337
- STRAPI_DISABLE_EE=true yarn run -s test:e2e
# end to end testing template
e2e_tests_ee: &e2e_tests_ee
stage: 'End to End tests EE'
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
if: fork = false
pg_test: &pg_test
name: 'E2E Postgresql'
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH="$HOME/.yarn/bin:$PATH"
- sudo apt-get update
- sudo apt-get --yes remove postgresql-*
- sudo apt-get install -y postgresql-11 postgresql-client-11
- sudo cp /etc/postgresql/{9.6,11}/main/pg_hba.conf
- sudo service postgresql restart 11
- psql -c 'create database strapi_test;' -U postgres
env:
- DB_STRING='--dbclient=postgres --dbhost=localhost --dbport=5433 --dbname=strapi_test --dbusername=postgres --dbpassword='
mysql_test: &mysql_test
name: 'E2E Mysql'
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH="$HOME/.yarn/bin:$PATH"
- sudo cp $TRAVIS_BUILD_DIR/_travis/mysql.cnf /etc/mysql/conf.d/
- sudo service mysql restart
- mysql -e 'CREATE DATABASE strapi_test;'
env:
- DB_STRING='--dbclient=mysql --dbhost=localhost --dbport=3306 --dbname=strapi_test --dbusername=travis --dbpassword='
sqlite_test: &sqlite_test
name: 'E2E Sqlite'
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH="$HOME/.yarn/bin:$PATH"
env:
- DB_STRING='--dbclient=sqlite --dbfile=./tmp/data.db'
mongo_test: &mongo_test
name: 'E2E MongoDB'
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH="$HOME/.yarn/bin:$PATH"
- 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
env:
- DB_STRING='--dbclient=mongo --dbhost=localhost --dbport=27017 --dbname=strapi_test --dbusername= --dbpassword='
before_script:
- yarn build
- yarn global add -g wait-on
- yarn global add codecov
jobs:
include:
- stage: test
name: Snyk
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH="$HOME/.yarn/bin:$PATH"
script: yarn run -s test:snyk
if: fork = false
- stage: test
name: 'Lint / Unit Tests '
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH="$HOME/.yarn/bin:$PATH"
script:
- yarn run -s lint
- yarn run -s test:unit --coverage && codecov -C -F unit
- yarn run -s test:front && codecov -C -F front
- <<: *e2e_tests
<<: *pg_test
- <<: *e2e_tests
<<: *mysql_test
- <<: *e2e_tests
<<: *sqlite_test
- <<: *e2e_tests
<<: *mongo_test
- <<: *e2e_tests_ee
<<: *pg_test
- <<: *e2e_tests_ee
<<: *mysql_test
- <<: *e2e_tests_ee
<<: *sqlite_test
- <<: *e2e_tests_ee
<<: *mongo_test