Bläddra i källkod

refactor .gitlab-ci.yml

Olivier Massot 7 månader sedan
förälder
incheckning
d45aef2eb7
1 ändrade filer med 8 tillägg och 15 borttagningar
  1. 8 15
      .gitlab-ci.yml

+ 8 - 15
.gitlab-ci.yml

@@ -25,17 +25,15 @@ build_image:
     - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
     - docker push $CI_REGISTRY_IMAGE:latest
 
-unit:
+.default_config: &default_config
   image: $CI_REGISTRY_IMAGE:latest
-  stage: test
-
-  variables:
-    APP_ENV: staging
-
   before_script:
     - composer config -g cache-dir .composer-cache
     - HOST=ci composer install --prefer-dist --no-progress --no-interaction
 
+unit:
+  <<: *default_config
+  stage: test
   script:
     - php vendor/phpunit/phpunit/phpunit --configuration phpunit.xml.dist --colors=never --no-interaction --testsuite=unit
     #- php vendor/phpunit/phpunit/phpunit --configuration phpunit.xml.dist --colors=never --no-interaction --no-coverage --testsuite=application
@@ -50,17 +48,14 @@ unit:
   coverage: '/^\s*Lines:\s*\d+.\d+\%/'
 
 #doctrine:
+#  <<: *default_config
+#  stage: test
 #  script:
 #    - php bin/console d:s:v
 
 static_analysis:
-  image: $CI_REGISTRY_IMAGE:latest
+  <<: *default_config
   stage: analysis
-
-  before_script:
-    - composer config -g cache-dir .composer-cache
-    - HOST=ci composer install --prefer-dist --no-progress --no-interaction
-
   script:
     - php vendor/bin/phpstan analyse -c phpstan.neon.dist --error-format gitlab > phpstan.json  # Display code quality in MR
     - php vendor/bin/phpstan analyse -c phpstan.neon.dist
@@ -70,12 +65,10 @@ static_analysis:
       codequality: phpstan.json
 
 code_style:
-  image: $CI_REGISTRY_IMAGE:latest
+  <<: *default_config
   stage: analysis
-
   before_script:
     - composer config -g cache-dir .composer-cache
     - HOST=ci composer install --prefer-dist --no-progress --no-interaction
-
   script:
     - php vendor/bin/php-cs-fixer check --config=.php-cs-fixer.dist.php