Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge develop into master #94

Merged
merged 42 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
3160d40
Migrate from Slim to Symfony
Progi1984 Jan 3, 2024
98dcba9
Github Action : Lint PHP
Progi1984 Jan 3, 2024
5b00a71
Fixed feedbacks
Progi1984 Jan 4, 2024
a0ad813
Merge pull request #78 from Progi1984/migrationSymfony
jolelievre Jan 4, 2024
cc20ee9
Added CI PHPStan
Progi1984 Jan 4, 2024
1e2a5dd
Merge pull request #80 from Progi1984/ciPHPStan
Progi1984 Jan 4, 2024
ebfd91b
Added CI PHPUnit
Progi1984 Jan 4, 2024
142a047
fix: update php version on dockerfile
elodie-bil3 Jan 8, 2024
4620529
Merge pull request #84 from PrestaShop/fix/php-version-dockerfile
Progi1984 Jan 8, 2024
7b27320
Merge pull request #81 from Progi1984/ciPHPUnit
Progi1984 Jan 8, 2024
73dafed
build(deps): bump tj-actions/branch-names in /.github/workflows
dependabot[bot] Jan 8, 2024
7561188
Added CI Dependabot
Progi1984 Jan 5, 2024
ee34363
Merge pull request #85 from PrestaShop/dependabot/github_actions/dot-…
Progi1984 Jan 8, 2024
c1fee55
Merge pull request #82 from Progi1984/ciDependabot
Progi1984 Jan 8, 2024
2fec9fb
build(deps-dev): bump phpstan/phpstan from 1.10.50 to 1.10.55
dependabot[bot] Jan 8, 2024
7e247d5
build(deps-dev): bump symfony/phpunit-bridge from 7.0.0 to 7.0.2
dependabot[bot] Jan 8, 2024
696e924
build(deps): bump symfony/framework-bundle from 7.0.0 to 7.0.2
dependabot[bot] Jan 8, 2024
44a1919
build(deps): bump doctrine/orm from 2.17.1 to 2.17.2
dependabot[bot] Jan 8, 2024
0d72ae7
build(deps): bump symfony/flex from 2.4.1 to 2.4.3
dependabot[bot] Jan 8, 2024
5bca7c5
build(deps): bump symfony/dotenv from 7.0.0 to 7.0.2
dependabot[bot] Jan 8, 2024
e9ac6be
Merge pull request #87 from PrestaShop/dependabot/composer/develop/sy…
Progi1984 Jan 8, 2024
0f8a26d
Merge pull request #88 from PrestaShop/dependabot/composer/develop/sy…
Progi1984 Jan 8, 2024
dc0c320
Merge pull request #89 from PrestaShop/dependabot/composer/develop/do…
Progi1984 Jan 9, 2024
1119d30
build(deps-dev): bump phpunit/phpunit from 9.6.13 to 10.5.5
dependabot[bot] Jan 9, 2024
c62ac04
Merge pull request #91 from PrestaShop/dependabot/composer/develop/sy…
Progi1984 Jan 9, 2024
02497ea
Merge pull request #90 from PrestaShop/dependabot/composer/develop/sy…
nicosomb Jan 9, 2024
12071d7
Merge pull request #86 from PrestaShop/dependabot/composer/develop/ph…
nicosomb Jan 9, 2024
5cd3288
Fixed PHPUnit XML Configuration
Progi1984 Jan 9, 2024
c6e0493
Added symfony/apache-pack
Progi1984 Jan 9, 2024
da145aa
Added default value for QANB_GCPURL
Progi1984 Jan 9, 2024
71163ef
Added controller /
Progi1984 Jan 9, 2024
928bdad
Uncatch database exception in Healthcheck
Progi1984 Jan 9, 2024
8801da6
Moved dump
Progi1984 Jan 10, 2024
5f88406
Updated Readme
Progi1984 Jan 10, 2024
983abec
Debug DATABASE_URL
Progi1984 Jan 10, 2024
19128fd
Fixed dump bind
Progi1984 Jan 10, 2024
539c779
Dump more data
Progi1984 Jan 10, 2024
ad13ec1
Modified Dockerfile (variables_order)
Progi1984 Jan 10, 2024
75c1777
Clean the PR
Progi1984 Jan 10, 2024
33f0ca2
Merge pull request #92 from PrestaShop/dependabot/composer/develop/ph…
Progi1984 Jan 10, 2024
9dd612d
Dump in HealthCheck
Progi1984 Jan 11, 2024
0cf6759
Remove dump
Progi1984 Jan 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.ci
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
30 changes: 30 additions & 0 deletions .env.dist
Original file line number Diff line number Diff line change
@@ -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:[email protected]:3306/app?serverVersion=8.0.32&charset=utf8mb4"
# DATABASE_URL="mysql://app:[email protected]:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
###< doctrine/doctrine-bundle ###
11 changes: 11 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -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:[email protected]: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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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';
}
Loading
Loading