Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/2020 standards #94

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
42 changes: 0 additions & 42 deletions .env

This file was deleted.

8 changes: 8 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copy this file to .env to load in project secrets.
# This file should not be checked into version control.

PROJECT_NAME=d8-quickstart
PROJECT_BASE_URL=d8-quickstart.localhost

# You can choose not to use Docker for local development by setting USE_DOCKER to 0.
USE_DOCKER=1
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,6 @@ Thumbs.db

# Node
node_modules

# Project secrets should not be checked in.
.env
3,153 changes: 3,153 additions & 0 deletions .mariadb-init/startup.sql

Large diffs are not rendered by default.

243 changes: 123 additions & 120 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,173 +1,176 @@
ENVIRONMENT?=docker
DRUSH_ARGS?=-y --nocolor
HOST=php
SOLR_HOST=solr
COMMAND=/bin/bash


#
# Key targets
# Optionally include a .env file.
#
-include .env

# Shortcut for make install, make build and make start
default: bootstrap install build start
#
# You can choose to not use Docker for local development by specifying the USE_DOCKER=0 environment variable in
# your project .env file. The default is to use Docker for local development.
#

# Bootstrap Deeson Drupal build framework
bootstrap:
./scripts/bootstrap-build-framework.sh
USE_DOCKER ?= 1

# Install dependencies
install:
./scripts/make/install.sh
#
# Ensure the local environment has the right binaries installed.
#

# Build all static assets
build:
./scripts/make/build.sh
REQUIRED_BINS := php composer
$(foreach bin,$(REQUIRED_BINS),\
$(if $(shell command -v $(bin) 2> /dev/null),,$(error Please install `$(bin)`)))

# Start Docker Compose services but assume dependencies and build has already taken place
start:
@echo Bringing docker containers up
docker-compose up -d
docker-compose ps
#
# Default is what happens if you only type make.
#

# Run all tests
test:
./scripts/make/test.sh
default: install start build

# Update Drupal
update:
./scripts/make/update.sh ${ENVIRONMENT} ${DRUSH_ARGS}
#
# Bring in the external project dependencies.
#

# Set the alias required by Xdebug
xdebug:
sudo ifconfig lo0 alias 10.254.254.254
install: .env
ifeq ("${USE_DOCKER}","1")
docker run --rm --interactive --tty --volume $(PWD):/var/www/html:delegated wodby/drupal-php:7.3-dev /bin/bash -c "composer global require hirak/prestissimo; composer install"
else
composer install
endif

#
# Update all Composer dependencies.
#

update:
ifeq ("${USE_DOCKER}","1")
docker run --rm --interactive --tty --volume $(PWD):/app --volume $(PWD)/.persist/composer:/tmp composer update
else
composer update
endif

#
# Targets for interacting with Docker Compose
# Start the local development server.
#

# Stop docker
start:
ifeq ("${USE_DOCKER}","1")
@echo Bringing docker containers up
docker-compose up -d
docker-compose ps
else
./vendor/bin/drush runserver
endif

stop:
ifeq ("${USE_DOCKER}","1")
docker-compose down --remove-orphans
endif

# Restart docker
restart: stop start

# Connect to the shell on a docker host, defaults to HOST=php COMMAND=/bin/bash
# Usage: make shell HOST=[service name] COMMAND=[command]
shell:
docker-compose exec $(HOST) $(COMMAND)



#
# Targets for orchestrating project build
# Build stages: Setup and configure the application for the environment.
#

# Initialise Apache Solr core in service container for Apache Solr (without Search API).
build-solr:
make shell HOST=$(SOLR_HOST) COMMAND='make core=core1 config_set=apachesolr -f /usr/local/bin/actions.mk'

# Initialise Apache Solr core in service container for Apache Solr (via Search API).
build-searchapi-solr:
make shell HOST=$(SOLR_HOST) COMMAND='make core=core1 -f /usr/local/bin/actions.mk'

build: install-drupal

install-drupal:
ifeq ("${USE_DOCKER}","1")
@echo Waiting for db to be ready ...
@sleep 45
./drush.wrapper @docker cim --yes
./drush.wrapper @docker uli
else
./vendor/bin/drush si standard --yes
./vendor/bin/drush cim --yes
./vendor/bin/drush uli
endif

#
# Targets for cleaning project build artefacts
# Linting / testing / formatting.
#

