diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 52694a824202f130423d4dd723c9f445fd09b9f3..b2fcb73c3bf4d3c733dfec3ba44e5485418bf005 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -69,7 +69,6 @@ variables: # Stages # ############# stages: - - ðŸ—ï¸ Build - 🪄 Lint - ðŸ—œï¸ Test @@ -96,11 +95,7 @@ default: .with-composer: &with-composer needs: - - 'ðŸ“¦ï¸ Composer' - -.with-yarn: &with-yarn - needs: - - 'ðŸ“¦ï¸ Yarn' + - '🧹 PHP Coding standards (PHPCS)' .default-job-settings-lint: &default-job-settings-lint rules: @@ -313,65 +308,22 @@ default: needs: [ '[Daily] PHP 8.1 PostgreSQL 14.1' ] <<: [ *run-daily ] -################ -# Build Jobs for linting -################ - -'ðŸ“¦ï¸ Composer': - variables: - KUBERNETES_CPU_REQUEST: "1" - stage: ðŸ—ï¸ Build - cache: - key: - files: - - ./composer.json - - ./composer.lock - paths: - - ./vendor - artifacts: - expire_in: 1 week - expose_as: 'web-vendor' - paths: - - vendor/ - script: - - composer validate - - composer install --optimize-autoloader - - if [ -n "$COMPOSER_UPDATE" ]; then - composer update --optimize-autoloader; - composer outdated; - fi - -'ðŸ“¦ï¸ Yarn': - variables: - KUBERNETES_CPU_REQUEST: "2" - stage: ðŸ—ï¸ Build - cache: - key: - files: - - ./core/package.json - - ./core/yarn.lock - paths: - - ./core/node_modules - artifacts: - expire_in: 1 week - expose_as: 'yarn-vendor' - paths: - - core/node_modules/ - script: - - cd core - - corepack enable - - yarn install - ################ # Lint Jobs ################ '🧹 PHP Static Analysis (phpstan)': - <<: [ *with-composer, *default-job-settings-lint ] + <<: [ *default-job-settings-lint ] stage: 🪄 Lint variables: KUBERNETES_CPU_REQUEST: "16" script: + - composer validate + - composer install --optimize-autoloader + - if [ -n "$COMPOSER_UPDATE" ]; then + composer update --optimize-autoloader; + composer outdated; + fi - vendor/bin/phpstan --version # Rely on PHPStan caching to execute analysis multiple times without performance drawback. # Output a copy in junit. @@ -397,19 +349,28 @@ default: - core/.phpstan-baseline.php '🧹 PHP Coding standards (PHPCS)': - <<: [ *with-composer, *default-job-settings-lint ] + <<: [ *default-job-settings-lint ] stage: 🪄 Lint variables: KUBERNETES_CPU_REQUEST: "16" script: + - composer validate + - composer install --optimize-autoloader + - if [ -n "$COMPOSER_UPDATE" ]; then + composer update --optimize-autoloader; + composer outdated; + fi - vendor/bin/phpcs --version - composer phpcs -- -s --report-full --report-summary --report-\\Micheh\\PhpCodeSniffer\\Report\\Gitlab=phpcs-quality-report.json artifacts: + expire_in: 1 week + expose_as: 'web-vendor' + paths: + - vendor/ reports: codequality: phpcs-quality-report.json '🧹 JavaScript linting (eslint)': - <<: [ *with-yarn ] stage: 🪄 Lint variables: KUBERNETES_CPU_REQUEST: "2" @@ -429,14 +390,14 @@ default: script: - cd core - corepack enable - - yarn run check:ckeditor5 - - yarn run lint:core-js-passing --format gitlab + - yarn install + - yarn run -s check:ckeditor5 + - yarn run -s lint:core-js-passing --format gitlab artifacts: reports: codequality: eslint-quality-report.json '🧹 CSS linting (stylelint)': - <<: [ *with-yarn ] stage: 🪄 Lint variables: KUBERNETES_CPU_REQUEST: "2" @@ -455,6 +416,7 @@ default: script: - corepack enable - cd core + - yarn install - yarn run build:css --check - yarn run lint:css --color --custom-formatter=node_modules/stylelint-formatter-gitlab artifacts: @@ -462,7 +424,7 @@ default: codequality: stylelint-quality-report.json '📔 Spell-checking': - <<: [ *with-yarn, *default-job-settings-lint ] + <<: [ *default-job-settings-lint ] stage: 🪄 Lint variables: KUBERNETES_CPU_REQUEST: "2" @@ -474,8 +436,21 @@ default: fi; - cd core - corepack enable + - yarn install - git diff ${CI_MERGE_REQUEST_TARGET_BRANCH_SHA:-$CI_MERGE_REQUEST_DIFF_BASE_SHA} --name-only 2>1 > /dev/null || (echo "Warning, cannot find changed files, converting to full clone." & (git fetch --unshallow --quiet && echo "Fetch successful.")) - git diff ${CI_MERGE_REQUEST_TARGET_BRANCH_SHA:-$CI_MERGE_REQUEST_DIFF_BASE_SHA} --name-only | sed "s_^_../_" | yarn run -s spellcheck:core --no-must-find-files --file-list stdin + cache: + key: + files: + - ./core/package.json + - ./core/yarn.lock + paths: + - ./core/node_modules + artifacts: + expire_in: 1 week + expose_as: 'yarn-vendor' + paths: + - core/node_modules/ '📔 Validatable config': <<: [ *default-job-settings-lint ] @@ -484,6 +459,7 @@ default: KUBERNETES_CPU_REQUEST: "2" # Run on MRs if config schema files have changed, or manually. rules: + - if: $PERFORMANCE_TEST != "1" - if: $CI_PIPELINE_SOURCE == "merge_request_event" changes: - "**/config/schema/*.schema.yml" diff --git a/.gitlab-ci/pipeline.yml b/.gitlab-ci/pipeline.yml index 21b0808dca8e35ebd6dc4eab9fe8c278d78789d5..9faa65980d43f970edd0a8d1967752a36f85ea67 100644 --- a/.gitlab-ci/pipeline.yml +++ b/.gitlab-ci/pipeline.yml @@ -47,14 +47,14 @@ default: .with-composer: &with-composer needs: - pipeline: $PARENT_PIPELINE_ID - job: 'ðŸ“¦ï¸ Composer' + job: '🧹 PHP Coding standards (PHPCS)' .with-composer-and-yarn: &with-composer-and-yarn needs: - pipeline: $PARENT_PIPELINE_ID - job: 'ðŸ“¦ï¸ Composer' + job: '🧹 PHP Coding standards (PHPCS)' - pipeline: $PARENT_PIPELINE_ID - job: 'ðŸ“¦ï¸ Yarn' + job: '📔 Spell-checking' variables: FF_NETWORK_PER_BUILD: 1 @@ -219,7 +219,7 @@ variables: - <<: *with-database '🚲 Performance tests': - <<: [ *with-composer, *default-job-settings ] + <<: [ *default-job-settings ] rules: - if: $PERFORMANCE_TEST == "1" variables: @@ -237,6 +237,7 @@ variables: [[ $_TARGET_DB == mysql* ]] && export SIMPLETEST_DB=mysql://$MYSQL_USER:$MYSQL_PASSWORD@database/$MYSQL_DATABASE?module=mysql [[ $_TARGET_DB == mariadb* ]] && export SIMPLETEST_DB=mysql://$MYSQL_USER:$MYSQL_PASSWORD@database/$MYSQL_DATABASE?module=mysql [[ $_TARGET_DB == pgsql* ]] && export SIMPLETEST_DB=pgsql://$POSTGRES_USER:$POSTGRES_PASSWORD@database/$POSTGRES_DB?module=pgsql + - composer install --optimize-autoloader - export OTEL_COLLECTOR="$OTEL_COLLECTOR" - mkdir -p ./sites/simpletest ./sites/default/files ./build/logs/junit /var/www/.composer - chown -R www-data:www-data ./sites ./build/logs/junit ./vendor /var/www/