Skip to content
This repository was archived by the owner on Aug 8, 2024. It is now read-only.

Contenta (Take2) #128

Merged
merged 28 commits into from
Jan 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
fd80b61
Update circle.yml (#95)
stevector Jul 14, 2017
e786d85
We will use BUILD_TOOLS_VERSION in the master branch to simplify test…
greg-1-anderson Jul 21, 2017
8822790
Remove install of cgr; we don't need it any longer.
greg-1-anderson Jul 21, 2017
a58920d
Remove redundant entry from .gitignore. (#97)
greg-1-anderson Jul 26, 2017
a534d3c
Ensure that all calls to composer and terminus are non-interactive. M…
greg-1-anderson Aug 9, 2017
001140d
Updating readme to be more like example-wordpress-composer (#101)
stevector Sep 8, 2017
d468d61
Convert to Circle 2.0. (#107)
greg-1-anderson Sep 13, 2017
aef8668
Use the set-environment script inside the docker environment. (#114)
greg-1-anderson Sep 14, 2017
ddfc563
Require PHP 7.0 during dependency resolution, even if running 7.1+ (#…
greg-1-anderson Sep 14, 2017
35706e6
Update lockfile for Drupal 8.4.0. (#117)
greg-1-anderson Oct 13, 2017
849f741
Fixing .gitignore - to include special pantheon services yml files (#…
shaal Oct 30, 2017
89b0051
Update Composer dependencies (2017-11-03-17-37) (#118)
greg-1-anderson Nov 3, 2017
05ba310
Use Terminus Build Tools plugin 2.0.0-alpha4 and later. (#121)
greg-1-anderson Nov 16, 2017
12668bc
Contenta composer changes
stevector Jan 5, 2018
98552f8
Contenta composer.lock changes
stevector Jan 5, 2018
71e8d7a
setting profile name in settings.php
stevector Jan 5, 2018
576786e
Adding default.services.yml
stevector Jan 5, 2018
ed9d8ad
allow default.services.yml in .gitignore
stevector Jan 5, 2018
f28e32e
Changing install-cms step in composer.json
stevector Jan 5, 2018
3307859
Update settings.php
stevector Jan 5, 2018
cc5ed4e
toggle sync [ci skip]
stevector Jan 10, 2018
aa49093
gitignore /keys/ [ci skip]
stevector Jan 10, 2018
94e3a42
Commit the same version of dropzone that is present at https://github…
stevector Jan 10, 2018
8adc847
set contenta sync dir
stevector Jan 10, 2018
efa149a
set contenta sync dir
stevector Jan 10, 2018
574b796
Remove scenario that won't pass with Contenta
stevector Jan 10, 2018
99c0db3
merge contenta branc
stevector Jan 10, 2018
ff3c985
going back to old install hack
stevector Jan 17, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 140 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs
defaults: &defaults
docker:
- image: quay.io/pantheon-public/build-tools-ci:1.x
working_directory: ~/example_drops_8_composer
environment:
#=========================================================================
# In addition to the environment variables defined in this file, also
# add the following variables in the Circle CI UI.
#
# See: https://circleci.com/docs/2.0/environment-variables/
#
# TERMINUS_SITE: Name of the Pantheon site to run tests on, e.g. my_site
# TERMINUS_TOKEN: The Pantheon machine token
# GITHUB_TOKEN: The GitHub personal access token
# GIT_EMAIL: The email address to use when making commits
#
# TEST_SITE_NAME: The name of the test site to provide when installing.
# ADMIN_PASSWORD: The admin password to use when installing.
# ADMIN_EMAIL: The email address to give the admin when installing.
#=========================================================================
TZ: "/usr/share/zoneinfo/America/Los_Angeles"

# The variables below usually do not need to be modified.

#======================================================================================================================================
# Circle CI 2.0 does not yet expand environment variables so they have to be manually EXPORTed
# Once environment variables can be expanded the variables below can be uncommented and the EXPORTs in set-up-globals.sh can be removed
# See: https://discuss.circleci.com/t/unclear-how-to-work-with-user-variables-circleci-provided-env-variables/12810/11
# See: https://discuss.circleci.com/t/environment-variable-expansion-in-working-directory/11322
# See: https://discuss.circleci.com/t/circle-2-0-global-environment-variables/8681
#======================================================================================================================================

NOTIFY: 'scripts/github/add-commit-comment {project} {sha} "Created multidev environment [{site}#{env}]({dashboard-url})." {site-url}'
ADMIN_USERNAME: admin
# BUILD_TOOLS_VERSION: ^2.0.0-alpha4
TERM: dumb

version: 2
jobs:
# @todo: common initialization: 'composer install' for the site-under-test
build:
<<: *defaults
steps:
- checkout

- restore_cache:
keys:
- composer-cache
- terminus-install

- run:
# Set TERMINUS_ENV and related environment variables.
# https://github.com/pantheon-systems/docker-build-tools-ci/blob/1.x/scripts/set-environment
name: environment
command: /build-tools-ci/scripts/set-environment

- run:
name: run composer install to get the vendor directory
command: composer install

- save_cache:
key: composer-cache
paths:
- $HOME/.composer/cache

- save_cache:
key: terminus-install
paths:
- $(TERMINUS_PLUGINS_DIR:-~/.terminus/plugins)

- run:
name: lint php code for syntax errors
command: composer -n lint

- run:
name: check coding standards
command: composer -n code-sniff

- run:
name: run unit tests
command: composer -n unit-test

build_deploy_and_test:
<<: *defaults
steps:
- checkout

- restore_cache:
keys:
- composer-cache
- terminus-install

- run:
# Set TERMINUS_ENV and related environment variables.
# https://github.com/pantheon-systems/docker-build-tools-ci/blob/1.x/scripts/set-environment
name: dependencies
command: /build-tools-ci/scripts/set-environment

- run:
name: install dev dependencies, build assets, etc.
command: ./.circleci/scripts/pantheon/01-prepare

- run:
name: build assets
command: composer -n build-assets

- run:
name: prepare database for site-under test
command: ./.circleci/scripts/pantheon/02-init-site-under-test-clone-existing
# command: ./.circleci/scripts/pantheon/02-init-site-under-test-reinstall-new

- run:
name: run functional tests with Behat
command: ./tests/scripts/run-behat

- run:
name: post-test actions
command: ./.circleci/scripts/pantheon/03-post-test

- run:
name: handle merge to master (if needed)
command: ./.circleci/scripts/pantheon/04-merge-master

- run:
name: remove transient test fixtures
command: ./.circleci/scripts/pantheon/09-cleanup-fixtures

# TODO:
# 04-merge-master
# 09-cleanup-fixtures

workflows:
version: 2
build_and_test:
jobs:
# Install dev dependencies and do simple tests (sniff, unit tests, etc.)
- build
# Build deploy and test on target platform
- build_deploy_and_test
18 changes: 18 additions & 0 deletions .circleci/scripts/pantheon/01-prepare
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

set -eo pipefail

#
# This script starts up the test process.
#
# - Environment settings (e.g. git config) are initialized
# - Terminus plugins are installed
# - Any needed code updates are done
#
echo "Begin build for $DEFAULT_ENV. Pantheon test environment is $TERMINUS_SITE.$TERMINUS_ENV"

# Log in via Terminus
terminus -n auth:login --machine-token="$TERMINUS_TOKEN"

# Delete leftover CI environments
terminus -n build:env:delete:ci "$TERMINUS_SITE" --keep=2 --yes
22 changes: 22 additions & 0 deletions .circleci/scripts/pantheon/02-init-site-under-test-clone-existing
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

set -eo pipefail

#
# This script prepares the site-under-test by cloning the database from
# an existing site.
#
# Use EITHER this script OR the re-install-new script; do not run both.
#

# Create a new multidev site to test on
terminus -n env:wake "$TERMINUS_SITE.dev"
terminus -n build:env:create "$TERMINUS_SITE.dev" "$TERMINUS_ENV" --yes --clone-content --notify="$NOTIFY"

# Run updatedb to ensure that the cloned database is updated for the new code.
terminus -n drush "$TERMINUS_SITE.$TERMINUS_ENV" -- updatedb -y

# If exported configuration is available, then import it.
if [ -f "config/system.site.yml" ] ; then
terminus -n drush "$TERMINUS_SITE.$TERMINUS_ENV" -- config-import --yes
fi
15 changes: 15 additions & 0 deletions .circleci/scripts/pantheon/02-init-site-under-test-reinstall-new
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set -eo pipefail

#
# This script prepares the site-under-test by re-installing a new site.
#
# Use EITHER this script OR the clone-existing script; do not run both.
#

# Create a new multidev site to test on
terminus -n build:env:create "$TERMINUS_SITE.dev" "$TERMINUS_ENV" --yes --notify="$NOTIFY"

# Re-run the site installation process
terminus -n build:env:install "$TERMINUS_SITE.$TERMINUS_ENV" --site-name="$TEST_SITE_NAME" --account-mail="$ADMIN_EMAIL" --account-pass="$ADMIN_PASSWORD"
9 changes: 9 additions & 0 deletions .circleci/scripts/pantheon/03-post-test
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

set -eo pipefail

#
# This script runs any post-test operations that may be needed.
#

terminus -n secrets:set "$TERMINUS_SITE.$TERMINUS_ENV" token "$GITHUB_TOKEN" --file='github-secrets.json' --clear --skip-if-empty
26 changes: 26 additions & 0 deletions .circleci/scripts/pantheon/04-merge-master
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

set -eo pipefail

#
# This script handles all operations that must be done when a
# pull request is merged back into the master branch.
#
if [[ $CIRCLE_BRANCH != "master" ]] ; then
exit 0
fi

# Merge the multidev for the PR into the dev environment
terminus -n build:env:merge "$TERMINUS_SITE.$TERMINUS_ENV" --yes

# Run updatedb on the dev environment
terminus -n drush $TERMINUS_SITE.dev -- updatedb --yes

# If there are any exported configuration files, then import them
if [ -f "config/system.site.yml" ] ; then
terminus -n drush "$TERMINUS_SITE.dev" -- config-import --yes
fi

# Delete old multidev environments associated with a PR that has been
# merged or closed.
terminus -n build:env:delete:pr "$TERMINUS_SITE" --yes
12 changes: 12 additions & 0 deletions .circleci/scripts/pantheon/09-cleanup-fixtures
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

set -eo pipefail

#
# This script deletes any fixtures that are no longer needed.
#
# Note that we allow the "ci-BUILD_NUMBER" and "pr-PULL_REQUEST_NUMBER"
# multidev sites to persist until the next time the 'prepare' or
# 'merge-master' scripts (respectively) are called.
#

8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ web/autoload.php
web/index.php
web/robots.txt
web/sites/default/default.services.pantheon.preproduction.yml
web/sites/default/default.services.yml
web/sites/default/default.settings.php
web/sites/default/settings.pantheon.php
web/sites/development.services.yml
Expand Down Expand Up @@ -50,16 +49,14 @@ web/web.config
### to the Pantheon repository.
###

# Ignore Drupal's file directory
/web/sites/*/files/

# Ignore Drupal's file directory
web/sites/default/files

# Pantheon commits a settings.php for environment-specific settings.
# Place local settings in settings.local.php
web/sites/*/settings.local.php
web/sites/*/services*.yml
!web/sites/*/services.pantheon.*.yml

# Ignore SimpleTest multi-site environment.
web/sites/simpletest
Expand Down Expand Up @@ -104,3 +101,6 @@ Thumbs.db

# Things in the core directory that Drupal 8 commits in the repository.
!web/core/**/*.gz

# Don't commit keys generated by contenta install
/keys/
78 changes: 0 additions & 78 deletions .gitlab-ci.yml

This file was deleted.

Loading