Skip to content

Commit 9f1744f

Browse files
committed
CI: add testing
1 parent f0c70d9 commit 9f1744f

File tree

12 files changed

+3026
-2413
lines changed

12 files changed

+3026
-2413
lines changed

.env.test

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# define your env variables for the test env here
2+
KERNEL_CLASS='App\Kernel'
3+
APP_SECRET='$ecretf0rt3st'
4+
SYMFONY_DEPRECATIONS_HELPER=999999
5+
PANTHER_APP_ENV=panther
6+
PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots

.github/workflows/ci.yaml

Lines changed: 39 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,53 @@
1-
name: CI
1+
name: Continuous Integration
22

3-
on: [push]
3+
on: [push, pull_request]
4+
5+
defaults:
6+
run:
7+
shell: bash
48

59
jobs:
6-
composer:
10+
tests:
711
runs-on: ubuntu-latest
8-
steps:
9-
- uses: actions/checkout@v2
1012

11-
- name: Install dependencies
12-
uses: php-actions/composer@v6
13-
with:
14-
command: validate
15-
args: strict
13+
strategy:
14+
matrix:
15+
php: [ '8.0' ]
1616

17-
- uses: php-actions/composer@v6
18-
with:
19-
command: outdated
20-
args: direct
21-
22-
# phpunit:
23-
# steps:
24-
# - uses: php-actions/phpunit@v9
25-
# with:
26-
# php_version: 7.4.3
27-
phpstan:
28-
name: phpstan
29-
runs-on: ubuntu-latest
3017
steps:
31-
- name: Checkout project
18+
- name: Checkout
3219
uses: actions/checkout@v2
3320

21+
- name: Install system dependencies
22+
run: |
23+
echo "::group::apt-get update"
24+
sudo apt-get update
25+
echo "::endgroup::"
26+
27+
- name: Setup PHP
28+
uses: shivammathur/setup-php@v2
29+
with:
30+
coverage: "none"
31+
extensions: "ctype,iconv,intl,json,xsl"
32+
ini-values: date.timezone=Europe/Paris,memory_limit=-1,default_socket_timeout=10,session.gc_probability=0,apc.enable_cli=1
33+
php-version: "${{ matrix.php }}"
34+
tools: pecl
35+
36+
- name: Display versions
37+
run: |
38+
php -r 'foreach (get_loaded_extensions() as $extension) echo $extension . " " . phpversion($extension) . PHP_EOL;'
39+
php -i
40+
3441
- name: Install dependencies
3542
uses: php-actions/composer@v6
36-
with:
37-
# php_extensions: intl ctype iconv pdo_pgsql
38-
dev: no
39-
args: --profile --ignore-platform-reqs
4043

4144
- name: Run phpstan
42-
uses: actions-x/phpstan@v1
45+
uses: actions-x/phpstan@v1
46+
with:
47+
level: 4
48+
directories: src tests
49+
50+
- name: Run tests
51+
uses: php-actions/phpunit@v9
4352
with:
44-
phpstanVersion: ^0.12
45-
level: 4
46-
paths: src
53+
php_version: 8.0

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,13 @@ npm-debug.log
1717
yarn-error.log
1818
###< symfony/webpack-encore-bundle ###
1919
/.php-cs-fixer.cache
20+
21+
###> symfony/phpunit-bridge ###
22+
.phpunit.result.cache
23+
/phpunit.xml
24+
###< symfony/phpunit-bridge ###
25+
26+
###> phpunit/phpunit ###
27+
/phpunit.xml
28+
.phpunit.result.cache
29+
###< phpunit/phpunit ###

Makefile

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,23 @@ frontend-dev:
3737
frontend-prod:
3838
yarn encore production
3939

40-
ci: ## run CI
40+
ci: composer phpstan cs-fix-dry test ## run CI
41+
42+
composer:
4143
./bin/composer validate
4244
./bin/composer outdated --direct
45+
46+
phpstan: ## run phpstan
4347
./devops-ci/vendor/bin/phpstan analyse -l 4 src
48+
./devops-ci/vendor/bin/phpstan analyse -l 4 tests
49+
50+
cs-fix-dry:
51+
./devops-ci/vendor/bin/php-cs-fixer fix --show-progress=dots --diff --dry-run src
52+
./devops-ci/vendor/bin/php-cs-fixer fix --show-progress=dots --diff --dry-run tests
4453

