Skip to content

Commit

Permalink
Merge pull request #9 from Sweetchuck/upgrade-dependencies
Browse files Browse the repository at this point in the history
Upgrade dependencies
  • Loading branch information
Sweetchuck committed Dec 31, 2019
2 parents 5f91614 + ce56f0f commit cb34555
Show file tree
Hide file tree
Showing 27 changed files with 1,516 additions and 993 deletions.
232 changes: 128 additions & 104 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,128 +1,152 @@

version: 2

_custom:
step__run__upgrade_git: &step__run__upgrade_git
name: 'Upgrade Git'
command: |
sudo bash -c 'echo "deb http://ftp.us.debian.org/debian testing main contrib non-free" >> /etc/apt/sources.list'
sudo apt-get update
sudo apt-get install -y git
sudo apt-get clean all
git --version
step__run__install_php_extensions: &step__run__install_php_extensions
name: 'Install PHP extensions'
command: |
sudo apt-get -y install zlib1g-dev
sudo docker-php-ext-install zip
step__run__install_composer: &step__run__install_composer
name: 'Install composer'
command: |
cd /tmp
EXPECTED_SIGNATURE=$(curl -q https://composer.github.io/installer.sig)
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_SIGNATURE=$(php -r "echo hash_file('SHA384', 'composer-setup.php');")
if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]
then
>&2 echo 'ERROR: Invalid installer signature'
rm composer-setup.php
exit 1
fi
sudo php composer-setup.php --quiet --install-dir /usr/local/bin --filename composer
RESULT=$?
rm composer-setup.php
exit $RESULT
step__restore_cache: &step__restore_cache
name: 'Cache restore - "./vendor"'
keys:
- 'v1-dependencies-{{ checksum "composer.lock" }}'
- 'v1-dependencies-'
step__run__composer_install: &step__run__composer_install
name: 'Build'
command: 'composer install --no-interaction'
step__save_cache: &step__save_cache
name: 'Cache save - "./vendor"'
paths:
- './vendor'
key: 'v1-dependencies-{{ checksum "composer.lock" }}'
step__run__linters: &step__run__linters
name: 'Run linters'
command: 'bin/robo lint'
step__run__codeception_unit: &step__run__codeception_unit
name: 'Codeception - unit'
command: 'bin/robo test unit'
step__run__codeception_acceptance: &step__run__codeception_acceptance
name: 'Codeception - acceptance'
command: 'bin/robo test acceptance'
step__store_test_results: &step__store_test_results
path: 'tests/_output/machine/junit'
step__run__codecov: &step__run__codecov
name: 'Publish the code coverage report on Codecov.io'
when: 'always'
command: >
[ ! -s tests/_output/machine/coverage/*/coverage.xml ]
|| bash <(curl -s https://codecov.io/bash)
|| true
job__lint_and_test: &job__lint_and_test
working_directory: '~/repo'
steps:
- 'checkout'
# -
# run:
# <<: *step__run__upgrade_git
version: 2.1

.env_composer: &env_composer
COMPOSER_NO_INTERACTION: '1'
COMPOSER_MEMORY_LIMIT: '-1'
COMPOSER_DISABLE_XDEBUG_WARN: '1'

executors:
php704:
environment:
<<: *env_composer

docker:
-
run:
<<: *step__run__install_php_extensions
name: 'main'
image: 'circleci/php:7.4'

php703:
environment:
<<: *env_composer

docker:
-
run:
<<: *step__run__install_composer
name: 'main'
image: 'circleci/php:7.3'

php702:
environment:
<<: *env_composer

docker:
-
name: 'main'
image: 'circleci/php:7.2'

commands:
composer_install:
description: 'Install Composer dependencies with cache restore and save'
steps:
-
restore_cache:
<<: *step__restore_cache
name: 'Composer - cache restore'
keys:
- 'composer-{{ checksum "./composer.lock" }}-1'

-
run:
<<: *step__run__composer_install
name: 'Composer - install'
command: >
[[ -d "$(composer config vendor-dir)" ]] || composer install --no-progress
-
save_cache:
<<: *step__save_cache
name: 'Composer - cache save'
key: 'composer-{{ checksum "./composer.lock" }}-1'
paths:
- './bin/'
- './vendor/'
- '~/.composer/cache/'


lint:
description: 'Run linters'
steps:
-
run:
<<: *step__run__linters
name: 'Run linters'
command: 'bin/robo lint'

test:
description: 'Run tests'
steps:
-
run:
<<: *step__run__codeception_unit
name: 'Codeception - unit'
command: 'bin/robo test unit'
-
run:
<<: *step__run__codeception_acceptance
name: 'Codeception - acceptance'
command: 'bin/robo test acceptance'
-
store_test_results:
<<: *step__store_test_results
name: 'Store unit test results'
path: './tests/_output/machine/junit'
-
run:
<<: *step__run__codecov
# @todo Use orb.
name: 'Publish the code coverage report on Codecov.io'
when: 'always'
command: >-
[ ! -s ./tests/_output/machine/coverage/coverage.xml ]
|| bash <(curl -s https://codecov.io/bash)
|| true
jobs:
php701__lint_and_test:
<<: *job__lint_and_test
docker:
-
image: 'circleci/php:7.1'
php702__lint_and_test:
<<: *job__lint_and_test
docker:
-
image: 'circleci/php:7.2'
build:
executor: 'php702'
working_directory: '~/repo'
steps:
- 'checkout'
- 'composer_install'
lint:
executor: 'php702'
working_directory: '~/repo'
steps:
- 'checkout'
- 'composer_install'
- 'lint'
test_php704:
executor: 'php704'
working_directory: '~/repo'
steps:
- 'checkout'
- 'composer_install'
- 'test'
test_php703:
executor: 'php703'
working_directory: '~/repo'
steps:
- 'checkout'
- 'composer_install'
- 'test'
test_php702:
executor: 'php702'
working_directory: '~/repo'
steps:
- 'checkout'
- 'composer_install'
- 'test'

workflows:
version: 2
php701__lint_and_test:
lint_and_test:
jobs:
- 'php701__lint_and_test'
php702__lint_and_test:
jobs:
- 'php702__lint_and_test'
-
build: {}
-
lint:
requires:
- build
-
test_php704:
requires:
- build
-
test_php703:
requires:
- build
-
test_php702:
requires:
- build
26 changes: 5 additions & 21 deletions RoboFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,9 @@ protected function getTaskCodeceptRunSuite(string $suite, array $options = []):
'{command}' => $command,
]
));
$process = new Process($command, null, null, null, null);
$exitCode = $process->run(function ($type, $data) {
$process = Process::fromShellCommandline($command, null, null, null, null);

return $process->run(function ($type, $data) {
switch ($type) {
case Process::OUT:
$this->output()->write($data);
Expand All @@ -402,8 +403,6 @@ protected function getTaskCodeceptRunSuite(string $suite, array $options = []):
break;
}
});

return $exitCode;
});
}

Expand Down Expand Up @@ -454,24 +453,9 @@ protected function getTaskPhpmdLint()
->setOutput($this->output());
}

protected function isPhpExtensionAvailable(string $extension): bool
{
$command = sprintf('%s -m', escapeshellcmd($this->getPhpExecutable()));

$process = new Process($command);
$exitCode = $process->run();
if ($exitCode !== 0) {
throw new \RuntimeException('@todo');
}

return in_array($extension, explode("\n", $process->getOutput()));
}

protected function isPhpDbgAvailable(): bool
{
$command = sprintf('%s -qrr', escapeshellcmd($this->getPhpdbgExecutable()));

return (new Process($command))->run() === 0;
return (new Process([$this->getPhpdbgExecutable(), '-qrr']))->run() === 0;
}

protected function getLogDir(): string
Expand Down Expand Up @@ -510,7 +494,7 @@ protected function validateArgCodeceptionSuiteNames(array $suiteNames)
{
$invalidSuiteNames = array_diff($suiteNames, $this->getCodeceptionSuiteNames());
if ($invalidSuiteNames) {
throw new \InvalidArgumentException(
throw new InvalidArgumentException(
'The following Codeception suite names are invalid: ' . implode(', ', $invalidSuiteNames),
1
);
Expand Down
2 changes: 1 addition & 1 deletion codeception.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ paths:
support: tests/_support
envs: tests/_envs

bootstrap: _bootstrap.php
settings:
bootstrap: _bootstrap.php
colors: true
memory_limit: 1024M

Expand Down
22 changes: 13 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,25 @@
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": ">=7.1",
"consolidation/robo": "^1.0",
"php": ">=7.2",
"consolidation/robo": "^2.0",
"danielstjules/stringy": "^3.1",
"phpmd/phpmd": "^2.6",
"webmozart/path-util": "^2.3"
},
"require-dev": {
"codeception/codeception": "^2.2",
"mikey179/vfsStream": "^1.6",
"sweetchuck/codeception-module-robo-task-runner": "^0.4",
"ext-json": "*",
"codeception/codeception": "^4.0",
"codeception/module-asserts": "^1.1",
"mikey179/vfsstream": "^1.6",
"squizlabs/php_codesniffer": "^3.5",
"sweetchuck/codeception-module-robo-task-runner": "^0.7",
"sweetchuck/git-hooks": "^0.0",
"sweetchuck/robo-git": "^0.0",
"sweetchuck/robo-phpcs": "^0.0",
"symfony/finder": "^3.2 || ^4.0",
"symfony/yaml": "^3.2 || ^4.0"
"sweetchuck/robo-git": "^0.2",
"sweetchuck/robo-phpcs": "^0.1",
"symfony/error-handler": "^5.0",
"symfony/finder": "^4.0",
"symfony/yaml": "^4.0"
},
"autoload": {
"psr-4": {
Expand Down
Loading

0 comments on commit cb34555

Please sign in to comment.