Skip to content

Commit

Permalink
Merge pull request #94 from PrestaShop/develop
Browse files Browse the repository at this point in the history
Merge `develop` into `master`
  • Loading branch information
Progi1984 committed Jan 11, 2024
2 parents 6cb7cb1 + 0cf6759 commit 4884e4f
Show file tree
Hide file tree
Showing 68 changed files with 9,648 additions and 3,488 deletions.
1 change: 1 addition & 0 deletions .env.ci
@@ -0,0 +1 @@
DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
30 changes: 30 additions & 0 deletions .env.dist
@@ -0,0 +1,30 @@
# In all environments, the following files are loaded if they exist,
# the latter taking precedence over the former:
#
# * .env contains default values for the environment variables needed by the app
# * .env.local uncommitted file with local overrides
# * .env.$APP_ENV committed environment-specific defaults
# * .env.$APP_ENV.local uncommitted environment-specific overrides
#
# Real environment variables win over .env files.
#
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
# https://symfony.com/doc/current/configuration/secrets.html
#
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration

###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=329c08089dae58b62725c9bd011e847c
###< symfony/framework-bundle ###

###> doctrine/doctrine-bundle ###
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
#
DATABASE_URL=
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4"
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
###< doctrine/doctrine-bundle ###
11 changes: 11 additions & 0 deletions .env.test
@@ -0,0 +1,11 @@
# define your env variables for the test env here
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:password@127.0.0.1:3306/qanightlyresults?serverVersion=8.0.23&charset=utf8mb4"

QANB_GCPURL=https://storage.googleapis.com/prestashop-core-nightly/
QANB_TOKEN='AZERTY'
14 changes: 14 additions & 0 deletions .github/dependabot.yml
@@ -0,0 +1,14 @@
version: 2
updates:
- package-ecosystem: composer
directory: "/"
schedule:
interval: weekly
day: monday
time: "04:00"
open-pull-requests-limit: 10
target-branch: develop
reviewers:
- "PrestaShop/ui-tests-maintainers"
labels:
- "dependencies"
2 changes: 1 addition & 1 deletion .github/workflows/integration-cd.yml
Expand Up @@ -26,7 +26,7 @@ jobs:

- name: Get branch name
id: branch
uses: tj-actions/branch-names@v5.1
uses: tj-actions/branch-names@v7.0.7

- name: Trigger CI / CD
uses: aurelien-baudet/workflow-dispatch@v2
Expand Down
118 changes: 118 additions & 0 deletions .github/workflows/php.yml
@@ -0,0 +1,118 @@
name: PHP
on:
push:
pull_request:

permissions:
contents: read

jobs:
php-cs-fixer:
permissions:
contents: read # for actions/checkout to fetch code
name: PHP CS Fixer
runs-on: ubuntu-latest
env:
APP_ENV: ci
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v3

- name: Config
run: cp .env.dist .env

- name: Validate composer config
run: composer validate --strict

- name: Composer Install
run: composer install --ansi --prefer-dist --no-interaction --no-progress

- name: Run PHPCSFixer
run: ./vendor/bin/php-cs-fixer fix --dry-run --diff

- name: Run ergebnis/composer-normalize
run: composer normalize --dry-run --no-check-lock
phpstan:
permissions:
contents: read # for actions/checkout to fetch code
name: PHP Static Analysis
runs-on: ubuntu-latest
env:
APP_ENV: ci
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/checkout@v3

- name: Config
run: cp .env.dist .env

- name: Composer Install
run: composer install --ansi --prefer-dist --no-interaction --no-progress

- name: Run phpstan
run: ./vendor/bin/phpstan analyse
phpunit:
permissions:
contents: read # for actions/checkout to fetch code
name: PHPUnit
runs-on: ubuntu-latest
env:
APP_ENV: test
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Setup MySQL
uses: mirromutth/mysql-action@v1.1
with:
mysql version: '8.0'
mysql database: 'qanightlyresults'
mysql root password: 'password'

- uses: actions/checkout@v3

- name: Config
run: cp .env.dist .env

- name: Composer Install
run: composer install --ansi --prefer-dist --no-interaction --no-progress

- name: Change MySQL authentication method
run: sleep 15 && mysql -h127.0.0.1 -uroot -ppassword -e "ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'password'; FLUSH PRIVILEGES;"

- name: Setup database
run: php bin/console doctrine:schema:update --dump-sql --force --env=test

- name: Inject data for AutoUpgrade
run: |
DATE=$(date -d "2 days ago" +"%Y-%m-%d")
php bin/console nightly:import autoupgrade_$DATE-develop.json\
-p cli \
-c autoupgrade \
--env test
- name: Inject data for Core
run: |
DATE=$(date -d "2 days ago" +"%Y-%m-%d")
php bin/console nightly:import $DATE-develop.json\
-p chromium \
-c functional \
--env test
- name: Run phpunit
run: ./vendor/bin/phpunit
2 changes: 1 addition & 1 deletion .github/workflows/preproduction-cd.yml
Expand Up @@ -18,7 +18,7 @@ jobs:

- name: Get branch name
id: branch
uses: tj-actions/branch-names@v5.1
uses: tj-actions/branch-names@v7.0.7

- name: Trigger CI / CD
uses: aurelien-baudet/workflow-dispatch@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/production-cd.yml
Expand Up @@ -17,7 +17,7 @@ jobs:

