-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
72 lines (60 loc) · 2.61 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
language: php
php:
- '7.0'
services:
- docker
# Install lando
before_install:
- sudo apt-get -y update || true
- sudo apt-get -y install cgroup-bin curl
- curl -fsSL -o /tmp/lando-latest.deb http://installer.kalabox.io/lando-latest-dev.deb
- sudo dpkg -i /tmp/lando-latest.deb
- lando version
# Do the lando magic
script:
# Get our built out lando site running on travis
- lando start -- -v
- lando composer install
# Do needed things to get this repo transformed to what pantheon expects
- lando composer prepare-for-pantheon
# Run non-db required tests eg linting/code standards/unit tests
# Lint the codez
- lando phplint
# Check code standards
# - lando phpcs --config-set installed_paths /app/vendor/drupal/coder/coder_sniffer
# - lando phpcs -n --report=full --standard=Drupal --ignore=*.tpl.php --extensions=install,module,php,inc web/modules web/themes web/profiles
# Run unit tests.
# - lando composer drupal-unit-tests
# Get the DB for more advanced things
- lando terminus auth:login --machine-token=$PANTHEON_MACHINE_TOKEN
- lando pull --code=none --database=dev --files=dev --rsync
# Check if we can bootstrap the site.
- cd web
- lando drush cr | grep "rebuild complete."
- cd ..
# Run Behat tests.
- lando behat --config=/app/tests/behat-pantheon.yml
# Do the multidev as needed
- |
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
BRANCH=$(echo $TRAVIS_PULL_REQUEST_BRANCH | grep -v '^\(master\|[0-9]\+.x\)$')
PR_ENV=${BRANCH:+pr-$BRANCH}
DEFAULT_ENV=$(echo ${PR_ENV:-$TRAVIS_PULL_REQUEST_BRANCH} | tr '[:upper:]' '[:lower:]' | sed 's/[^0-9a-z-]//g' | cut -c -11 | sed 's/-$//')
if ! lando terminus multidev:list $PANTHEON_SITE_NAME --field id | grep "$DEFAULT_ENV"; then
lando terminus multidev:create $PANTHEON_SITE_NAME.dev $DEFAULT_ENV
fi
lando ssh -c "cd /tmp && git clone -b $DEFAULT_ENV ssh://codeserver.dev.\${PANTHEON_SITE}@codeserver.dev.\${PANTHEON_SITE}.drush.in:2222/~/repository.git pantheon_build"
lando ssh -u root -c "rm -rf /tmp/pantheon_build/*"
lando ssh -c "cp -rf /app/ /tmp/pantheon_build/"
lando ssh -c "git -C /tmp/pantheon_build add -A"
lando ssh -c "git -C /tmp/pantheon_build commit -m '$TRAVIS_COMMIT_MESSAGE'"
lando ssh -c "git -C /tmp/pantheon_build push origin $DEFAULT_ENV"
fi
# Clean up posted SSH key
- lando terminus ssh-key:remove $(ssh-keygen -l -f ~/.lando/keys/pantheon.lando.id_rsa.pub | awk -F' ' '{print $2}' | sed 's/://g')
# Merge into master via deploy script
deploy:
provider: script
script: scripts/travis/deploy.sh $DEFAULT_ENV
on:
branch: master