# Remove everything that's re-buildable. Running make build will reverse this.
clean: clean-drupal clean-frontend

# Remove NodeJS modules required by front-end
clean-node:
./scripts/make/clean-node.sh

# Remove all front-end build artefacts including NodeJS modules
clean-frontend: clean-node
./scripts/make/clean-frontend.sh

# Remove dependencies managed by Composer
clean-composer:
./scripts/make/clean-composer.sh

# Remove Drupal dependencies managed by Drush Make including Composer dependencies
clean-drupal: clean-composer
./scripts/make/clean-drupal.sh
lint:
@echo "TBC ..."

test:
@echo "TBC ..."

format:
@echo "TBC ..."

#
# Targets for Bitbucket Pipelines
# Delete all non version controlled files to reset the project.
#

# Bootstrap scripts/make directory
pipelines-bootstrap:
./scripts/bootstrap-build-framework.sh
clean: stop
chmod -R +w docroot/sites/default
rm -rf docroot vendor

# Build Drupal under Pipelnes.
pipelines-build-drupal:
./scripts/make/install-drupal.sh
#
# Generate project symlinks and other disposable assets and wiring.
#

# Build the frontend resources and copy them into the docroot under Pipelines
pipelines-build-frontend:
./scripts/make/build-frontend.sh
.persist/public:
ifeq ("${USE_DOCKER}","1")
mkdir -p .persist/public
endif

# Relay to hosting platform provided Git repository under Pipelines.
pipelines-deploy:
/opt/ci-tools/deployer.sh
.persist/private:
ifeq ("${USE_DOCKER}","1")
mkdir -p .persist/private
endif

# Run all the tests under Pipelines.
pipelines-test: pipelines-test-all
.env:
cp .env.example .env

# Run only the coding standards tests under Pipelines.
pipelines-test-standards:
./scripts/make/test/run-test.sh --standards
docroot/sites/default/files/:
ifeq ("${USE_DOCKER}","1")
ln -s ../../../.persist/public docroot/sites/default/files
endif

# Run only the unit tests under Pipelines.
pipelines-test-unit:
./scripts/make/test/run-test.sh --unit
docroot/sites/default/files/tmp/:
mkdir -p docroot/sites/default/files/tmp/

# Run only the behat tests under Pipelines.
pipelines-test-behat:
./scripts/make/test/run-test.sh --behat
docroot/sites/default/settings.php:
ln -s ../../../src/settings/settings.php docroot/sites/default/settings.php

# Run all the tests under Pipelines.
pipelines-test-all:
./scripts/make/test/run-test.sh --all
docroot/modules/custom:
ln -s ../../src/modules $@

docroot/themes/custom:
ln -s ../../src/themes $@

docroot/profiles/custom:
ln -s ../../src/profiles $@

#
# Targets for interacting with Docker Compose
# Commands which get run from composer.json scripts section.
#

# Run all the tests.
test: test-all

# Run only the coding standards tests.
test-standards:
./scripts/make/test/run-tests.sh --standards
composer--post-install-cmd: composer--post-update-cmd
composer--post-update-cmd: .persist/public \
.persist/private \
docroot/sites/default/settings.php \
docroot/modules/custom \
docroot/profiles/custom \
docroot/themes/custom;

# Run only the unit tests.
test-unit:
./scripts/make/test/run-tests.sh --unit

# Run only the behat tests.
test-behat:
./scripts/make/test/run-tests.sh --behat
#
# Helper CLI commands.
#

# Run all the tests.
test-all:
./scripts/make/test/run-tests.sh --all
sql-cli:
ifeq ("${USE_DOCKER}","1")
@docker-compose exec mariadb mysql -udrupal -pdrupal drupal
else
@echo "You need to use whatever sqlite uses..."
endif

logs:
ifeq ("${USE_DOCKER}","1")
docker-compose logs -f
else
@echo "You need to use whatever sqlite uses..."
endif

#
# Targets specific to the project
#
# Note: Do not forget to precede the target definition with a comment explaining what it does!
#
xdebug:
sudo ifconfig lo0 alias 10.254.254.254
Empty file removed behat-tests/.gitkeep
Empty file.
25 changes: 0 additions & 25 deletions behat-tests/bootstrap/DefaultFeatureContext.php

This file was deleted.

12 changes: 0 additions & 12 deletions behat-tests/features/example.feature

This file was deleted.

Loading