Skip to content
Snippets Groups Projects
Verified Commit 4a70e448 authored by Lauri Timmanee's avatar Lauri Timmanee
Browse files

Issue #3388693 by longwave, catch, fjgarlin: Use composer and yarn artifacts from parent pipeline

parent f101ff7f
No related branches found
No related tags found
No related merge requests found
...@@ -47,6 +47,7 @@ variables: ...@@ -47,6 +47,7 @@ variables:
COMPOSER_ROOT_VERSION: "${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}${CI_COMMIT_BRANCH}-dev" COMPOSER_ROOT_VERSION: "${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}${CI_COMMIT_BRANCH}-dev"
CONCURRENCY: 24 CONCURRENCY: 24
GIT_DEPTH: "3" GIT_DEPTH: "3"
PARENT_PIPELINE_ID: $CI_PIPELINE_ID
############# #############
...@@ -79,37 +80,16 @@ stages: ...@@ -79,37 +80,16 @@ stages:
name: $_CONFIG_DOCKERHUB_ROOT/php-$_TARGET_PHP-apache:production name: $_CONFIG_DOCKERHUB_ROOT/php-$_TARGET_PHP-apache:production
rules: rules:
- if: $CI_PIPELINE_SOURCE == "push" && $CI_PROJECT_ROOT_NAMESPACE == "project" - if: $CI_PIPELINE_SOURCE == "push" && $CI_PROJECT_ROOT_NAMESPACE == "project"
- if: $CI_PIPELINE_SOURCE == "schedule" && $CI_PROJECT_ROOT_NAMESPACE == "project"
- if: $CI_PIPELINE_SOURCE == "merge_request_event" - if: $CI_PIPELINE_SOURCE == "merge_request_event"
.composer-cache: &composer-cache .with-composer: &with-composer
key:
files:
- ./composer.json
- ./composer.lock
paths:
- ./vendor
.yarn-cache: &yarn-cache
key:
files:
- ./core/package.json
- ./core/yarn.lock
paths:
- ./core/node_modules
.with-composer-cache: &with-composer-cache
cache:
policy: pull
<<: *composer-cache
needs: needs:
- '📦️ Composer' - '📦️ Composer'
.with-yarn-cache: &with-yarn-cache .with-yarn: &with-yarn
needs: needs:
- '📦️ Yarn' - '📦️ Yarn'
cache:
policy: pull
<<: *yarn-cache
.junit-artifacts: &junit-artifacts .junit-artifacts: &junit-artifacts
artifacts: artifacts:
...@@ -228,7 +208,12 @@ stages: ...@@ -228,7 +208,12 @@ stages:
<<: *default-job-settings-lint <<: *default-job-settings-lint
stage: 🏗️ Build stage: 🏗️ Build
cache: cache:
<<: *composer-cache key:
files:
- ./composer.json
- ./composer.lock
paths:
- ./vendor
artifacts: artifacts:
expire_in: 1 week expire_in: 1 week
expose_as: 'web-vendor' expose_as: 'web-vendor'
...@@ -242,7 +227,12 @@ stages: ...@@ -242,7 +227,12 @@ stages:
<<: *default-job-settings-lint <<: *default-job-settings-lint
stage: 🏗️ Build stage: 🏗️ Build
cache: cache:
<<: *yarn-cache key:
files:
- ./core/package.json
- ./core/yarn.lock
paths:
- ./core/node_modules
artifacts: artifacts:
expire_in: 1 week expire_in: 1 week
expose_as: 'yarn-vendor' expose_as: 'yarn-vendor'
...@@ -256,7 +246,7 @@ stages: ...@@ -256,7 +246,7 @@ stages:
################ ################
'🧹 PHP Static Analysis (phpstan)': '🧹 PHP Static Analysis (phpstan)':
<<: [ *with-composer-cache, *junit-artifacts, *default-job-settings-lint ] <<: [ *with-composer, *junit-artifacts, *default-job-settings-lint ]
stage: 🪄 Lint stage: 🪄 Lint
script: script:
- php vendor/bin/phpstan analyze --configuration=./core/phpstan.neon.dist --error-format=gitlab > phpstan-quality-report.json - php vendor/bin/phpstan analyze --configuration=./core/phpstan.neon.dist --error-format=gitlab > phpstan-quality-report.json
...@@ -265,7 +255,7 @@ stages: ...@@ -265,7 +255,7 @@ stages:
codequality: phpstan-quality-report.json codequality: phpstan-quality-report.json
'🧹 PHP Coding standards (PHPCS)': '🧹 PHP Coding standards (PHPCS)':
<<: [ *with-composer-cache, *junit-artifacts, *default-job-settings-lint ] <<: [ *with-composer, *junit-artifacts, *default-job-settings-lint ]
stage: 🪄 Lint stage: 🪄 Lint
script: script:
- composer phpcs -- --report-full --report-summary --report-\\Micheh\\PhpCodeSniffer\\Report\\Gitlab=phpcs-quality-report.json - composer phpcs -- --report-full --report-summary --report-\\Micheh\\PhpCodeSniffer\\Report\\Gitlab=phpcs-quality-report.json
...@@ -274,7 +264,7 @@ stages: ...@@ -274,7 +264,7 @@ stages:
codequality: phpcs-quality-report.json codequality: phpcs-quality-report.json
'🧹 JavaScript linting (eslint)': '🧹 JavaScript linting (eslint)':
<<: [ *with-yarn-cache, *junit-artifacts, *default-job-settings-lint ] <<: [ *with-yarn, *junit-artifacts, *default-job-settings-lint ]
stage: 🪄 Lint stage: 🪄 Lint
script: script:
- yarn --cwd=./core run -s lint:core-js-passing --format gitlab - yarn --cwd=./core run -s lint:core-js-passing --format gitlab
...@@ -283,7 +273,7 @@ stages: ...@@ -283,7 +273,7 @@ stages:
codequality: eslint-quality-report.json codequality: eslint-quality-report.json
'🧹 CSS linting (stylelint)': '🧹 CSS linting (stylelint)':
<<: [ *with-yarn-cache, *junit-artifacts, *default-job-settings-lint ] <<: [ *with-yarn, *junit-artifacts, *default-job-settings-lint ]
stage: 🪄 Lint stage: 🪄 Lint
script: script:
- yarn run --cwd=./core lint:css --color --custom-formatter=node_modules/stylelint-formatter-gitlab - yarn run --cwd=./core lint:css --color --custom-formatter=node_modules/stylelint-formatter-gitlab
...@@ -292,14 +282,14 @@ stages: ...@@ -292,14 +282,14 @@ stages:
codequality: stylelint-quality-report.json codequality: stylelint-quality-report.json
'🧹 Compilation check': '🧹 Compilation check':
<<: [ *with-yarn-cache, *default-job-settings-lint ] <<: [ *with-yarn, *default-job-settings-lint ]
stage: 🪄 Lint stage: 🪄 Lint
script: script:
- yarn run --cwd=./core build:css --check - yarn run --cwd=./core build:css --check
- cd core && yarn run -s check:ckeditor5 - cd core && yarn run -s check:ckeditor5
'📔 Spell-checking': '📔 Spell-checking':
<<: [ *with-yarn-cache, *default-job-settings-lint ] <<: [ *with-yarn, *default-job-settings-lint ]
stage: 🪄 Lint stage: 🪄 Lint
script: script:
- export TARGET_BRANCH=${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}${CI_COMMIT_BRANCH} - export TARGET_BRANCH=${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}${CI_COMMIT_BRANCH}
......
# cspell:ignore drupaltestbot drupaltestbotpw # cspell:ignore drupaltestbot drupaltestbotpw
stages: stages:
################
# Build
#
# Assemble the test environment.
################
- 🏗️ Build
################
# Test
#
# The test phase actually executes the tests, as well as gathering results
# and artifacts.
################
- 🗜️ Test - 🗜️ Test
############# #############
...@@ -21,6 +8,7 @@ stages: ...@@ -21,6 +8,7 @@ stages:
############# #############
.default-job-settings: &default-job-settings .default-job-settings: &default-job-settings
stage: 🗜️ Test
interruptible: true interruptible: true
allow_failure: false allow_failure: false
retry: retry:
...@@ -36,36 +24,6 @@ stages: ...@@ -36,36 +24,6 @@ stages:
rules: rules:
- if: $CI_PIPELINE_SOURCE == "parent_pipeline" - if: $CI_PIPELINE_SOURCE == "parent_pipeline"
.composer-cache: &composer-cache
key:
files:
- ./composer.json
- ./composer.lock
paths:
- ./vendor
.yarn-cache: &yarn-cache
key:
files:
- ./core/package.json
- ./core/yarn.lock
paths:
- ./core/node_modules
.with-composer-cache: &with-composer-cache
needs:
- '📦️ Composer'
cache:
policy: pull
<<: *composer-cache
.with-yarn-cache: &with-yarn-cache
needs:
- '📦️ Yarn'
cache:
policy: pull
<<: *yarn-cache
.junit-artifacts: &junit-artifacts .junit-artifacts: &junit-artifacts
artifacts: artifacts:
expose_as: junit expose_as: junit
...@@ -75,13 +33,17 @@ stages: ...@@ -75,13 +33,17 @@ stages:
reports: reports:
junit: junit.xml junit: junit.xml
.with-composer: &with-composer
needs:
- pipeline: $PARENT_PIPELINE_ID
job: '📦️ Composer'
.with-composer-and-yarn: &with-composer-and-yarn .with-composer-and-yarn: &with-composer-and-yarn
needs: needs:
- '📦️ Composer' - pipeline: $PARENT_PIPELINE_ID
- '📦️ Yarn' job: '📦️ Composer'
dependencies: - pipeline: $PARENT_PIPELINE_ID
- '📦️ Yarn' job: '📦️ Yarn'
- '📦️ Composer'
.test-variables: &test-variables .test-variables: &test-variables
FF_NETWORK_PER_BUILD: 1 FF_NETWORK_PER_BUILD: 1
...@@ -151,45 +113,8 @@ stages: ...@@ -151,45 +113,8 @@ stages:
# Documentation: https://docs.gitlab.com/ee/ci/jobs/ # Documentation: https://docs.gitlab.com/ee/ci/jobs/
################ ################
################
# Build Jobs
################
'📦️ Composer':
<<: *default-job-settings
stage: 🏗️ Build
cache:
<<: *composer-cache
artifacts:
expire_in: 1 week
expose_as: 'web-vendor'
paths:
- vendor/
script:
- composer validate
- composer install
'📦️ Yarn':
<<: *default-job-settings
stage: 🏗️ Build
cache:
<<: *yarn-cache
artifacts:
expire_in: 1 week
expose_as: 'yarn-vendor'
paths:
- core/node_modules/
script:
# Installs all core javascript dependencies and adds junit formatter.
- yarn --cwd ./core add stylelint-junit-formatter
################
# Test Jobs
################
'🌐️️ PHPUnit Functional': '🌐️️ PHPUnit Functional':
<<: [ *with-composer-cache, *phpunit-artifacts, *setup-webserver, *run-tests, *default-job-settings ] <<: [ *with-composer, *phpunit-artifacts, *setup-webserver, *run-tests, *default-job-settings ]
stage: 🗜️ Test
parallel: 7 parallel: 7
variables: variables:
<<: *test-variables <<: *test-variables
...@@ -199,8 +124,7 @@ stages: ...@@ -199,8 +124,7 @@ stages:
- <<: *with-database - <<: *with-database
'🩹 Test-only changes': '🩹 Test-only changes':
<<: [ *with-composer-cache, *phpunit-artifacts, *setup-webserver, *default-job-settings ] <<: [ *with-composer, *phpunit-artifacts, *setup-webserver, *default-job-settings ]
stage: 🗜️ Test
when: manual when: manual
interruptible: true interruptible: true
allow_failure: true allow_failure: true
...@@ -246,8 +170,7 @@ stages: ...@@ -246,8 +170,7 @@ stages:
fi fi
'⚙️️ PHPUnit Kernel': '⚙️️ PHPUnit Kernel':
<<: [*with-composer-cache, *phpunit-artifacts, *setup-webserver, *run-tests, *default-job-settings ] <<: [*with-composer, *phpunit-artifacts, *setup-webserver, *run-tests, *default-job-settings ]
stage: 🗜️ Test
parallel: 2 parallel: 2
variables: variables:
<<: *test-variables <<: *test-variables
...@@ -257,8 +180,7 @@ stages: ...@@ -257,8 +180,7 @@ stages:
- <<: *with-database - <<: *with-database
'🖱️️️ PHPUnit Functional Javascript': '🖱️️️ PHPUnit Functional Javascript':
<<: [ *with-composer-cache, *phpunit-artifacts, *setup-webserver, *run-tests, *default-job-settings ] <<: [ *with-composer, *phpunit-artifacts, *setup-webserver, *run-tests, *default-job-settings ]
stage: 🗜️ Test
parallel: 2 parallel: 2
variables: variables:
<<: *test-variables <<: *test-variables
...@@ -269,8 +191,7 @@ stages: ...@@ -269,8 +191,7 @@ stages:
- <<: *with-chrome - <<: *with-chrome
'👷️️️ PHPUnit Build': '👷️️️ PHPUnit Build':
<<: [ *with-composer-cache, *phpunit-artifacts, *setup-webserver, *run-tests, *default-job-settings ] <<: [ *with-composer, *phpunit-artifacts, *setup-webserver, *run-tests, *default-job-settings ]
stage: 🗜️ Test
variables: variables:
<<: *test-variables <<: *test-variables
TESTSUITE: PHPUnit-Build TESTSUITE: PHPUnit-Build
...@@ -279,8 +200,7 @@ stages: ...@@ -279,8 +200,7 @@ stages:
- <<: *with-database - <<: *with-database
'⚡️ PHPUnit Unit': '⚡️ PHPUnit Unit':
<<: [ *with-composer-cache, *phpunit-artifacts, *setup-webserver, *run-tests, *default-job-settings ] <<: [ *with-composer, *phpunit-artifacts, *setup-webserver, *run-tests, *default-job-settings ]
stage: 🗜️ Test
services: services:
# There are some unit tests that need a database. # There are some unit tests that need a database.
# @todo Remove after https://www.drupal.org/project/drupal/issues/3386217 # @todo Remove after https://www.drupal.org/project/drupal/issues/3386217
...@@ -292,7 +212,6 @@ stages: ...@@ -292,7 +212,6 @@ stages:
'🦉️️️ Nightwatch': '🦉️️️ Nightwatch':
<<: [ *with-composer-and-yarn, *setup-webserver, *default-job-settings ] <<: [ *with-composer-and-yarn, *setup-webserver, *default-job-settings ]
stage: 🗜️ Test
variables: variables:
<<: *test-variables <<: *test-variables
services: services:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment