forked from VATSIM-UK/core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
95 lines (95 loc) · 3.98 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
jobs:
include:
- stage: "Test"
language: php
php:
- 7.3
addons:
mariadb: '10.2'
before_install:
- mysql -e 'create database IF NOT EXISTS core;' -uroot
- mysql -e 'create database IF NOT EXISTS core_testing;' -uroot
- mysql -e 'create database IF NOT EXISTS cts;' -uroot
- cp auth.json.example auth.json
- sed -i "s/your-username/${NOVA_USERNAME}/g" auth.json
- sed -i "s/your-password/${NOVA_PASSWORD}/g" auth.json
- composer install --prefer-dist --no-interaction --optimize-autoloader --no-suggest
- nvm install 10.19
- yarn install
install:
# Install Nova and component dependencies
- php artisan nova:install
- cd nova-components/WaitingListsManager && composer install && cd ../../
# If this is a PR, prep CodeCov
- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter; fi
- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
chmod +x ./cc-test-reporter;
fi
# If this is not a PR and we are not running on master, run yarn as dev to improve performance
- if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" != "master" ]; then
yarn run dev;
else
yarn run prod;
fi
# Setup Nova component dependencies
- if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" != "master" ]; then
cd nova-components/WaitingListsManager && yarn && yarn run dev && cd ../../;
else
cd nova-components/WaitingListsManager && yarn && yarn run prod && cd ../../;
fi
- cp .env.example .env
- php artisan key:generate
- php artisan migrate -vvv -n
- php artisan route:cache
before_script:
# If this is a PR, prep CodeCov
- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
./cc-test-reporter before-build;
fi
# If this is not a PR and we are not running on master, remove xdebug to improve performance
- if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" != "master" ]; then
phpenv config-rm xdebug.ini;
fi
- php artisan serve -q &
- sed -i 's%^SSO_CERT.*$%SSO_CERT=\"${SSO_CERT}\"%' .env
- sed -i "s%^SSO_KEY.*$%SSO_KEY=${SSO_KEY}%" .env
- sed -i "s%^SSO_SECRET.*$%SSO_SECRET=${SSO_SECRET}%" .env
script:
# If this is not a PR and we are not running on master, run PHPUnit without coverage, otherwise, with.
- if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" != "master" ]; then
vendor/bin/phpunit;
else
phpdbg -dmemory_limit=3G -qrr vendor/bin/phpunit --coverage-clover=coverage.xml;
fi
after_success:
# If this is a PR, make a request to CodeCov
- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
bash <(curl -s https://codecov.io/bash);
fi
after_script:
# If this is a PR, send coverage report to CodeCov
- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
./cc-test-reporter after-build --coverage-input-type clover --exit-code $TRAVIS_TEST_RESULT;
fi
cache:
yarn: true
directories:
- node_modules
- $HOME/.composer/cache/files
- nova-components/WaitingListsManager/node_modules
notifications:
email: false
- stage: "Version"
if: branch = master AND type = push
deploy:
provider: script
skip_cleanup: true
script:
- nvm install lts/*
- npx semantic-release
- stage: "Deploy"
if: branch = master AND type = push
deploy:
script:
- curl "https://vatsim-uk.deploybot.com/webhook/${DEPLOYBOT_SECRET}"
- curl -XPOST "https://vatsim-uk.deploybot.com/webhook/deploy?env_id=${DEPLOYBOT_ENV}&secret=${DEPLOYBOT_SECRET}"