Skip to content
Snippets Groups Projects

Issue #3414923 by jibran: Add scheduled and on commit GitLabCI jobs

Files
3
+ 0
133
version: 2.1
workflows:
test:
jobs:
- test:
matrix:
parameters:
php: ["8.1", "8.2"]
drupal-version: ["10.1.x", "11.x"]
# Run nightly tests every day 8 AM.
nightly:
jobs:
- test:
matrix:
parameters:
php: ["8.1", "8.2"]
drupal-version: ["10.1.x", "11.x"]
triggers:
- schedule:
# Weekday (22=10pm UTC). Evaluates to 8am AEST.
cron: "0 22 * * *"
filters:
branches:
only:
- 3.x
- 4.x
jobs:
test:
parameters:
php:
type: string
drupal-version:
type: string
docker:
- image: skpr/php-circleci:<< parameters.php >>-v2-latest
environment:
MODULE_NAME: dynamic_entity_reference
SIMPLETEST_BASE_URL: http://127.0.0.1:8080
SIMPLETEST_DB: mysql://drupal:drupal@127.0.0.1/local
BROWSERTEST_OUTPUT_FILE: /data/app/sites/simpletest/browser_output.html
BROWSERTEST_OUTPUT_DIRECTORY: /data/app/sites/simpletest/browser_output
MINK_DRIVER_ARGS_WEBDRIVER: '["chrome", {"chromeOptions": { "args": [ "--disable-gpu", "--headless" ] } }, "http://127.0.0.1:4444/wd/hub" ]'
- image: mariadb
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: local
MYSQL_USER: drupal
MYSQL_PASSWORD: drupal
- image: selenium/standalone-chrome:3.141.59-oxygen
working_directory: /data/app
steps:
- setup_remote_docker:
docker_layer_caching: true
- add_ssh_keys:
fingerprints:
- a6:e4:76:63:c3:bf:5e:a5:cf:0e:0b:a1:7e:c9:c0:21
- run:
name: Download specified drupal version
command: |
git clone --depth 1 --branch << parameters.drupal-version >> \
https://git.drupal.org/project/drupal.git .
git log -1 --oneline
- run:
name: Fetch drupal dependencies, dev dependencies, and module test dependencies
command: |
composer install --prefer-dist --no-progress
composer require --dev "phpstan/phpstan-deprecation-rules:^1.0"
- run:
name: Show all installed composer packages.
command: composer show
- checkout:
path: modules/${MODULE_NAME}
- run:
name: Setup Directories
command: |
mkdir -p sites/default/files/tmp \
sites/default/private \
sites/simpletest/browser_output \
../build/logs/phpunit \
../build/logs/phpstan \
../build/logs/phpcs
cp modules/${MODULE_NAME}/phpstan.neon .
chmod -R 2775 sites/default/files sites/default/private sites/simpletest ../build/logs
chown -R skpr:skpr /data
- run:
name: Lint PHP against Drupal coding standards
command: |
vendor/bin/phpcs \
--standard=vendor/drupal/coder/coder_sniffer/Drupal \
--extensions=php,module,inc,install,test,profile,theme,css,info \
--ignore=*.md \
--report=junit \
--report-file=../build/logs/phpcs/phpcs.xml \
modules/${MODULE_NAME}
- run:
name: PHPStan
command: |
vendor/bin/phpstan analyze \
--memory-limit=-1 \
--no-progress \
--error-format=junit \
-- modules/${MODULE_NAME} \
> ../build/logs/phpstan/phpstan.xml
- run:
name: "Start: PHP-FPM"
command: php-fpm -F
background: true
- run:
name: "Start: Nginx"
command: nginx
background: true
- run:
name: Run unit tests
command: |
./vendor/bin/phpunit --configuration ./core/phpunit.xml.dist --log-junit ../build/logs/phpunit/phpunit.xml modules/${MODULE_NAME}
# ./vendor/bin/phpunit --verbose --configuration ./core/phpunit.xml.dist --log-junit ../build/logs/phpunit/phpunit.xml modules/${MODULE_NAME}
# ./vendor/bin/phpunit --debug --verbose --configuration ./core/phpunit.xml.dist --log-junit ../build/logs/phpunit/phpunit.xml modules/${MODULE_NAME}
- store_test_results:
path: /data/build/logs
- store_artifacts:
path: /data/app/sites/simpletest/browser_output
Loading