- name: Get branch name
id: branch
uses: tj-actions/branch-names@v5.1
uses: tj-actions/branch-names@v7.0.7

- name: Trigger CI / CD
uses: aurelien-baudet/workflow-dispatch@v2
Expand Down
32 changes: 29 additions & 3 deletions .gitignore
@@ -1,3 +1,29 @@
.idea/
vendor/**
.php_cs.cache

###> symfony/framework-bundle ###
/.env
/.env.local
/.env.local.php
/.env.*.local
/config/secrets/prod/prod.decrypt.private.php
/public/bundles/
/var/
/vendor/
###< symfony/framework-bundle ###

###> symfony/phpunit-bridge ###
.phpunit.result.cache
/phpunit.xml
###< symfony/phpunit-bridge ###

###> phpunit/phpunit ###
/phpunit.xml
.phpunit.result.cache
###< phpunit/phpunit ###

###> friendsofphp/php-cs-fixer ###
/.php-cs-fixer.php
/.php-cs-fixer.cache
###< friendsofphp/php-cs-fixer ###

###> phpstan/phpstan ###
###< phpstan/phpstan ###
48 changes: 48 additions & 0 deletions .php-cs-fixer.dist.php
@@ -0,0 +1,48 @@
<?php

ini_set('memory_limit','256M');

$finder = PhpCsFixer\Finder::create()->in([
__DIR__.'/src',
__DIR__.'/migrations',
__DIR__.'/public',
__DIR__.'/tests',
]);

return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
'array_indentation' => true,
'cast_spaces' => [
'space' => 'single',
],
'combine_consecutive_issets' => true,
'concat_space' => [
'spacing' => 'one',
],
'error_suppression' => [
'mute_deprecation_error' => false,
'noise_remaining_usages' => false,
'noise_remaining_usages_exclude' => [],
],
'function_to_constant' => false,
'method_chaining_indentation' => true,
'no_alias_functions' => false,
'no_superfluous_phpdoc_tags' => false,
'non_printable_character' => [
'use_escape_sequences_in_strings' => true,
],
'phpdoc_align' => [
'align' => 'left',
],
'phpdoc_summary' => false,
'protected_to_private' => false,
'psr_autoloading' => false,
'self_accessor' => false,
'yoda_style' => false,
'single_line_throw' => false,
'no_alias_language_construct_call' => false,
])
->setFinder($finder)
->setCacheFile(__DIR__.'/var/.php_cs.cache');
11 changes: 0 additions & 11 deletions .php_cs.dist

This file was deleted.

5 changes: 3 additions & 2 deletions Dockerfile
@@ -1,4 +1,4 @@
FROM php:7.2-apache as builder
FROM php:8.3-apache as builder

RUN apt-get update && \
apt-get install -y \
Expand All @@ -15,7 +15,7 @@ RUN composer update && \
composer install


FROM php:7.2-apache
FROM php:8.3-apache

RUN apt-get update && \
apt-get install -y \
Expand All @@ -42,4 +42,5 @@ RUN mv /var/www/html/vhost.conf /etc/apache2/sites-enabled/000-default.conf && \
a2enmod headers

RUN sed -i 's/^max_execution_time = .*/max_execution_time = 300/' /usr/local/etc/php/php.ini-production && \
sed -i 's/variables_order = "GPCS"/variables_order = "EGPCS"/' /usr/local/etc/php/php.ini-production && \
mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
7 changes: 5 additions & 2 deletions README.md
@@ -1,7 +1,6 @@
# QANightlyResults

QANightlyResults is a Slim Framework app, acting as a backend (via a JSON API) to handle
and browse tests reports records.
QANightlyResults is a Symfony app, acting as a backend (via a JSON API) to handle and browse tests reports records.

You can use any frontend app you want to consume this API. We use a [Vue app](https://github.com/PrestaShop/nightly-board).

Expand All @@ -18,6 +17,10 @@ Don't forget to launch `composer install` to install all dependencies.

### Configuration

You can create a `.env.local` file at the root of the project.

### Configuration

You can edit the `settings.php` file in the `src/` folder (no recommended). You can also pass the values via environment variables. Here are the main ones:

|Variables | |
Expand Down
17 changes: 17 additions & 0 deletions bin/console
@@ -0,0 +1,17 @@
#!/usr/bin/env php
<?php

use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;

if (!is_file(dirname(__DIR__).'/vendor/autoload_runtime.php')) {
throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".');
}

require_once dirname(__DIR__).'/vendor/autoload_runtime.php';

return function (array $context) {
$kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);

return new Application($kernel);
};
23 changes: 23 additions & 0 deletions bin/phpunit
@@ -0,0 +1,23 @@
#!/usr/bin/env php
<?php

if (!ini_get('date.timezone')) {
ini_set('date.timezone', 'UTC');
}

if (is_file(dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit')) {
if (PHP_VERSION_ID >= 80000) {
require dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit';
} else {
define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__).'/vendor/autoload.php');
require PHPUNIT_COMPOSER_INSTALL;
PHPUnit\TextUI\Command::main();
}
} else {
if (!is_file(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php')) {
echo "Unable to find the `simple-phpunit.php` script in `vendor/symfony/phpunit-bridge/bin/`.\n";
exit(1);
}

require dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php';
}

0 comments on commit 4884e4f

Please sign in to comment.