Skip to content

Commit

Permalink
Merge pull request #5 from Sweetchuck/upgrade-dependencies
Browse files Browse the repository at this point in the history
Upgrade dependencies
  • Loading branch information
Sweetchuck committed Jan 1, 2020
2 parents 043da86 + 4125c3e commit 0ad9029
Show file tree
Hide file tree
Showing 26 changed files with 1,241 additions and 948 deletions.
255 changes: 148 additions & 107 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,129 +1,170 @@

version: 2.1

_custom:
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'
.env_composer: &env_composer
COMPOSER_NO_INTERACTION: '1'
COMPOSER_MEMORY_LIMIT: '-1'
COMPOSER_DISABLE_XDEBUG_WARN: '1'

orbs:
codecov: 'codecov/codecov@1.0.4'

executors:
php704:
environment:
<<: *env_composer

docker:
- name: 'main'
image: 'misterio92/ci-php-node:4.0'

php703:
environment:
<<: *env_composer

docker:
- name: 'main'
image: 'misterio92/ci-php-node:3.0'

php702:
environment:
USER: 'circleci'
<<: *env_composer

docker:
- name: 'main'
image: 'misterio92/ci-php-node:2.0'

commands:
install_yarn:
description: 'Install "yarn" NPM package'
steps:
- 'checkout'
-
run:
<<: *step__run__install_php_extensions
name: 'Install Yarn'
command: 'npm install -g yarn@1.15.2'

install_php_requirements:
description: ''
steps:
-
run:
<<: *step__run__install_composer
-
restore_cache:
<<: *step__restore_cache
name: 'Install required PHP extensions'
command: |
apt-get update
apt-get install -y php-xdebug
composer_install:
description: 'Install Composer dependencies with cache restore and save'
steps:
- restore_cache:
name: 'Composer - cache restore'
keys:
- 'composer-{{ checksum "./composer.lock" }}-1'

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

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

test:
description: 'Run tests'
steps:
-
run:
<<: *step__run__composer_install
name: 'Run unit tests'
command: 'bin/robo test unit'
-
save_cache:
<<: *step__save_cache
codecov/upload:
flags: 'unit'
file: './tests/_output/machine/coverage/unit/coverage.xml'
-
run:
<<: *step__run__linters
name: 'Run acceptance tests'
command: 'bin/robo test acceptance'
-
run:
<<: *step__run__codeception_unit
-
run:
<<: *step__run__codeception_acceptance
codecov/upload:
flags: 'acceptance'
file: './tests/_output/machine/coverage/acceptance/coverage.xml'
-
store_test_results:
<<: *step__store_test_results
-
run:
<<: *step__run__codecov
name: 'Store unit test results'
path: './tests/_output/machine/junit'

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'

php703__lint_and_test:
<<: *job__lint_and_test
docker:
-
image: 'circleci/php:7.3'
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'
- 'install_yarn'
- 'install_php_requirements'
- 'composer_install'
- 'test'
test_php703:
executor: 'php703'
working_directory: '~/repo'
steps:
- 'checkout'
- 'install_yarn'
- 'install_php_requirements'
- 'composer_install'
- 'test'
test_php702:
executor: 'php702'
working_directory: '~/repo'
steps:
- 'checkout'
- 'install_yarn'
- 'install_php_requirements'
- 'composer_install'
- 'test'

workflows:
version: 2.1
php701__lint_and_test:
lint_and_test:
jobs:
- 'php701__lint_and_test'
php702__lint_and_test:
jobs:
- 'php702__lint_and_test'
php703__lint_and_test:
jobs:
- 'php702__lint_and_test'
-
build: {}
-
lint:
requires:
- build
-
test_php704:
requires:
- build
-
test_php703:
requires:
- build
-
test_php702:
requires:
- build
24 changes: 5 additions & 19 deletions RoboFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,9 @@ protected function getTaskCodeceptRunSuite(string $suite): CollectionBuilder
'{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 @@ -373,8 +374,6 @@ protected function getTaskCodeceptRunSuite(string $suite): CollectionBuilder
break;
}
});

return $exitCode;
});
}

Expand Down Expand Up @@ -447,22 +446,9 @@ protected function getTaskReadmeUpdate(): CollectionBuilder
->addTask($writeToFileTask);
}

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()));
$command = [$this->getPhpdbgExecutable(), '-qrr'];

return (new Process($command))->run() === 0;
}
Expand Down Expand Up @@ -504,7 +490,7 @@ protected function validateArgCodeceptionSuiteNames(array $suiteNames): void

$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
1 change: 0 additions & 1 deletion codeception.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ paths:
envs: tests/_envs

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

Expand Down
35 changes: 26 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
{
"type": "robo-tasks",
"name": "sweetchuck/robo-nvm",
"description": "Robo task wrapper for NVM commands.",
"keywords": [
"robo-tasks",
"nvm"
],
"authors": [
{
"name": "Dávid Andor",
"role": "Maintainer",
"homepage": "https://github.com/Sweetchuck"
}
],
"support": {
"source": "https://github.com/Sweetchuck/robo-nvm",
"issues": "https://github.com/Sweetchuck/robo-nvm/issues"
},
"license": "GPL-3.0-or-later",
"minimum-stability": "dev",
"prefer-stable": true,
Expand All @@ -10,20 +26,21 @@
"sort-packages": true
},
"require": {
"php": ">=7.1",
"consolidation/robo": "^1.0",
"php": ">=7.2",
"consolidation/robo": "^2.0",
"danielstjules/stringy": "^3.1",
"sweetchuck/utils": "dev-master"
"sweetchuck/utils": "^0.1"
},
"require-dev": {
"ext-json": "*",
"codeception/codeception": "^2.2",
"squizlabs/php_codesniffer": "^3.3",
"sweetchuck/codeception-module-robo-task-runner": "^0.4",
"codeception/codeception": "^4.0",
"codeception/module-asserts": "^1.1",
"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.20",
"symfony/debug": "^4.1",
"sweetchuck/robo-git": "^0.2",
"sweetchuck/robo-phpcs": "^0.1",
"symfony/error-handler": "^5.0",
"symfony/finder": "^4.0",
"webmozart/path-util": "^2.3"
},
Expand Down
Loading

0 comments on commit 0ad9029

Please sign in to comment.