Skip to content

Commit

Permalink
Merge branch 'master' into change-deploy-script-for-new-version
Browse files Browse the repository at this point in the history
  • Loading branch information
Sander authored Mar 11, 2022
2 parents 4ec8570 + 105f653 commit e1f010a
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 105 deletions.
2 changes: 0 additions & 2 deletions .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@
KERNEL_CLASS='App\Kernel'
APP_SECRET='$ecretf0rt3st'
SYMFONY_DEPRECATIONS_HELPER=999999
PANTHER_APP_ENV=panther
PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots
DATABASE_URL="mysql://root:[email protected]:3306/ci?serverVersion=5.7"
40 changes: 20 additions & 20 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ cache: &global_cache

# Build section
Install dependencies and build assets:
image: sumocoders/cli-tools-php80:latest
image: sumocoders/cli-tools-php81:latest
script:
- COMPOSER_MEMORY_LIMIT=-1 composer install --no-scripts --no-progress
- COMPOSER_MEMORY_LIMIT=-1 composer run-script post-autoload-dump
Expand All @@ -37,7 +37,7 @@ Install dependencies and build assets:

# Code Quality section
PHP_CodeSniffer - check code styling:
image: sumocoders/framework-php80:latest
image: sumocoders/framework-php81:latest
script:
- vendor/bin/phpcs --report-full --report-junit=phpcs-report.xml
artifacts:
Expand All @@ -48,10 +48,9 @@ PHP_CodeSniffer - check code styling:
needs: ["Install dependencies and build assets"]
tags:
- docker
allow_failure: true

PHPStan - check for bugs:
image: sumocoders/framework-php80:latest
image: sumocoders/framework-php81:latest
before_script:
# disable Xdebug and Blackfire extensions
- |
Expand All @@ -72,10 +71,9 @@ PHPStan - check for bugs:
needs: ["Install dependencies and build assets"]
tags:
- docker
allow_failure: true

Twigcs - check code styling:
image: sumocoders/framework-php80:latest
image: sumocoders/framework-php81:latest
script:
- vendor/bin/twigcs --no-interaction --exclude=vendor --reporter=junit > twigcs-report.xml
after_script:
Expand All @@ -92,7 +90,7 @@ Twigcs - check code styling:
allow_failure: true

Stylelint - check code styling:
image: sumocoders/cli-tools-php80:latest
image: sumocoders/cli-tools-php81:latest
script:
- vendor/bin/convert-to-junit-xml convert:stylelint "$(nvm exec --silent node_modules/.bin/stylelint --formatter=json .)" > stylelint-report.xml
after_script:
Expand All @@ -109,7 +107,7 @@ Stylelint - check code styling:
allow_failure: true

StandardJS - check code styling:
image: sumocoders/cli-tools-php80:latest
image: sumocoders/cli-tools-php81:latest
script:
- vendor/bin/convert-to-junit-xml convert:standardjs "$(nvm exec --silent node_modules/.bin/standard)" > standardjs-report.xml
after_script:
Expand All @@ -126,7 +124,7 @@ StandardJS - check code styling:
allow_failure: true

TODOs - check for unfinished code:
image: sumocoders/cli-tools-php80:latest
image: sumocoders/cli-tools-php81:latest
script:
- >
vendor/bin/convert-to-junit-xml convert:grep "$(
Expand Down Expand Up @@ -169,7 +167,7 @@ TODOs - check for unfinished code:

# Dependency Scanning section
NPM packages - check for vulnerabilities:
image: sumocoders/cli-tools-php80:latest
image: sumocoders/cli-tools-php81:latest
script:
- vendor/bin/convert-to-junit-xml convert:npm-audit "$(nvm exec --silent npm audit --json)" > npm-audit-report.xml
after_script:
Expand All @@ -186,7 +184,7 @@ NPM packages - check for vulnerabilities:
allow_failure: true