4554
cs-fix:
46-
./devops-ci/vendor/bin/php-cs-fixer fix src
55+
./devops-ci/vendor/bin/php-cs-fixer fix --show-progress=dots --diff src
56+
./devops-ci/vendor/bin/php-cs-fixer fix --show-progress=dots --diff tests
57+
58+
test:
59+
./vendor/bin/phpunit -c phpunit.xml.dist

bin/phpunit

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
if (!ini_get('date.timezone')) {
5+
ini_set('date.timezone', 'UTC');
6+
}
7+
8+
if (is_file(dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit')) {
9+
define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__).'/vendor/autoload.php');
10+
require PHPUNIT_COMPOSER_INSTALL;
11+
PHPUnit\TextUI\Command::main();
12+
} else {
13+
if (!is_file(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php')) {
14+
echo "Unable to find the `simple-phpunit.php` script in `vendor/symfony/phpunit-bridge/bin/`.\n";
15+
exit(1);
16+
}
17+
18+
require dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php';
19+
}

composer.json

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,41 @@
33
"description": "c-base recunstruction project 3, the artefact guide",
44
"type": "project",
55
"license": "MIT",
6-
"minimum-stability": "stable",
7-
"prefer-stable": true,
6+
"minimum-stability": "dev",
7+
"prefer-stable": false,
88
"require": {
9-
"php": ">=7.4.3",
9+
"php": ">=8.0",
1010
"ext-ctype": "*",
1111
"ext-iconv": "*",
1212
"ext-intl": "*",
1313
"ext-pdo_pgsql": "*",
1414
"doctrine/doctrine-bundle": "^2.4",
1515
"doctrine/doctrine-migrations-bundle": "^3.1",
16-
"doctrine/orm": "^2.10",
17-
"easycorp/easyadmin-bundle": "^3",
16+
"doctrine/orm": "^3.0",
1817
"sensio/framework-extra-bundle": "^6.2",
19-
"symfony/console": "5.3.*",
20-
"symfony/dotenv": "5.3.*",
18+
"symfony/console": "^6.0",
19+
"symfony/dotenv": "^6.0",
2120
"symfony/flex": "^1.3.1",
22-
"symfony/framework-bundle": "5.3.*",
21+
"symfony/framework-bundle": "^6.0",
2322
"symfony/monolog-bundle": "^3.7",
24-
"symfony/proxy-manager-bridge": "5.3.*",
25-
"symfony/runtime": "5.3.*",
26-
"symfony/serializer": "5.3.*",
27-
"symfony/twig-bundle": "5.3.*",
28-
"symfony/webpack-encore-bundle": "^1.12",
29-
"symfony/yaml": "5.3.*",
23+
"symfony/proxy-manager-bridge": "^6.0",
24+
"symfony/runtime": "^6.0",
25+
"symfony/serializer": "^6.0",
26+
"symfony/twig-bundle": "^6.0",
27+
"symfony/webpack-encore-bundle": "^1.13",
28+
"symfony/yaml": "^6.0",
3029
"twig/extra-bundle": "^2.12|^3.0",
3130
"twig/twig": "^2.12|^3.0"
3231
},
3332
"require-dev": {
34-
"symfony/debug-bundle": "5.3.*",
35-
"symfony/maker-bundle": "^1.34",
36-
"symfony/stopwatch": "5.3.*",
37-
"symfony/web-profiler-bundle": "5.3.*"
33+
"phpunit/phpunit": "10.0.x-dev",
34+
"symfony/browser-kit": "^6.0",
35+
"symfony/css-selector": "^6.0",
36+
"symfony/debug-bundle": "^6.0",
37+
"symfony/maker-bundle": "dev-main",
38+
"symfony/phpunit-bridge": "6.0.x-dev",
39+
"symfony/stopwatch": "^6.0",
40+
"symfony/web-profiler-bundle": "^6.0"
3841
},
3942
"config": {
4043
"optimize-autoloader": true,
@@ -76,7 +79,7 @@
7679
"extra": {
7780
"symfony": {
7881
"allow-contrib": false,
79-
"require": "5.3.*"
82+
"require": "^6.0"
8083
}
8184
}
8285
}

0 commit comments

Comments
 (0)