Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Drupal
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitLab CI/CD
Drupal
Commits
72143825
Commit
72143825
authored
5 years ago
by
jurgenhaas
Browse files
Options
Downloads
Patches
Plain Diff
Add ci template for testing and deploying Drupal sites
parent
8ca2b5e0
No related branches found
No related tags found
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test-and-deploy.yml
+269
-0
269 additions, 0 deletions
test-and-deploy.yml
with
269 additions
and
0 deletions
test-and-deploy.yml
0 → 100644
+
269
−
0
View file @
72143825
stages
:
-
build
-
prepare
-
test
-
deploy
.wait
:
script
:
-
while [ ! -f /tmp/foo.txt ]; do echo "waiting..."; sleep 1; done
.cache_paths
:
&cache_paths
paths
:
-
.docker-init/
-
assets/
-
config/
-
drush/
-
files/
-
settings/
-
vendor/
-
web/core/
-
web/libraries/
-
web/modules/contrib/
-
web/profiles/contrib/
-
web/sites/
-
web/themes/contrib/
-
.ahoy.yml
-
.env
-
docker-compose.yml
.artifact_paths
:
&artifact_paths
paths
:
-
.docker-init/
-
assets/
-
config/
-
drush/
-
files/
-
settings/
-
tests/
-
vendor/
-
web/
-
.ahoy.yml
-
.env
-
composer.*
-
docker-compose.yml
.cache_default
:
&cache_default
key
:
build-${COMPOSE_PROJECT_NAME}
<<
:
*cache_paths
.build
:
stage
:
build
tags
:
-
default
cache
:
<<
:
*cache_default
policy
:
pull-push
script
:
-
eval $(ssh-agent -s)
-
echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
-
mkdir -p ~/.ssh
-
chmod 700 ~/.ssh
-
ssh-keyscan gitlab.lakedrops.com >> ~/.ssh/known_hosts
-
chmod 644 ~/.ssh/known_hosts
-
ssh git@gitlab.lakedrops.com
-
composer install --no-interaction --no-progress
-
composer lakedrops:scaffold --no-interaction
-
composer lakedrops:docker4drupal --no-interaction
-
docker-compose up -d
-
mkdir -p files/default/files/css
-
mkdir -p files/default/files/js
-
mkdir -p files/default/files/languages
-
mkdir -p files/default/files/translations
-
chmod -R ugo+w files/default/files/
artifacts
:
name
:
build
when
:
always
<<
:
*artifact_paths
except
:
refs
:
-
tags
variables
:
-
$CI_COMMIT_MESSAGE =~ /^Merge tag /i
.dumpdb
:
stage
:
build
tags
:
-
ansible
variables
:
GIT_STRATEGY
:
none
script
:
-
ascr drupal-dump-db ${CI_PROJECT_PATH} ${PWD}/${CI_PROJECT_NAME}.sql
cache
:
{}
artifacts
:
name
:
dbdump
when
:
always
paths
:
-
${COMPOSE_PROJECT_NAME}.sql
only
:
variables
:
-
$CI_COMMIT_REF_NAME == "master"
-
$CI_COMMIT_MESSAGE =~ /\[re-build-db\]/i
-
$FORCE_DB_UPDATE == "yes"
except
:
refs
:
-
tags
variables
:
-
$CI_COMMIT_MESSAGE =~ /^Merge tag /i
.importdb
:
stage
:
prepare
tags
:
-
default
variables
:
GIT_STRATEGY
:
none
script
:
-
docker cp ${COMPOSE_PROJECT_NAME}.sql ${COMPOSE_PROJECT_NAME}_php_1:/var/www/html
-
drush sql:drop --yes
-
drush sql:query --file=../${COMPOSE_PROJECT_NAME}.sql
-
drush cr
-
drush updatedb
-
drush config-import sync
-
drush cr
only
:
variables
:
-
$CI_COMMIT_REF_NAME == "master"
-
$CI_COMMIT_MESSAGE =~ /\[re-build-db\]/i
-
$FORCE_DB_UPDATE == "yes"
except
:
refs
:
-
tags
variables
:
-
$CI_COMMIT_MESSAGE =~ /^Merge tag /i
dependencies
:
-
'
Build
Site'
-
'
Download
DB'
.updatedb
:
stage
:
prepare
tags
:
-
default
variables
:
GIT_STRATEGY
:
none
script
:
-
drush cr
-
drush updatedb
-
drush config-import sync
-
drush cr
except
:
refs
:
-
master
-
tags
variables
:
-
$CI_COMMIT_MESSAGE =~ /^Merge tag /i
-
$CI_COMMIT_MESSAGE =~ /\[re-build-db\]/i
-
$FORCE_DB_UPDATE == "yes"
dependencies
:
-
'
Build
Site'
.codestyle
:
stage
:
test
tags
:
-
default
variables
:
GIT_STRATEGY
:
none
script
:
-
ahoy test phpcs -- -n --report=xml --report-file=phpcs.xml
-
docker cp ${COMPOSE_PROJECT_NAME}_php_1:/var/www/html/phpcs.xml ./phpcs.xml
artifacts
:
name
:
phpcs
when
:
always
paths
:
-
phpcs.xml
dependencies
:
-
'
Build
Site'
except
:
refs
:
-
tags
variables
:
-
$CI_COMMIT_MESSAGE =~ /^Merge tag /i
.phpunit
:
stage
:
test
tags
:
-
default
variables
:
GIT_STRATEGY
:
none
script
:
-
ahoy test phpunit -- --log-junit junit.xml --testdox-html testdox.html
-
docker cp ${COMPOSE_PROJECT_NAME}_php_1:/var/www/html/junit.xml ./junit.xml
-
docker cp ${COMPOSE_PROJECT_NAME}_php_1:/var/www/html/testdox.html ./testdox.html
artifacts
:
name
:
phpunit
when
:
always
paths
:
-
junit.xml
-
testdox.html
reports
:
junit
:
junit.xml
dependencies
:
-
'
Build
Site'
except
:
refs
:
-
tags
variables
:
-
$CI_COMMIT_MESSAGE =~ /^Merge tag /i
.behat
:
stage
:
test
tags
:
-
default
variables
:
GIT_STRATEGY
:
none
script
:
-
ahoy behat update -- --no-interaction
-
ahoy behat test2xml
-
docker cp ${COMPOSE_PROJECT_NAME}_php_1:/var/www/html/tests/output/default.xml ./behat.xml
retry
:
1
artifacts
:
name
:
behat
when
:
always
paths
:
-
behat.xml
dependencies
:
-
'
Build
Site'
except
:
refs
:
-
tags
variables
:
-
$CI_COMMIT_MESSAGE =~ /^Merge tag /i
.backstop
:
stage
:
test
tags
:
-
default
variables
:
GIT_STRATEGY
:
none
script
:
-
backstop test
artifacts
:
name
:
backstop
when
:
always
paths
:
-
config/backstop_reference
-
tests/backstop/backstop_data
dependencies
:
-
'
Build
Site'
except
:
refs
:
-
tags
variables
:
-
$CI_COMMIT_MESSAGE =~ /^Merge tag /i
.deploy
:
stage
:
deploy
tags
:
-
ansible
variables
:
GIT_STRATEGY
:
none
environment
:
name
:
$ENVIRONMENT_NAME
script
:
-
ascr drupal-deploy $HOST_NAME drupal_${COMPOSE_PROJECT_NAME} ${EXTRAS}
cache
:
{}
dependencies
:
[]
except
:
refs
:
-
tags
variables
:
-
$CI_COMMIT_MESSAGE =~ /^Merge tag /i
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment