Skip to content

Commit 6dfe5f1

Browse files
authored
Merge pull request #979 from mrrobot47/issue/setup-travis-ci
Setup travis-ci for phar building
2 parents 29731ec + 00e22a7 commit 6dfe5f1

File tree

4 files changed

+109
-4
lines changed

4 files changed

+109
-4
lines changed

.travis.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
sudo: false
2+
3+
language: php
4+
php: 7.1
5+
6+
env:
7+
global:
8+
- PATH="$TRAVIS_BUILD_DIR/vendor/bin:$PATH"
9+
10+
before_install:
11+
- |
12+
# Remove Xdebug for a huge performance increase:
13+
if [ -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ]; then
14+
phpenv config-rm xdebug.ini
15+
else
16+
echo "xdebug.ini does not exist"
17+
fi
18+
19+
install:
20+
- composer install --no-interaction
21+
22+
before_script:
23+
- composer validate
24+
- ./ci/prepare.sh
25+
26+
jobs:
27+
include:
28+
- stage: deploy
29+
env: DEPLOY_BRANCH=release/v4
30+
script: ./ci/deploy.sh
31+
32+
cache:
33+
directories:
34+
- $HOME/.composer/cache
35+
36+
branches:
37+
only:
38+
- develop-v4
39+
- release/v4
40+
41+
notifications:
42+
email:
43+
on_success: never
44+
on_failure: change

ci/deploy.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/bin/bash
2+
3+
# called by Travis CI
4+
5+
if [[ "false" != "$TRAVIS_PULL_REQUEST" ]]; then
6+
echo "Not deploying pull requests."
7+
exit
8+
fi
9+
10+
if [ -z $DEPLOY_BRANCH ]; then
11+
echo "Skipping deployment as DEPLOY_BRANCH is not set"
12+
exit
13+
fi
14+
15+
if [[ "$TRAVIS_BRANCH" != "$DEPLOY_BRANCH" ]] && [[ ! "$TRAVIS_BRANCH" == "develop-v4" ]]; then
16+
echo "Skipping deployment as '$TRAVIS_BRANCH' is not a deploy branch."
17+
exit
18+
fi
19+
20+
# Turn off command traces while dealing with the private key
21+
set +x
22+
23+
# Get the encrypted private key from the repo settings
24+
echo $EE_REPO_DEPLOY_KEY | base64 --decode > ~/.ssh/id_rsa
25+
chmod 600 ~/.ssh/id_rsa
26+
27+
# anyone can read the build log, so it MUST NOT contain any sensitive data
28+
set -x
29+
30+
# add github's public key
31+
echo "|1|qPmmP7LVZ7Qbpk7AylmkfR0FApQ=|WUy1WS3F4qcr3R5Sc728778goPw= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==" >> ~/.ssh/known_hosts
32+
33+
git clone [email protected]:easyengine/easyengine-builds.git
34+
35+
git config user.name "Travis CI"
36+
git config user.email "[email protected]"
37+
git config push.default "current"
38+
39+
if [[ "$TRAVIS_BRANCH" == "develop-v4" ]]; then
40+
fname="phar/easyengine-nightly.phar"
41+
else
42+
fname="phar/easyengine.phar"
43+
fi
44+
45+
mv $fname easyengine-builds/$fname
46+
cd easyengine-builds
47+
chmod -x $fname
48+
49+
md5sum $fname | cut -d ' ' -f 1 > $fname.md5
50+
sha512sum $fname | cut -d ' ' -f 1 > $fname.sha512
51+
52+
git add .
53+
git commit -m "phar build: $TRAVIS_REPO_SLUG@$TRAVIS_COMMIT"
54+
55+
git push

ci/prepare.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
# called by Travis CI
4+
5+
php -dphar.readonly=0 ./utils/make-phar.php easyengine.phar --quite > /dev/null
6+
php easyengine.phar cli version

composer.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)