forked from meedan/check-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
108 lines (108 loc) · 4.51 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
sudo: required
dist: bionic
language: ruby
rvm: "2.4" # must be same as check-api/.travis.yml
cache:
directories:
- "/tmp/bundler"
services:
- docker
- redis
- postgresql
- xvfb
addons:
postgresql: "11"
apt:
packages:
- build-essential
- chromium-browser
- chromium-chromedriver
- curl
- fonts-liberation
- imagemagick
- libappindicator1
- libexif-dev
- libnss3
- libnss3-dev
- libssl-dev
- lsof
- python-setuptools
- libtag1-dev
- unzip
- wget
hosts:
- minio
- redis
snaps:
- name: node
channel: 12/stable # must be same as check-web/Dockerfile
confinement: classic
before_install:
- sudo apt-get remove google-chrome-stable # Travis comes with it, and its version doesn't match chromedriver's
- export TEST_ENV_NUMBER=0
- export CHROMEDRIVER_URL=http://localhost:9515
# Set a UTF-8 capabable locale
- export LC_ALL=C.UTF-8
- export LANG=C.UTF-8
- export LANGUAGE=C.UTF-8
# Needed to fix error when installing Pender gems
# Error: `There was an error while loading `rswag.gemspec`: Illformed requirement`
# https://github.com/jetpackworkflow/rswag/blob/master/rswag/rswag.gemspec#L18
- export TRAVIS_TAG=0.0.0
# extract configs
- git clone https://${TOKEN}:[email protected]/meedan/configurator ./configurator
# minio
- docker run -d -p 9000:9000 -e "MINIO_ACCESS_KEY=AKIAIOSFODNN7EXAMPLE" -e "MINIO_SECRET_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" minio/minio server /data
# check api
- psql -c 'create database checkdesk_test0;' -U postgres
- docker run -d --name elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.9.2
- docker exec elasticsearch elasticsearch-plugin install analysis-icu
- docker restart elasticsearch
- until curl --silent -XGET --fail http://localhost:9200; do printf '.'; sleep 1; done
- curl --silent -XPUT http://localhost:9200/check_api_tests0
- export CHECK_API_BRANCH=$((git ls-remote --exit-code --heads https://github.com/meedan/check-api.git $TRAVIS_BRANCH >/dev/null && echo $TRAVIS_BRANCH) || echo 'develop')
- echo "Using branch $CHECK_API_BRANCH for Check API"
- git clone --branch=$CHECK_API_BRANCH https://github.com/meedan/check-api.git
- d=configurator/$APP/travis/check-api/; for f in $(find $d -type f); do cp "$f" "check-api/${f/$d/}"; done
- cd check-api
- bundle install --path=/tmp/bundler
- bundle exec rake db:migrate RAILS_ENV=test
- bundle exec rake lapis:api_keys:create_default RAILS_ENV=test
- bundle exec sidekiq -L log/sidekiq.log -d
- RAILS_ENV=test bundle exec puma -w 3 -t 8:60 --preload -b tcp://127.0.0.1:3000 >/dev/null &
- cd -
- export RAILS_ENV=development
# pender
- git clone https://github.com/meedan/pender.git
- d=configurator/$APP/travis/pender/; for f in $(find $d -type f); do cp "$f" "pender/${f/$d/}"; done
- cd pender
- RAILS_ENV=test bundle install --path=/tmp/bundler
- bundle exec rake db:migrate
- bundle exec rails runner 'a = ApiKey.create!; a.access_token = "test"; a.save!'
- bundle exec rails s -p 3005 >/dev/null &
- cd -
# chromedriver
- chromedriver --port=9515 >/dev/null 2>/dev/null &
# ruby / bundler / rspec
- cd test && bundle install --path=/tmp/bundler && cd -
# config files
- d=configurator/$APP/travis/check-web/; for f in $(find $d -type f); do cp "$f" "${f/$d/}"; done
install:
- npm install
before_script:
- npm run build
- export SERVER_PORT=3333
- npm run publish &
- sleep 5
- cd test/spec && bundle exec rubocop || travis_terminate 1;
- cd -
script: npm run test:lint && npm run test:unit && ./scripts/uncovered-files && cd test && ./parallel-test.sh
after_script:
- cat file.json
- size=$(du -k build/web/js/index.bundle.js | cut -f1) && size2=$(du -k build/web/js/vendor.bundle.js | cut -f1) && totalsize=$((size+size2)) && echo "Your bundle size is $totalsize kb"
notifications:
slack:
secure: TAPzV/OeN5hl8JSGrqPcAtFO/NWa9IqMbyzuUpCZgNP9EbobmlTPx55mopI647rwVIQZM1RL+2SapHJbT7XCAjJ+uvzSQd0b/LaS/aXLKFcS3bBDcvKAUeCcCYUiDz7x832EYg0fsVErR2dZPxvuPtWtwrOlOaOo8HB1uVHjvKo20Wnr/J4+VNTGvhQ5awdmpHMh+KrWpjQi4Ta9zWOTmSYh3qhgaLKjIKXanoaWen87VJB6Jy8nJ3Bo6t3r3+sbCRN9/LUZ8sVcJnvzlKdOtiLGkz8u2YG2c8UD+iUt2VOk0o5L/o8YPoeukJyFuAHAdLrjOelwHCAD2dRfrpQG7y/8G0vjJRXg8DRaVBVIl9vpYM6lyVIw5I6a9XDbUeOnBAWHE3uj/xH0X0vcRREE5py6tbt1KPUBS9rc8JGdCW3ZXVZAXA+1cijR3AAZUZ0YEf9WKLYhsTFW9lYlDcmkrWgVD9vbtPGDg95sbtuB+H5dkEAOBkf2YGkqzO+aaQKLDHkib/1v4C1+T5lXqlWZUrP8EuRwWs6xJlhi6w72AZLo7kVmfGA3ZdKfVcPCqr83YBfhL0WbwgT94L+5STELxw/PhsyNyOM/sRLQgR24ga/lcg2+L395VIPrQvhgKc26yHBuqW2P6FSOEGMyEcZ34N1TMTtRF7/lkRmXyKt4zuc=
env:
matrix:
- APP=check