forked from GCTC-NTGC/TalentCloud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
85 lines (73 loc) · 2.34 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
language: php
php:
- '7.2'
sudo: false # faster than required?
dist: trusty
services:
- docker
addons:
# required for lightcrawler
chrome: stable
hosts:
- talent.local.ca
cache:
directories:
- $HOME/.composer/cache/files
- $HOME/.npm
before_install:
# free port 5432
- sudo service postgresql stop
# latest composer version
- travis_retry composer self-update
# latest npm@6 version
- npm i -g npm@^6
# accessibility tests
- npm i -g lightcrawler
install:
# environment
- cp .env.travis .env
# dependencies
- travis_retry composer install --no-interaction --prefer-dist --no-suggest
- travis_retry npm ci
before_script:
# docker login (for tagging/pushing images to our hub repo)
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
# setup headless browser for tests
- google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
# start web server port 8000
- php artisan serve &
script:
# build application / database containers
- make docker-start
- make gen-certs
- travis_retry make build-db
- make set-perms
# laravel mix
- npm run dev
# prepare code coverage
- ci_env=`bash <(curl -s https://codecov.io/env)`
- docker run $ci_env gctcntgc/talentcloud sh
# unit tests
- make phpunit
after_success:
# crawl local site with lighthouse on PR
- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && echo "Not a pull request" || lightcrawler -u http://localhost:8000 -c lightcrawler.json'
# crawl live site with lighthouse on PR
- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && echo "Not a pull request" || lightcrawler -u https://talent.canada.ca -c lightcrawler.json'
# tag/push build to docker hub / pulling repo much faster than building from Dockerfile
# docker tag talentcloud_talentcloud gctcntgc/talentcloud:travis
# docker push gctcntgc/talentcloud:travis
after_script:
# send report to codecov.io
- bash <(curl -s https://codecov.io/bash) || echo 'Codecov failed to upload'
# send report to scrutinizer
- wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover coverage.xml
# tear down
- make docker-stop
# Slack notifications / do not send emails
notifications:
email: never
slack: talent-cloud:ASWQRTtW3oT2C2DHYaBzSCJg
on_success: always
on_failure: change