Bonjour,

Je rencontre un problème concernant la pipeline GitLab et un projet symfony.

J'ai un fichier .gitlab-ci.yml que j'utilise depuis pas très longtemps après l'avoir essayé sur deux projet vierge je n'ai pas de problème.

Par contre j'ai un projet où je souhaite utiliser la pipeline de GitLab et j'ai donc ouvert un repo privé dessus avec une branch dev pour essayer de la mettre en place.

Problème pas moyen d'excéuter les tests unitaires de la pipeline (fonctionne en local).

Du coup, je ne sais pas si cela vien du fichier ou du projet (je dirais le projet :p )

Ce que je fais

Voici mon fichier .gitlab-ci.yml

image: jakzal/phpqa:php7.4
before_script:
  - composer install --no-scripts
cache:
  paths:
    - vendor/
stages:
  - SecurityChecker
  - CodingStandards
  - UnitTests
security-checker:
  stage: SecurityChecker
  script:
    - local-php-security-checker security:check composer.lock
  allow_failure: false
phpcs:
  stage: CodingStandards
  script:
    - phpcs -v --standard=PSR12 --ignore=./src/Kernel.php ./src
  allow_failure: false
phpstan:
  stage: CodingStandards
  script:
    - phpstan analyse ./src
  allow_failure: false
twig-lint:
  stage: CodingStandards
  script:
    - twig-lint lint ./templates
  allow_failure: false
phpunit:
  stage: UnitTests
  script:
    - php bin/phpunit
  allow_failure: false

Mon composer.json

{
    "type": "project",
    "license": "proprietary",
    "require": {
        "php": "^7.4.12",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "composer/package-versions-deprecated": "^1.11",
        "doctrine/doctrine-bundle": "^2.2.3",
        "doctrine/doctrine-migrations-bundle": "^3.0",
        "doctrine/orm": "^2.8.1",
        "friendsofsymfony/ckeditor-bundle": "^2.3",
        "fzaninotto/faker": "^1.9",
        "sensio/framework-extra-bundle": "^5.6.1",
        "stof/doctrine-extensions-bundle": "^1.5",
        "symfony/apache-pack": "^1.0",
        "symfony/asset": "5.2.*",
        "symfony/browser-kit": "5.2.*",
        "symfony/console": "5.2.*",
        "symfony/css-selector": "5.2.*",
        "symfony/doctrine-bridge": "5.2.*",
        "symfony/dotenv": "5.2.*",
        "symfony/expression-language": "5.2.*",
        "symfony/flex": "^1.12.1",
        "symfony/form": "5.2.*",
        "symfony/framework-bundle": "5.2.*",
        "symfony/http-client": "5.2.*",
        "symfony/intl": "5.2.*",
        "symfony/mailer": "5.2.*",
        "symfony/monolog-bundle": "^3.6",
        "symfony/notifier": "5.2.*",
        "symfony/phpunit-bridge": "^5.2",
        "symfony/process": "5.2.*",
        "symfony/security-bundle": "5.2.*",
        "symfony/security-csrf": "5.2.*",
        "symfony/serializer-pack": "*",
        "symfony/string": "^5.1",
        "symfony/swiftmailer-bundle": "^3.5.2",
        "symfony/translation": "5.2.*",
        "symfony/twig-pack": "*",
        "symfony/validator": "5.2.*",
        "symfony/web-link": "5.2.*",
        "symfony/yaml": "5.2.*",
        "twig/extensions": "^1.5",
        "twig/extra-bundle": "^v3.3.0",
        "twig/string-extra": "^v3.3.0"
    },
    "require-dev": {
        "doctrine/doctrine-fixtures-bundle": "^3.4",
        "phpunit/phpunit": "^9.5",
        "squizlabs/php_codesniffer": "3.*",
        "symfony/debug-pack": "*",
        "symfony/maker-bundle": "^1.0",
        "symfony/profiler-pack": "*",
        "symfony/var-dumper": "^5.2",
        "symfony/web-profiler-bundle": "^5.2"
    },
    "config": {
        "preferred-install": {
            "*": "dist"
        },
        "sort-packages": true
    },
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/"
        }
    },
    "replace": {
        "paragonie/random_compat": "2.*",
        "symfony/polyfill-ctype": "*",
        "symfony/polyfill-iconv": "*",
        "symfony/polyfill-php72": "*",
        "symfony/polyfill-php71": "*",
        "symfony/polyfill-php70": "*",
        "symfony/polyfill-php56": "*"
    },
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install %PUBLIC_DIR%": "symfony-cmd"
        },
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ]
    },
    "conflict": {
        "symfony/symfony": "*"
    },
    "extra": {
        "symfony": {
            "allow-contrib": true,
            "require": "5.2.*"
        }
    }
}

Ce que je veux

Comprendre pourquoi cela ne fonctionne pas.

Ce que j'obtiens

Use the `composer fund` command to find out more!
$ php bin/phpunit
Could not open input file: bin/phpunit
Cleaning up file based variables

Je vous remercie d'avance pour vos lumières

2 réponses


install symfony/phpunit-bridge en dev plutôt que phpunit directement

Merci pour ta réponse.

J'ai essayé symfony/phpunit-bridge mais même problème (j'ai enlevé phpunit de mon composer.json avant)

C'est un poil frustrant :D