PHP packages - check for vulnerabilities:
image: sumocoders/cli-tools-php80:latest
image: sumocoders/cli-tools-php81:latest
before_script:
- PHP_SC_VERSION=$(curl -s "https://api.github.com/repos/fabpot/local-php-security-checker/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/;s/^v//')
- curl -LSs https://github.com/fabpot/local-php-security-checker/releases/download/v${PHP_SC_VERSION}/local-php-security-checker_${PHP_SC_VERSION}_linux_amd64 > ./php-security-checker
Expand All @@ -209,16 +207,18 @@ PHP packages - check for vulnerabilities:

# Test section
PHPUnit - Run tests:
image: sumocoders/framework-php80:latest
image: sumocoders/framework-php81:latest
services:
- mysql:5.7
before_script:
# install Chromium
- apt-get --allow-releaseinfo-change update && apt-get install -y chromium
# install Chromium Chromedriver
- |
curl -s -f -L -o /tmp/chromedriver.zip http://chromedriver.storage.googleapis.com/`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE_97`/chromedriver_linux64.zip
unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/
# Uncomment this if you need Chrome for PDF's
# or if you have integration tests that use Symfony Panther (https://github.com/symfony/panther)
# # install Chromium
# - apt-get --allow-releaseinfo-change update && apt-get install -y chromium
# # install Chromium Chromedriver
# - |
# curl -s -f -L -o /tmp/chromedriver.zip http://chromedriver.storage.googleapis.com/`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE_97`/chromedriver_linux64.zip
# unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/
# disable Xdebug and Blackfire extensions
- |
mkdir /usr/local/etc/php/conf.d/disabled
Expand Down Expand Up @@ -247,7 +247,7 @@ PHPUnit - Run tests:

# Deploy section
Deploy - to staging:
image: sumocoders/cli-tools-php80:latest
image: sumocoders/cli-tools-php81:latest
before_script:
# Add the private SSH key to the CI environment
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
Expand All @@ -261,7 +261,7 @@ Deploy - to staging:
- vendor/bin/dep deploy stage=staging
environment:
name: staging
url: https://$project.$client.php80.sumocoders.eu
url: https://$project.$client.php81.sumocoders.eu
only:
- staging
stage: deploy
Expand Down
10 changes: 6 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"license": "proprietary",
"minimum-stability": "beta",
"require": {
"php": "^8.0",
"php": "^8.1",
"ext-ctype": "*",
"ext-iconv": "*",
"ext-sodium": "*",
Expand Down Expand Up @@ -34,19 +34,21 @@
"require-dev": {
},
"flex-require-dev": {
"dbrekelmans/bdi": "^0.3.0",
"doctrine/doctrine-fixtures-bundle": "^3.4",
"friendsoftwig/twigcs": "^5.0",
"phpstan/phpstan-symfony": "^1.0",
"squizlabs/php_codesniffer": "^3.4",
"symfony/debug-pack": "*",
"symfony/panther": "^1.0",
"symfony/phpunit-bridge": "^5.2",
"tijsverkoyen/deployer-sumo": "^2.0"
},
"config": {
"optimize-autoloader": true,
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"symfony/flex": true,
"symfony/runtime": true
}
},
"autoload": {
"psr-4": {
Expand Down
4 changes: 3 additions & 1 deletion deploy.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
set('repository', '$repository');
set('production_url', '$productionUrl');
set('production_user', '$productionUser');
set('php_version', '8.0');
set('php_version', '8.1');

// Define staging
host('dev02.sumocoders.eu')
Expand Down Expand Up @@ -74,6 +74,8 @@
return '{{bin/php}} {{shared_folder}}/composer.phar';
});

set('keep_releases', 3);

/**********************
* Flow configuration *
**********************/
Expand Down
5 changes: 0 additions & 5 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,4 @@
<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
</listeners>

<!-- Run `composer require symfony/panther` before enabling this extension -->
<extensions>
<extension class="Symfony\Component\Panther\ServerExtension" />
</extensions>
</phpunit>
27 changes: 11 additions & 16 deletions src/Skeleton/PostCreateProject.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public static function run(Event $event)
self::cleanupFiles($event);
self::cleanup($event);
self::runNpmBuild($event);
self::findChromeAndGeckoDriver($event);
self::dumpInitialTranslations($event);
}

Expand Down Expand Up @@ -128,15 +127,14 @@ private static function installFrameworkStylePackage(Event $event): void
$io->write(' Create new instance of the Framework object');
}
$insert = [
'new Framework()',
'window.framework = new Framework()',
];
$content = self::insertStringAtPosition(
$content,
mb_strlen($content),
"\n" . implode("\n", $insert) . "\n"
);


// store the file
file_put_contents($projectDir . '/assets/app.js', $content);

Expand All @@ -151,6 +149,14 @@ private static function installFrameworkStylePackage(Event $event): void
if (file_exists($projectDir . '/assets/bootstrap.js')) {
shell_exec(' node_modules/.bin/standard assets/bootstrap.js --quiet --fix');
}

/*
* Remove the Symfony default Stimulus controller. We don't use it
* and it doesn't pass our StandardJS CI checks.
*/
if (file_exists($projectDir . '/assets/controllers/hello_controller.js')) {
shell_exec(sprintf('rm -rf %1$s', $projectDir . '/assets/controllers/hello_controller.js'));
}
}

private static function reconfigureWebpack(Event $event): void
Expand Down Expand Up @@ -468,13 +474,13 @@ private static function reconfigureApplication(Event $event): void
file_put_contents($projectDir . '/config/packages/translation.yaml', $content);

$io->notice('→ Reconfigure doctrine test environment');
$content = file_get_contents($projectDir . '/config/packages/test/doctrine.yaml');
$content = file_get_contents($projectDir . '/config/packages/doctrine.yaml');
$content = preg_replace(
'/dbname_suffix: \'.*?\'/smU',
'dbname_suffix: \'%env(string:default::TEST_TOKEN)%\'',
$content
);
file_put_contents($projectDir . '/config/packages/test/doctrine.yaml', $content);
file_put_contents($projectDir . '/config/packages/doctrine.yaml', $content);

$io->notice('→ Reconfigure doctrine migrations');
$content = file_get_contents($projectDir . '/config/packages/doctrine_migrations.yaml');
Expand Down Expand Up @@ -625,17 +631,6 @@ private static function copyDirectoryContent(string $source, string $destination
}
}

private static function findChromeAndGeckoDriver(Event $event): void
{
$io = $event->getIO();
$io->info('Run `vendor/bin/bdi detect drivers`');

$output = shell_exec('vendor/bin/bdi detect drivers');
if ($io->isVerbose()) {
$io->write($output);
}
}

private static function testCommandLocally(string $command): bool
{
return shell_exec(sprintf("which %s", escapeshellcmd($command))) !== null;
Expand Down
57 changes: 0 additions & 57 deletions tests/PagesAreFoundTest.php

This file was deleted.

0 comments on commit e1f010a

Please sign in to comment.