From e951b5a2c243553fe62cdacaa324afe04b5aad92 Mon Sep 17 00:00:00 2001 From: Abdel LAMRANI Date: Mon, 3 Aug 2026 10:40:56 +0200 Subject: [PATCH 1/2] config rector for CI --- lint/lint.yml | 13 +++++++++++++ lint/rector.yml | 30 ++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 lint/rector.yml diff --git a/lint/lint.yml b/lint/lint.yml index 61f2966..ed41356 100644 --- a/lint/lint.yml +++ b/lint/lint.yml @@ -1,3 +1,11 @@ +spec: + inputs: + enable_rector: + default: false + type: boolean + +--- + include: - project: 'ldc-web/shared-ci' ref: 'main' @@ -5,6 +13,11 @@ include: - project: 'ldc-web/shared-ci' ref: 'main' file: 'lint/phpstan.yml' + - project: "ldc-web/shared-ci" + ref: "main" + file: "lint/rector.yml" + inputs: + enable_rector: $[[ inputs.enable_rector ]] - project: 'ldc-web/shared-ci' ref: 'main' file: 'lint/eslint.yml' diff --git a/lint/rector.yml b/lint/rector.yml new file mode 100644 index 0000000..7de98f2 --- /dev/null +++ b/lint/rector.yml @@ -0,0 +1,30 @@ +spec: + inputs: + enable_rector: + default: false + type: boolean + +--- + +rector: + stage: lint + image: $CI_REGISTRY/ldc-web/projets/ldc-web-images-docker/uwil-qa-8.5:latest + cache: + key: rector-cache-$CI_COMMIT_REF_SLUG + paths: + - .rector-cache/ + before_script: + - composer config gitlab-token.lab.s-web.fr $CI_DEPLOY_USER $CI_DEPLOY_PASSWORD + - composer install --no-scripts + script: + - vendor/bin/rector process --dry-run --no-progress-bar --output-format=junit > rector-report.xml + artifacts: + when: always + expose_as: 'rector' + paths: + - rector-report.xml + reports: + junit: rector-report.xml + allow_failure: true + rules: + - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && "$[[ inputs.enable_rector ]]" == "true"' \ No newline at end of file From 384b4da9ad32dd3e6a06e74d36695e8b2ae9db61 Mon Sep 17 00:00:00 2001 From: Abdel LAMRANI Date: Mon, 3 Aug 2026 11:08:11 +0200 Subject: [PATCH 2/2] feat: make Larastan bootstrap for phpstan and configurable via inputs --- build/npm.yml | 4 +++- lint/eslint.yml | 5 +++-- lint/lint.yml | 22 ++++++++++++++++++++++ lint/phpstan.yml | 26 ++++++++++++++++++++++++++ lint/stylelint.yml | 7 ++++--- 5 files changed, 58 insertions(+), 6 deletions(-) diff --git a/build/npm.yml b/build/npm.yml index a536d82..e8a8611 100644 --- a/build/npm.yml +++ b/build/npm.yml @@ -1,9 +1,11 @@ npm-build: stage: build - image: node:18 + image: node:24 before_script: - npm config set @ldc-web:registry https://${CI_SERVER_HOST}/api/v4/packages/npm/ - npm config set -- '//${CI_SERVER_HOST}/api/v4/packages/npm/:_authToken' "${CI_DEPLOY_PASSWORD}" + - npm config set @uwil:registry=https://lab.s-web.fr/api/v4/groups/ldc-web/-/packages/npm/ + - npm config set -- '//${CI_SERVER_HOST}/api/v4/groups/ldc-web/-/packages/npm/:_authToken' "${CI_DEPLOY_PASSWORD}" - npm install cache: paths: diff --git a/lint/eslint.yml b/lint/eslint.yml index 85106f2..1651b00 100644 --- a/lint/eslint.yml +++ b/lint/eslint.yml @@ -1,10 +1,11 @@ eslint: stage: lint - image: node:20 + image: node:24 before_script: - npm config set @ldc-web:registry https://${CI_SERVER_HOST}/api/v4/packages/npm/ - - npm config set @uwil:registry https://${CI_SERVER_HOST}/api/v4/packages/npm/ - npm config set -- '//${CI_SERVER_HOST}/api/v4/packages/npm/:_authToken' "${CI_DEPLOY_PASSWORD}" + - npm config set @uwil:registry=https://lab.s-web.fr/api/v4/groups/ldc-web/-/packages/npm/ + - npm config set -- '//${CI_SERVER_HOST}/api/v4/groups/ldc-web/-/packages/npm/:_authToken' "${CI_DEPLOY_PASSWORD}" - npm install cache: paths: diff --git a/lint/lint.yml b/lint/lint.yml index 61f2966..d2c8dcf 100644 --- a/lint/lint.yml +++ b/lint/lint.yml @@ -1,3 +1,19 @@ +spec: + inputs: + larastan_bootstrap: + default: false + type: boolean + db_connection: + default: "sqlite" + db_database: + default: ":memory:" + cache_store: + default: "array" + session_driver: + default: "array" + +--- + include: - project: 'ldc-web/shared-ci' ref: 'main' @@ -5,6 +21,12 @@ include: - project: 'ldc-web/shared-ci' ref: 'main' file: 'lint/phpstan.yml' + inputs: + larastan_bootstrap: $[[ inputs.larastan_bootstrap ]] + db_connection: $[[ inputs.db_connection ]] + db_database: $[[ inputs.db_database ]] + cache_store: $[[ inputs.cache_store ]] + session_driver: $[[ inputs.session_driver ]] - project: 'ldc-web/shared-ci' ref: 'main' file: 'lint/eslint.yml' diff --git a/lint/phpstan.yml b/lint/phpstan.yml index 4d85dbd..8aeaee0 100644 --- a/lint/phpstan.yml +++ b/lint/phpstan.yml @@ -1,9 +1,35 @@ +spec: + inputs: + larastan_bootstrap: + default: false + type: boolean + db_connection: + default: "sqlite" + db_database: + default: ":memory:" + cache_store: + default: "array" + session_driver: + default: "array" + +--- + phpstan: stage: lint image: $CI_REGISTRY/ldc-web/projets/ldc-web-images-docker/uwil-qa-8.5:latest + variables: + DB_CONNECTION: "$[[ inputs.db_connection ]]" + DB_DATABASE: "$[[ inputs.db_database ]]" + CACHE_STORE: "$[[ inputs.cache_store ]]" + SESSION_DRIVER: "$[[ inputs.session_driver ]]" before_script: - composer config gitlab-token.lab.s-web.fr $CI_DEPLOY_USER $CI_DEPLOY_PASSWORD - composer install --no-scripts + - | + if [ "$[[ inputs.larastan_bootstrap ]]" = "true" ]; then + cp .env.example .env + php artisan key:generate + fi script: - vendor/bin/phpstan --error-format=junit > phpstan-report.xml artifacts: diff --git a/lint/stylelint.yml b/lint/stylelint.yml index c6e2e11..a8d6868 100644 --- a/lint/stylelint.yml +++ b/lint/stylelint.yml @@ -1,10 +1,11 @@ stylelint: stage: lint - image: node:18 + image: node:24 before_script: - npm config set @ldc-web:registry https://${CI_SERVER_HOST}/api/v4/packages/npm/ - - npm config set @uwil:registry https://${CI_SERVER_HOST}/api/v4/packages/npm/ - npm config set -- '//${CI_SERVER_HOST}/api/v4/packages/npm/:_authToken' "${CI_DEPLOY_PASSWORD}" + - npm config set @uwil:registry=https://lab.s-web.fr/api/v4/groups/ldc-web/-/packages/npm/ + - npm config set -- '//${CI_SERVER_HOST}/api/v4/groups/ldc-web/-/packages/npm/:_authToken' "${CI_DEPLOY_PASSWORD}" - npm install cache: paths: @@ -19,4 +20,4 @@ stylelint: allow_failure: false rules: - if: $CI_PIPELINE_SOURCE == "merge_request_event" - - if: $CI_COMMIT_BRANCH == "develop" \ No newline at end of file + - if: $CI_COMMIT_BRANCH == "develop"