Skip to content
Snippets Groups Projects
Commit 06bfa0a9 authored by Fran Garcia-Linares's avatar Fran Garcia-Linares
Browse files

Issue #3405955 by jonathan1055, fjgarlin: Add job for CSPELL in contrib pipeline

parent 2c6bda50
Branches
Tags 1.2.0
1 merge request!128Add job for CSPELL
Pipeline #100261 passed
......@@ -2,6 +2,7 @@
## 1.2.0 - 2024-02-16
#3405955 - Add job for CSPELL in contrib pipeline.\
#3405813 - Create downloadable patch for ESLINT automated fixes.\
#3419069 - Tidy up template and remove redundant lines.\
#3421674 - Add condition for mariadb.\
......
......@@ -52,16 +52,17 @@ Each job will run or not run according to the following rules:
| JOB NAME | Conditions when it will run | Conditions when it will NOT run |
| --------------------------- | ------------------------------------------------------- | --------------------------------------------------------- |
| composer | SKIP_COMPOSER_LINT=0 \|\| SKIP_PHPCS=0 \|\|<br>SKIP_STYLELINT=0 \|\| SKIP_ESLINT=0 \|\|<br>OPT_IN_TEST_CURRENT=1 | SKIP_COMPOSER_LINT=1 && SKIP_PHPCS=1 &&<br>SKIP_STYLELINT=1 && SKIP_ESLINT=1 &&<br>OPT_IN_TEST_CURRENT=0 |
| composer | SKIP_COMPOSER_LINT=0 \|\| SKIP_PHPCS=0 \|\|<br>SKIP_STYLELINT=0 \|\| SKIP_ESLINT=0 \|\|<br>SKIP_CSPELL=0 \|\| OPT_IN_TEST_CURRENT=1 | SKIP_COMPOSER_LINT=1 && SKIP_PHPCS=1 &&<br>SKIP_STYLELINT=1 && SKIP_ESLINT=1 &&<br>SKIP_CSPELL=1 && OPT_IN_TEST_CURRENT=0 |
| composer (max PHP version) | OPT_IN_TEST_MAX_PHP=1 | OPT_IN_TEST_MAX_PHP=0 |
| composer (previous minor) | OPT_IN_TEST_PREVIOUS_MINOR=1 | OPT_IN_TEST_PREVIOUS_MINOR=0 |
| composer (previous major) | OPT_IN_TEST_PREVIOUS_MAJOR=1 | OPT_IN_TEST_PREVIOUS_MAJOR=0 |
| composer (next minor) | OPT_IN_TEST_NEXT_MINOR=1 | OPT_IN_TEST_NEXT_MINOR=0 |
| composer (next major) | OPT_IN_TEST_NEXT_MAJOR=1 | OPT_IN_TEST_NEXT_MAJOR=0 |
| composer-lint | SKIP_COMPOSER_LINT=0 | SKIP_COMPOSER_LINT=1 |
| cspell | SKIP_CSPELL=0 | SKIP_CSPELL=1 |
| eslint | SKIP_ESLINT=0 | SKIP_ESLINT=1 |
| phpcs | SKIP_PHPCS=0 | SKIP_PHPCS=1 |
| stylelint | SKIP_STYLELINT=0 | SKIP_STYLELINT=1 |
| eslint | SKIP_ESLINT=0 | SKIP_ESLINT=1 |
| phpstan | SKIP_PHPSTAN=0 && OPT_IN_TEST_CURRENT=1 | SKIP_PHPSTAN=1 \|\| OPT_IN_TEST_CURRENT=0 |
| phpstan (next minor) | SKIP_PHPSTAN=0 && OPT_IN_TEST_NEXT_MINOR=1 | SKIP_PHPSTAN=1 \|\| OPT_IN_TEST_NEXT_MINOR=0 |
| phpstan (next major) | SKIP_PHPSTAN=0 && OPT_IN_TEST_NEXT_MAJOR=1 | SKIP_PHPSTAN=1 \|\| OPT_IN_TEST_NEXT_MAJOR=0 |
......
......@@ -85,7 +85,7 @@
# If none of these are set then it is not needed. This rule is only used in the 'base' Composer job,
# it is not added to any of the Composer variants because they each have their specific 'opt-in' rule.
.check-current-composer-not-needed-rule: &check-current-composer-not-needed-rule
if: '$SKIP_COMPOSER_LINT == "1" && $SKIP_PHPCS == "1" && $SKIP_STYLELINT == "1" && $SKIP_ESLINT == "1" && $OPT_IN_TEST_CURRENT == "0"'
if: '$SKIP_COMPOSER_LINT == "1" && $SKIP_PHPCS == "1" && $SKIP_STYLELINT == "1" && $SKIP_ESLINT == "1" && $SKIP_CSPELL == "1" && $OPT_IN_TEST_CURRENT == "0"'
when: never
.skip-phpstan-rule: &skip-phpstan-rule
......@@ -120,6 +120,10 @@
if: '$SKIP_NIGHTWATCH == "1"'
when: never
.skip-cspell-rule: &skip-cspell-rule
if: '$SKIP_CSPELL == "1"'
when: never
.opt-in-current-rule: &opt-in-current-rule
if: '$OPT_IN_TEST_CURRENT != "1"'
when: never
......@@ -538,6 +542,37 @@ eslint:
reports:
junit: junit.xml
cspell:
stage: validate
rules:
- *skip-cspell-rule
- when: on_success
allow_failure: true
needs:
- composer
artifacts:
expose_as: junit
expire_in: 6 mos
when: always
name: artifacts-$CI_PIPELINE_ID-$CI_JOB_NAME_SLUG
paths:
- _cspell_unrecognized_words_$CI_PIPELINE_ID.txt
script:
- cd $CI_PROJECT_DIR/$_WEB_ROOT/modules/custom/$CI_PROJECT_NAME
- test -f .cspell.json || printf '{"words":[%s]}\n' "$_CSPELL_WORDS" > .cspell.json
- $CI_PROJECT_DIR/$_WEB_ROOT/core/node_modules/.bin/cspell -c .cspell.json --show-suggestions --show-context --no-progress ** || EXIT_CODE=$?
- WORDS_FILE=_cspell_unrecognized_words_$CI_PIPELINE_ID.txt
- touch $CI_PROJECT_DIR/$WORDS_FILE
- |
if [ "$EXIT_CODE" != "" ]; then
# There are some unrecognized words so create an artifact file containing the unique list.
echo "# CSPELL Unrecognized or mis-spelled words.\n# You may want to add some of these to your custom project dictionary" >> $CI_PROJECT_DIR/$WORDS_FILE
$CI_PROJECT_DIR/$_WEB_ROOT/core/node_modules/.bin/cspell -c .cspell.json --words-only --unique --no-progress ** | sort --ignore-case >> $CI_PROJECT_DIR/$WORDS_FILE || true
echo "An artifact file has been created containing a unique list of the unrecognized words, for you to browse or download."
fi
- echo "Exiting with EXIT_CODE=$EXIT_CODE"
- exit $EXIT_CODE
################
# Test Jobs
################
......
......@@ -72,6 +72,10 @@ variables:
value: ""
description: "Additional options that are appended to the `stylelint` job call."
_CSPELL_WORDS:
value: ""
description: "Words to add to the cspell dictionary if the project does not have a '.cspell.json' file. Use double quotes and comma separation, for example \"drupal\", \"keycdn\"."
_SHOW_ENVIRONMENT_VARIABLES:
value: "0"
description: "Set to 1 to show all the environment variables in the Composer and PhpUnit jobs. Known variables with Personal Identifiable Information will still be hidden. The default is 0 for no output at all."
......@@ -115,6 +119,10 @@ variables:
value: "0"
description: "Set to 1 to skip the ESLINT CI job"
SKIP_CSPELL:
value: "0"
description: "Set to 1 to skip the cspell CI job"
SKIP_PHPUNIT:
value: "0"
description: "Set to 1 to skip the PHPUNIT CI job"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment