Skip to content

Commit

Permalink
Hide progress indicator prior to 'exec'. (consolidation#707)
Browse files Browse the repository at this point in the history
* Hide progress indicator prior to 'exec'.

* Fix symfony2 scenario failure, and upgrade to composer-test-scenarios ^2

* Update minimum workable versions.
  • Loading branch information
greg-1-anderson authored Mar 21, 2018
1 parent a1c5ae8 commit 9a5d26c
Show file tree
Hide file tree
Showing 10 changed files with 156 additions and 167 deletions.
81 changes: 5 additions & 76 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ matrix:
fast_finish: true
include:
- php: 7.2
env: 'SCENARIO=symfony4 HIGHEST_LOWEST="update"'
env: 'SCENARIO=symfony4 DEPENDENCIES=highest'
- php: 7.1
env: 'SCENARIO=symfony4'
- php: 7.0.11
env: 'HIGHEST_LOWEST="update"'
env: 'DEPENDENCIES=highest'
- php: 7.0.11
- php: 5.6
- php: 5.6
env: 'HIGHEST_LOWEST="update --prefer-lowest'
env: 'DEPENDENCIES=lowest'
- php: 5.5
env: 'SCENARIO=symfony2 HIGHEST_LOWEST="update --prefer-lowest'
env: 'SCENARIO=symfony2 DEPENDENCIES=lowest'

sudo: false

Expand All @@ -30,84 +30,13 @@ cache:
- $HOME/.composer/cache

install:
- 'composer scenario "${SCENARIO}" "${HIGHEST_LOWEST-install}"'
- 'composer scenario "${SCENARIO}" "${DEPENDENCIES}"'

script:
- composer test

after_success:
- travis_retry php vendor/bin/coveralls -v
- |
# Only do post-build actions in one environment, and only if there is a GITHUB token.
if [ -z "$DO_POST_BUILD_ACTIONS" ] ; then
return
fi
if [ -z "$GITHUB_TOKEN" ]; then
echo "No GITHUB_TOKEN defined; exiting."
return
fi
# Inject GITHUB_TOKEN into remote origin so that we have push access
# to merge or create a pull request
remote=$(git config --get remote.origin.url)
git remote set-url origin "${remote/github.com/$GITHUB_TOKEN:[email protected]}"
# If this is a PR that merges into the master branch, then try to merge it if it contains only composer.lock
# n.b. TRAVIS_BRANCH is the branch the pull request will merge into. TRAVIS_PULL_REQUEST_BRANCH
# is the branch that holds the commits for the pull request.
if [ -n "$TRAVIS_COMMIT_RANGE" ] && [ -n "$TRAVIS_PULL_REQUEST_BRANCH" ] && [ "master" == "$TRAVIS_BRANCH" ]; then
changed_files=$(git diff --name-status "$TRAVIS_COMMIT_RANGE" | tr '\t' ' ')
if [[ "$changed_files" == "M composer.lock" ]] ; then
(
echo "Only composer.lock was modified: auto-merging to $TRAVIS_BRANCH in repository $remote."
git status
git reset "$TRAVIS_BRANCH"
git stash
git checkout "$TRAVIS_BRANCH"
git stash pop
git add composer.lock
git commit -m "Auto-update dependencies in composer.lock from PR #$TRAVIS_PULL_REQUEST (https://github.com/$TRAVIS_REPO_SLUG/pull/$TRAVIS_PULL_REQUEST)."
git push origin "$TRAVIS_BRANCH"
) 2>&1 | sed -e "s/$GITHUB_TOKEN/REDACTED/g"
else
echo "Not auto-merging, because multiple files were changed"
fi
fi
###
# Run composer lock update on cron jobs.
# See: https://github.com/danielbachhuber/composer-lock-updater
###
if [ "$TRAVIS_EVENT_TYPE" != "cron" ] ; then
echo "Not a cron job; exiting."
return
fi
###
# Only run on one job of a master branch build
###
if [ "master" != "$TRAVIS_BRANCH" ] ; then
echo "composer.lock update only runs on the master branch."
return
fi
###
# Install composer-lock-updater
###
export PATH="$HOME/.composer/vendor/bin:$PATH"
composer global require danielbachhuber/composer-lock-updater
###
# Optional: install Sensio Labs security checker to include security advisories in PR comments
###
mkdir -p $HOME/bin
wget -O $HOME/bin/security-checker.phar http://get.sensiolabs.org/security-checker.phar
chmod +x $HOME/bin/security-checker.phar
export PATH="$HOME/bin:$PATH"
###
# Install hub for creating GitHub pull requests
###
wget -O hub.tgz https://github.com/github/hub/releases/download/v2.2.9/hub-linux-amd64-2.2.9.tgz
tar -zxvf hub.tgz
export PATH=$PATH:$PWD/hub-linux-amd64-2.2.9/bin/
###
# Run composer-lock-updater
###
clu

# Prior to a deploy, build a fresh robo.phar
before_deploy:
Expand Down
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@
"goaop/framework": "~2.1.2",
"codeception/verify": "^0.3.2",
"codeception/aspect-mock": "^1|^2.1.1",
"greg-1-anderson/composer-test-scenarios": "^1",
"goaop/parser-reflection": "^1.1.0",
"nikic/php-parser": "^3.1.5",
"g-1-a/composer-test-scenarios": "^2",
"satooshi/php-coveralls": "^2",
"phpunit/php-code-coverage": "~2|~4",
"squizlabs/php_codesniffer": "^2.8"
Expand Down
88 changes: 47 additions & 41 deletions composer.lock

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

26 changes: 25 additions & 1 deletion examples/src/Robo/Plugin/Commands/ExampleCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,37 @@ public function tryInput()
$this->say('Bye!');
}

