Skip to content

Commit

Permalink
trigger build (#2)
Browse files Browse the repository at this point in the history
* trigger build

--

* composer install

--

* set min php version to 7.1

--

* update composer.lock

--
  • Loading branch information
lifeofguenter authored Dec 13, 2017
1 parent aca6073 commit 6334306
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 11 deletions.
40 changes: 40 additions & 0 deletions .bash/functions.shlib
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
throw_exception() {
consolelog "Ooops!" "error"
echo 'Stack trace:' 1>&2
while caller $((n++)) 1>&2; do :; done;
exit 1
}

consolelog() {
local color
local ts

# el-cheapo way to detect if timestamp prefix needed
if [[ ! -z "${JENKINS_HOME}" ]]; then
ts=''
else
ts="[$(date -u +'%Y-%m-%d %H:%M:%S')] "
fi

color_reset='\e[0m'

case "${2}" in
success )
color='\e[0;32m'
;;
error )
color='\e[1;31m'
;;
* )
color='\e[0;37m'
;;
esac

if [[ ! -z "${1}" ]] && [[ ! -z "${2}" ]] && [[ "${2}" = "error" ]]; then
printf "${color}%s%s: %s${color_reset}\n" "${ts}" "${0##*/}" "${1}" >&2
elif [[ ! -z "${1}" ]]; then
printf "${color}%s%s: %s${color_reset}\n" "${ts}" "${0##*/}" "${1}"
fi

return 0
}
11 changes: 9 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,15 @@ matrix:
include:
- php: 7.2
- php: 7.1
- php: 7.0

sudo: false

script: ./build.sh
deploy:
provider: releases
api_key:
secure: RLt5auZTQie7TF5AoIKg6gSmo4cexRQ1ytpsbIq5AJMrNIFXFyONWnDfF9dcfm4opwigh8vBPmm2JHPueDd039Ya0e2n208eJBLgZ+WpR+/psWcTUiVKse7rT9cU1HpbhpQC/1TO6qiPYep1HLKTeXvA37MsD0tT9wm9WA6SlTRKEmizpj9Afww/OKz/Hb4ENIosT8+EBwNYqQeZTzSuNjsMh01xSfU2TMCy6dLu2/f5D46CLTXDSeB9C4XC8fwA+KnzI69opI7mTQECMclWQOZXhTRoRDJXM2kNRTo8iUWjuVUgCqOT4QjHKOSaXmC5UI8Kjj9+7AJ3HQ54JYF3QTy9RJ+KX137JeTuyEiRmGGGPc0jcmVBx8JLiZihyE1s0fV6Ue4g5VKbg0teIyBvQeKyjyf1FaGJE3ZZBmEH7ujwccOvcRKl8fzlRHLFsCzVXiNIonmk0CIZyUqxOuuazM4qxkui1kBJ30dTKLvW7ysGMEMM3SJCjz5isU9waejjA27Y2lJhAv96w/RQ8kUAwwDz9RgYi7mnra9UShnv1y/Njf7GY4Tj/Z+TKyYLqyYLbMWtUuIg8qBQ0XwagU7Zb5jRSmLaJ8qP7r4GaCpF4a/JjB48LswrrryseK6Z6Y1wVMnro0QTo13VVhuT/9Yj9xX4IpFNtRFKNDR+PBDsee4=
file: mamicleaner.phar
on:
tags: true

script: "./build.sh"
30 changes: 29 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,41 @@
#!/usr/bin/env bash

set -e
__DIR__="$(dirname "$("${READLINK_PATH:-readlink}" -f "$0")")"

# required libs
source "${__DIR__}/.bash/functions.shlib"

set -E
trap 'throw_exception' ERR

# create version file
if [[ ! -z "${TRAVIS_TAG}" ]]; then
echo "${TRAVIS_TAG}" > version.txt
elif [[ ! -z "${TRAVIS_COMMIT}" ]]; then
echo "${TRAVIS_COMMIT}" > version.txt
fi

# composer
consolelog "composer install"
composer install \
--no-interaction \
--prefer-dist \
--no-suggest \
--quiet \
--verbose

consolelog "composer cleanup"
composer install \
--no-dev \
--quiet \
--verbose

composer dump-autoload \
--no-dev \
--classmap-authoritative \
--quiet \
--verbose

php create-phar.php
chmod +x mamicleaner.phar

Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
}
],
"require": {
"php": ">=7.1.0",
"aws/aws-sdk-php": "^3.46",
"symfony/console": "^4.0"
},
Expand Down
16 changes: 9 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion create-phar.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
$p = new Phar($pharFile);

// creating our library using whole directory
$p->buildFromDirectory(dirname(__FILE__), '~^(?!(.*\.git))(.*)$~i');
$p->buildFromDirectory(dirname(__FILE__), '~^(?!(.*(\.git|\.bash)))(.*)$~i');

$stub = <<<"EOT"
#!/usr/bin/env php
Expand Down

0 comments on commit 6334306

Please sign in to comment.