Commit 83d94d23 authored by David Grüner's avatar David Grüner 🍔
Browse files

Merge branch 'feature/8-provide-sample-project-and-integration-tests' into 'main'

Provide sample project and integration tests #8

Closes #8

See merge request !10
parents 754d804d a3736283
Loading
Loading
Loading
Loading
Loading
+24 −14
Original line number Diff line number Diff line
@@ -20,6 +20,13 @@ variables:
        - $COMPOSER_HOME/cache
        - vendor/

  composer-demo:
    - key: composer-demo-$CI_DEFAULT_BRANCH
      when: always
      paths:
        - $COMPOSER_HOME/cache
        - tests/_demo-project/vendor/

  php-cs-fixer:
    - key: php-cs-fixer-$CI_DEFAULT_BRANCH
      fallback_keys:
@@ -44,13 +51,7 @@ before_script:
  - mkdir -p .robo/bin/
  - if [[ ! -f .robo/bin/robo.phar ]]; then wget https://github.com/consolidation/robo/releases/download/4.0.4/robo.phar -O .robo/bin/robo.phar; fi

####################################################################################################
# _____         _
#|_   _|__  ___| |_
#  | |/ _ \/ __| __|
#  | |  __/\__ \ |_
#  |_|\___||___/\__|
####################################################################################################

test_matrix:
  stage: test
  parallel:
@@ -79,6 +80,22 @@ test_matrix:
    paths:
      - tests/_output/

demo_project:
  stage: test

  cache:
    - !reference [ .caches, composer-demo ]
    - !reference [ .caches, robo ]

  script:
    - php .robo/bin/robo.phar init:demo-project
    - php .robo/bin/robo.phar test:demo-project

  artifacts:
    when: always
    paths:
      - tests/_demo-project/tests/_output/

coveralls_upload:
  stage: reporting
  rules:
@@ -90,13 +107,6 @@ coveralls_upload:
    - wget https://coveralls.io/coveralls-linux.tar.gz -O - | tar -xz
    - ./coveralls report

####################################################################################################
#  ____ _               _
# / ___| |__   ___  ___| | __
#| |   | '_ \ / _ \/ __| |/ /
#| |___| | | |  __/ (__|   <
# \____|_| |_|\___|\___|_|\_\
####################################################################################################
check:
  stage: test
  script:
+1 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@ $finder = PhpCsFixer\Finder::create()
    ->exclude('.robo')
    ->exclude('bin')
    ->exclude('vendor')
    ->notPath('tests/_data')
    ->notPath('tests/_demo-project')
    ->notPath('tests/_output')
    ->notPath('tests/Support/_generated')
;
+27 −1
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ if (!is_file('composer.json')) {
}
chdir($previousWorkingDir);
require $roboDir.'/vendor/autoload.php';

/*
 * =================================================================
 *                        End CI auto fetch
@@ -150,6 +151,31 @@ class RoboFile extends BaseRoboFile
        $this->outputCoverage();
    }

    /**
     * Setup embedded demo project.
     */
    public function initDemoProject(): void
    {
        $this->_execPhp("php ./{$this->dir()}/bin/composer.phar install --no-progress --prefer-dist --optimize-autoloader --working-dir=./tests/_demo-project");
        $this
            ->taskExecPhp('php bin/console cache:warmup --env=test')
            ->dir('tests/_demo-project')
            ->run()
        ;
    }

    /**
     * Run tests.
     */
    public function testDemoProject(): void
    {
        $this
            ->taskExecPhp('php ./vendor/bin/codecept run')
            ->dir('tests/_demo-project')
            ->run()
        ;
    }

    /**
     * Write plain coverage line used for gitlab CI detecting the coverage score.
     */
+5 −1
Original line number Diff line number Diff line
@@ -13,14 +13,18 @@
    "require": {
        "php": ">=8.2",
        "liip/imagine-bundle": "^2.2",
        "symfony-cmf/routing-bundle": "^3.0",
        "symfony/flex": "^2.4",
        "symfony/framework-bundle": "^6.0|^7.0",
        "zero-gravity/zero-gravity-cms": "^0.8"
        "zero-gravity/zero-gravity-cms": "^0.8.3"
    },
    "require-dev": {
        "roave/security-advisories": "dev-latest",
        "codeception/codeception": "^5.0",
        "codeception/module-symfony": "^3.3",
        "phpstan/phpstan": "^1.10",
        "rector/rector": "^0.19.8",
        "symfony/console": "^6.4|^7.0",
        "symfony/var-dumper": "^6.0|^7.0"
    },
    "autoload": {
+2 −1
Original line number Diff line number Diff line
@@ -6,7 +6,8 @@ parameters:
    - tests/

  excludePaths:
    - tests/Support/_generated/*
    - tests/_demo-project/
    - tests/Support/_generated/
    - tests/Support/*Tester.php

  ignoreErrors:
Loading