Skip to content

Commit

Permalink
Travis Autodeploy on success and master
Browse files Browse the repository at this point in the history
  • Loading branch information
Plopix committed Apr 10, 2017
1 parent 1f27263 commit c125646
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -21,6 +21,7 @@ tests/coverage
/.ezlaunchpad.yml

# Travis stuff
/.travis/build-key.pem
/.travis/ezlaunchpad-private.pem
/.travis/secrets.tar

Expand Down
12 changes: 6 additions & 6 deletions .travis.yml
@@ -1,5 +1,4 @@
sudo: false

language: php

cache:
Expand All @@ -10,16 +9,16 @@ cache:
matrix:
fast_finish: true
include:
- php: 5.5
- php: 5.6
env:
- EXECUTE_DEPLOYMENT=true
- php: 7
- php: 7.1
allow_failures:
- php: 5.5


before_install:
- openssl aes-256-cbc -K $encrypted_91e9470aafb9_key -iv $encrypted_91e9470aafb9_iv -in .travis/secrets.tar.enc -out .travis/secrets.tar -d
- phpenv config-rm xdebug.ini
- composer self-update

install:
Expand All @@ -28,8 +27,9 @@ install:

script:
- php vendor/bin/phpcs --standard=.cs/cs_ruleset.xml --extensions=php src/
#- php vendor/bin/phpcs --standard=.cs/cs_ruleset.xml --extensions=php tests/Tests/
#- php vendor/behat/behat/bin/behat
- php vendor/bin/phpcs --standard=.cs/cs_ruleset.xml --extensions=php tests/Tests/
- php vendor/bin/phpunit -c tests/ --exclude-group behat
- php vendor/behat/behat/bin/behat -c tests/behat.yml

after_success:
- if [[ $EXECUTE_DEPLOYMENT == 'true' && $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST == 'false' ]]; then composer install --no-dev ; fi
Expand Down
Binary file added .travis/secrets.tar.enc
Binary file not shown.
4 changes: 2 additions & 2 deletions scripts/codechecker.bash
Expand Up @@ -16,14 +16,14 @@ cd ${PROJECTDIR}

echoTitle "******** Mess Detector ********"
$PHP ./vendor/bin/phpmd $SRC text .cs/md_ruleset.xml
#$PHP ./vendor/bin/phpmd tests/Tests text .cs/md_ruleset.xml
$PHP ./vendor/bin/phpmd tests/Tests text .cs/md_ruleset.xml

echoTitle "******** CodeFixer ************"
$PHP ./vendor/bin/php-cs-fixer fix --config=.cs/.php_cs.php

echoTitle "******** CodeSniffer **********"
$PHP ./vendor/bin/phpcs --standard=.cs/cs_ruleset.xml --extensions=php $SRC
#$PHP ./vendor/bin/phpcs --standard=.cs/cs_ruleset.xml --extensions=php tests/Tests
$PHP ./vendor/bin/phpcs --standard=.cs/cs_ruleset.xml --extensions=php tests/Tests

echoSuccess "Done."
exit 0;
12 changes: 7 additions & 5 deletions scripts/travis_deploy.bash
Expand Up @@ -5,16 +5,18 @@ tar xvf .travis/secrets.tar -C .travis

# Setup SSH agent:
eval "$(ssh-agent -s)" #start the ssh agent
chmod 600 .travis/ezlaunchpad-private.pem
ssh-add .travis/ezlaunchpad-private.pem
chmod 600 .travis/build-key.pem
ssh-add .travis/build-key.pem

# Setup git defaults:
git config --global user.email "ezlaunchpad@ez.no"
git config --global user.name "eZ Launchpad"
git config --global user.email "github-ezlaunchpad@ez.no"
git config --global user.name "eZ Launchpad Github Bot"

# Add SSH-based remote to GitHub repo:
git remote add deploy git@github.com:ezsystems/ezlaunchpad.git
git fetch deploy
git checkout master
git status

# Get box and build PHAR
curl -LSs https://box-project.github.io/box2/installer.php | php
Expand All @@ -30,5 +32,5 @@ git add docs/ez.phar docs/ez.phar.version

# Commit and push:
DATED_SUFFIX=`date +%Y-%m-%d-%H-%M-%S`
git commit -m "Deployment master on $DATED_SUFFIX"
git commit -m "[skip ci] Deployment new eZ Launchpad on $DATED_SUFFIX"
git push deploy master
4 changes: 2 additions & 2 deletions tests/Tests/RequiredFilesTest.php
Expand Up @@ -16,6 +16,7 @@ class RequiredBoxFilesTest extends TestCase
{

const FILE = "assertFileExists";

const DIRECTORY = "assertDirectoryExists";

/**
Expand All @@ -34,7 +35,7 @@ public function getRequiredFiles()
}

$data[] = [$box->main, static::FILE];
$data[] = [$box->key, static::FILE];
$data[] = [".travis/secrets.tar", static::FILE];

return $data;
}
Expand All @@ -55,5 +56,4 @@ public function testBoxFileIsPresent($file, $type)
$appDir = __DIR__."/../..";
$this->$type("{$appDir}/{$file}");
}

}

0 comments on commit c125646

Please sign in to comment.