/**
* Demonstrates serial execution.
*
* @option $printed Print the output of each process.
* @option $error Include an extra process that fails.
*/
public function tryExec($options = ['printed' => true, 'error' => false])
{
$dir = dirname(dirname(dirname(dirname(dirname(__DIR__)))));
$tasks = $this
->taskExec('php')
->args(["$dir/tests/_data/parascript.php", "hey", "4"])
->taskExec('php')
->args(["$dir/tests/_data/parascript.php", "hoy", "3"])
->taskExec('php')
->args(["$dir/tests/_data/parascript.php", "gou", "2"])
->taskExec('php')
->args(["$dir/tests/_data/parascript.php", "die", "1"]);
if ($options['error']) {
$tasks->taskExec('ls')->arg("$dir/tests/_data/filenotfound");
}
return $tasks->run();
}

/**
* Demonstrates parallel execution.
*
* @option $printed Print the output of each process.
* @option $error Include an extra process that fails.
*/
public function tryPara($options = ['printed' => false, 'error' => false])
public function tryPara($options = ['printed' => true, 'error' => false])
{
$dir = dirname(dirname(dirname(dirname(dirname(__DIR__)))));
$para = $this->taskParallelExec()
Expand Down
24 changes: 20 additions & 4 deletions scenarios/install
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
#!/bin/bash

SCENARIO=$1
ACTION=${2-install}
DEPENDENCIES=${2-install}

# Convert the aliases 'highest', 'lowest' and 'lock' to
# the corresponding composer command to run.
case $DEPENDENCIES in
highest)
DEPENDENCIES=update
;;
lowest)
DEPENDENCIES='update --prefer-lowest'
;;
lock|default|"")
DEPENDENCIES=install
;;
esac

# If scenario is not specified, install the lockfile at
# the root of the project.
dir=scenarios/${SCENARIO}
if [ -z "$SCENARIO" ] ; then
if [ -z "$SCENARIO" ] || [ "$SCENARIO" == "default" ] ; then
SCENARIO=default
dir=.
fi


# Test to make sure that the selected scenario exists.
if [ ! -d "$dir" ] ; then
echo "Requested scenario '${SCENARIO}' does not exist."
exit 1
Expand All @@ -24,5 +40,5 @@ echo
set -ex

composer -n validate --working-dir=$dir --no-check-all --ansi
composer -n --working-dir=$dir ${ACTION} --prefer-dist --no-scripts
composer -n --working-dir=$dir ${DEPENDENCIES} --prefer-dist --no-scripts
composer -n --working-dir=$dir info
4 changes: 3 additions & 1 deletion scenarios/symfony2/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@
"codeception/aspect-mock": "^1|^2.1.1",
"codeception/base": "^2.3.7",
"codeception/verify": "^0.3.2",
"greg-1-anderson/composer-test-scenarios": "^1",
"g-1-a/composer-test-scenarios": "^2",
"goaop/parser-reflection": "^1.1.0",
"natxet/CssMin": "3.0.4",
"nikic/php-parser": "^3.1.5",
"patchwork/jsqueeze": "~2",
"pear/archive_tar": "^1.4.2",
"phpunit/php-code-coverage": "~2|~4",
Expand Down
4 changes: 3 additions & 1 deletion scenarios/symfony4/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@
"codeception/aspect-mock": "^1|^2.1.1",
"codeception/base": "^2.3.7",
"codeception/verify": "^0.3.2",
"g-1-a/composer-test-scenarios": "^2",
"goaop/framework": "~2.1.2",
"greg-1-anderson/composer-test-scenarios": "^1",
"goaop/parser-reflection": "^1.1.0",
"natxet/CssMin": "3.0.4",
"nikic/php-parser": "^3.1.5",
"patchwork/jsqueeze": "~2",
"pear/archive_tar": "^1.4.2",
"phpunit/php-code-coverage": "~2|~4",
Expand Down
Loading

0 comments on commit 9a5d26c

Please sign in to comment.