stages: - install - lint - test - security - build - deploy include: - project: "ldc-web/shared-ci" ref: "main" file: "security/composer.yml" - project: "ldc-web/shared-ci" ref: "main" file: "build/composer.yml" - project: "ldc-web/shared-ci" ref: "main" file: "build/docker.yml" - project: "ldc-web/shared-ci" ref: "main" file: "test/test.yml" - project: "ldc-web/shared-ci" ref: "main" file: "deploy/deploy.yml" # * LINT -------------------------------------------------------------------- .php-lint-base: &php-lint-base image: $CI_REGISTRY/ldc-web/projets/ldc-web-images-docker/uwil-qa-8.5:latest variables: COMPOSER_CACHE_DIR: ".composer-cache" cache: key: files: - composer.lock prefix: "composer" policy: pull paths: - .composer-cache/ - vendor/ before_script: - composer config gitlab-token.lab.s-web.fr $CI_DEPLOY_USER $CI_DEPLOY_PASSWORD - composer install --no-interaction --optimize-autoloader --no-scripts rules: - if: $CI_PIPELINE_SOURCE == "merge_request_event" - if: $CI_COMMIT_BRANCH == "develop" parallel-lint: <<: *php-lint-base stage: lint script: - vendor/bin/parallel-lint --exclude vendor --exclude storage --exclude bootstrap --exclude node_modules . allow_failure: false pint: <<: *php-lint-base stage: lint script: - vendor/bin/pint --test allow_failure: false phpcs: <<: *php-lint-base stage: lint script: - vendor/bin/phpcs --standard=phpcs.xml --extensions=php --ignore=vendor/*,storage/*,bootstrap/*,node_modules/* --report=junit --report-file=phpcs-report.xml artifacts: when: on_failure expose_as: 'phpcs' paths: - phpcs-report.xml reports: junit: phpcs-report.xml allow_failure: false phpstan: <<: *php-lint-base stage: lint variables: PHP_MEMORY_LIMIT: "512M" COMPOSER_CACHE_DIR: ".composer-cache" script: - php -d memory_limit=512M vendor/bin/phpstan --error-format=junit > phpstan-report.xml artifacts: when: on_failure expose_as: 'phpstan' paths: - phpstan-report.xml reports: junit: phpstan-report.xml allow_failure: false # * TESTS ------------------------------------------------------------------- tests_laravel: stage: test image: $CI_REGISTRY/ldc-web/projets/ldc-web-images-docker/uwil-qa-8.5:latest allow_failure: false variables: XDEBUG_MODE: coverage COMPOSER_CACHE_DIR: ".composer-cache" cache: - key: files: - composer.lock prefix: "composer" policy: pull paths: - .composer-cache/ - vendor/ before_script: - composer config gitlab-token.lab.s-web.fr $CI_DEPLOY_USER $CI_DEPLOY_PASSWORD - composer install --no-interaction --prefer-dist --optimize-autoloader --no-scripts script: - cp .env.testing .env - php artisan key:generate - php artisan config:clear - php artisan test --coverage --min=85 --colors=never --log-junit=coverage/junit.xml --coverage-cobertura=coverage/cobertura.xml --coverage-html=coverage/html after_script: - if [ "$CI_JOB_STATUS" == "failed" ]; then cat storage/logs/laravel.log; fi artifacts: when: always expose_as: 'coverage' paths: - coverage/html/ reports: junit: coverage/junit.xml coverage_report: coverage_format: cobertura path: coverage/cobertura.xml coverage: '/^\s*Total:\s*([\d\.]+)%/' rules: - if: $CI_PIPELINE_SOURCE == "merge_request_event" - if: $CI_COMMIT_BRANCH == "trunk" || $CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "main" - if: $CI_COMMIT_TAG != null # * BUILD ------------------------------------------------------------------- npm-build: stage: build script: - echo "No NPM build required for API"