From cf9020666823c3f5bd5edbd8e080d9d9d7e3b905 Mon Sep 17 00:00:00 2001 From: Matthieu Marcillaud <marcimat@rezo.net> Date: Fri, 27 Dec 2024 12:51:07 +0100 Subject: [PATCH] ci: Ajout de CI --- .editorconfig | 12 +++++++++++ .gitattributes | 5 +++++ .gitlab-ci.yml | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 .editorconfig create mode 100644 .gitattributes create mode 100644 .gitlab-ci.yml diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..c1322dc --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = false +insert_final_newline = false \ No newline at end of file diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..28396e1 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,5 @@ +/.editorconfig export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/.gitlab-ci.yml +/ecs.php export-ignore diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..b5cc4f0 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,57 @@ +stages: + - check + - build + - test + +default: + image: php:latest + cache: + paths: + - vendor/ + before_script: + # Install git + - apt update -yqq + - apt install git libzip-dev -yqq + - docker-php-ext-install zip + + # Install composer + - curl -sS https://getcomposer.org/installer | php + + # Install all project dependencies + - php composer.phar install + +job:check:php: + stage: check + when: on_success + only: + - main + - merge_requests + before_script: + # Remplace le before_script par défaut ! + - curl -o /usr/local/bin/parallel-lint -fsL https://github.com/php-parallel-lint/PHP-Parallel-Lint/releases/latest/download/parallel-lint.phar + script: + # Vérifier rapidement les fichiers + - php /usr/local/bin/parallel-lint --exclude .git --exclude vendor . + +job:build: + stage: build + only: + - main + - merge_requests + script: + # Auditer + - php composer.phar audit + +job:test:ecs: + stage: test + when: on_success + only: + - main + - merge_requests + script: + - php -d display_errors=0 vendor/bin/ecs check --output-format=gitlab > ecs-quality-report.json + artifacts: + paths: + - ecs-quality-report.json + reports: + codequality: ecs-quality-report.json -- GitLab