-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy path.gitlab-ci-local.yml
More file actions
61 lines (56 loc) · 2.04 KB
/
Copy path.gitlab-ci-local.yml
File metadata and controls
61 lines (56 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Slim pipeline for `gitlab-ci-local` (https://github.com/firecow/gitlab-ci-local).
#
# Mirrors the validate-stage jobs of .gitlab-ci.yml that are reproducible
# locally (no Drupal site build / services): PHPCS (Drupal coding standards),
# cspell and the YAML lint. PHPStan is heavier (builds a Drupal root) and lives
# only in the full .gitlab-ci.yml.
#
# Usage:
# gitlab-ci-local --file .gitlab-ci-local.yml # all jobs
# gitlab-ci-local --file .gitlab-ci-local.yml phpcs # one job
stages:
- validate
variables:
# Drupal 11.4.0 released 2026-07-01; pinned templates ref $CORE_STABLE is still 11.3.
DRUPAL_CORE: "11.4.0"
IGNORE_PROJECT_DRUPAL_CORE_VERSION: "1"
phpcs:
stage: validate
image: php:8.3-cli
before_script:
- apt-get update -y > /dev/null && apt-get install -y -qq git unzip > /dev/null
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- composer global config --no-plugins allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
- composer global require --no-interaction --no-progress drupal/coder:^8.3 dealerdirect/phpcodesniffer-composer-installer:^1
- export PATH="$HOME/.composer/vendor/bin:$PATH"
script:
- phpcs --version
- phpcs --standard=.phpcs.xml
allow_failure: false
cspell:
stage: validate
image: node:20
before_script:
- npm install -g cspell
script:
- cspell "**/*.{php,module,inc,install,profile,theme,yml,md,txt}" --no-progress || true
allow_failure: false
validate:yaml-lint:
stage: validate
image: python:3.12-slim
script:
- python --version
- pip install --quiet pyyaml
- |
python - <<'PY'
import glob, sys, yaml
bad = 0
for f in sorted(glob.glob('**/*.yml', recursive=True)):
try:
list(yaml.safe_load_all(open(f, encoding='utf-8')))
except Exception as e:
print('YAML ERROR:', f, '->', e); bad += 1
print('Checked YAML files; errors:', bad)
sys.exit(1 if bad else 0)
PY
allow_failure: false