Skip to content

Commit

Permalink
Merge branch 'release/1.0.0-alpha12'
Browse files Browse the repository at this point in the history
  • Loading branch information
TravisCarden committed May 16, 2019
2 parents 45f334a + 8d02e6f commit ed9edc4
Show file tree
Hide file tree
Showing 28 changed files with 481 additions and 328 deletions.
9 changes: 5 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
language: php

php: 7.1
php: "7.1"

addons:
chrome: stable
Expand Down Expand Up @@ -29,16 +29,17 @@ matrix:
fast_finish: true
include:
- { name: "Static code analysis", env: ORCA_JOB=STATIC_CODE_ANALYSIS }
- { name: "Deprecated code scan of SUT only", env: ORCA_JOB=DEPRECATED_CODE_SCAN_SUT }
- { name: "Deprecated code scan of SUT plus contrib", env: ORCA_JOB=DEPRECATED_CODE_SCAN_CONTRIB }
- { name: "Deprecated code scan of SUT", env: ORCA_JOB=DEPRECATED_CODE_SCAN_SUT }
- { name: "Deprecated code scan of contrib", env: ORCA_JOB=DEPRECATED_CODE_SCAN_CONTRIB ORCA_PACKAGES_CONFIG=config/packages.yml ORCA_PACKAGES_CONFIG_ALTER= }
- { name: "Isolated test w/ recommended package versions", env: ORCA_JOB=ISOLATED_RECOMMENDED }
- { name: "Integrated test w/ recommended package versions", env: ORCA_JOB=INTEGRATED_RECOMMENDED }
- { name: "Integrated test w/ recommended package versions & previous minor release of Drupal core", env: ORCA_JOB=CORE_PREVIOUS }
- { name: "Isolated test w/ dev package versions", env: ORCA_JOB=ISOLATED_DEV }
- { name: "Integrated test w/ dev package versions", env: ORCA_JOB=INTEGRATED_DEV }
- { name: "Integrated test w/ dev package versions & next minor dev version of Drupal core", env: ORCA_JOB=CORE_NEXT }
- { name: "Custom job", env: ORCA_JOB=CUSTOM ORCA_CUSTOM_FIXTURE_INIT_ARGS="--help" ORCA_CUSTOM_TESTS_RUN_ARGS="--help" }
allow_failures:
- env: ORCA_JOB=DEPRECATED_CODE_SCAN_CONTRIB
- env: ORCA_JOB=DEPRECATED_CODE_SCAN_CONTRIB ORCA_PACKAGES_CONFIG=config/packages.yml ORCA_PACKAGES_CONFIG_ALTER=

before_install: ../orca/bin/travis/before_install.sh

Expand Down
23 changes: 12 additions & 11 deletions bin/travis/_includes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# _includes.sh - Include reusable code.
#
# SYNOPSIS
# cd "$(dirname "$0")"; source _includes.sh
# cd "$(dirname "$0")" || exit; source _includes.sh
#
# DESCRIPTION
# Includes common features used by the Travis CI scripts.
Expand All @@ -15,25 +15,26 @@ function assert {
if [[ ! "$1" ]]; then
RED="\033[1;31m"
NO_COLOR="\033[0m"
echo -e "\n${RED}Error: $2${NO_COLOR}\n"
printf "\n%bError: %b%b\n" "$RED" "$2" "$NO_COLOR"
exit 1
fi
}

# Asserts that necessary environment variables are set.
function assert_env_vars {
assert "$ORCA_SUT_NAME" "Missing required ORCA_SUT_NAME environment variable.\nHint: ORCA_SUT_NAME=drupal/example"
assert "$ORCA_SUT_BRANCH" "Missing required ORCA_SUT_BRANCH environment variable.\nHint: ORCA_SUT_BRANCH=8.x-1.x"
if [[ "$ORCA_JOB" != "DEPRECATED_CODE_SCAN_CONTRIB" ]]; then
assert "$ORCA_SUT_NAME" "Missing required ORCA_SUT_NAME environment variable.\nHint: ORCA_SUT_NAME=drupal/example"
if [[ "$TRAVIS" ]]; then assert "$ORCA_SUT_BRANCH" "Missing required ORCA_SUT_BRANCH environment variable.\nHint: ORCA_SUT_BRANCH=8.x-1.x"; fi
fi
if [[ ! "$TRAVIS" && "$ORCA_JOB" = "STATIC_CODE_ANALYSIS" ]]; then assert "$ORCA_SUT_DIR" "Missing required ORCA_SUT_DIR environment variable.\nHint: ORCA_SUT_DIR=~/Projects/example"; fi
}

# Prevent CI scripts from being run locally.
assert "$TRAVIS" "This script is meant to run on Travis CI only."

# Set environment variables.
export ORCA_ROOT="$(cd "$(dirname "$BASH_SOURCE")/../.." && pwd)"
export ORCA_FIXTURE_DIR=${ORCA_FIXTURE_DIR:="${ORCA_ROOT}/../orca-build"}
export ORCA_FIXTURE_DOCROOT=${ORCA_FIXTURE_DIR}/docroot
ORCA_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
export ORCA_ROOT
export ORCA_FIXTURE_DIR=${ORCA_FIXTURE_DIR:="$ORCA_ROOT/../orca-build"}
export ORCA_SUT_DIR=${ORCA_SUT_DIR:=${TRAVIS_BUILD_DIR}}
export ORCA_FIXTURE_PROFILE=${ORCA_FIXTURE_PROFILE:="minimal"}

# Add binary directories to PATH.
export PATH="$HOME/.composer/vendor/bin:$PATH"
Expand All @@ -43,7 +44,7 @@ export PATH="$ORCA_FIXTURE_DIR/vendor/bin:$PATH"
export PATH="$TRAVIS_BUILD_DIR/vendor/bin:$PATH"

# Add convenient aliases.
alias drush="drush -r ${ORCA_FIXTURE_DOCROOT}"
alias drush='drush -r "$ORCA_FIXTURE_DIR"'

# Exit as soon as one command returns a non-zero exit code and make the shell
# print all lines in the script before executing them.
Expand Down
2 changes: 1 addition & 1 deletion bin/travis/after_failure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# DESCRIPTION
# Displays Drupal error log.

cd "$(dirname "$0")"; source _includes.sh
cd "$(dirname "$0")" || exit; source _includes.sh

if [[ -f "$ORCA_FIXTURE_DIR/vendor/bin/drush" && "$(drush core-status --field=bootstrap)" ]]; then
drush watchdog:show --count=100 --severity=Error --extended
Expand Down
59 changes: 42 additions & 17 deletions bin/travis/before_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,48 @@
# DESCRIPTION
# Configures the Travis CI environment, installs ORCA, and prepares the SUT.

cd "$(dirname "$0")"; source _includes.sh
cd "$(dirname "$0")" || exit; source _includes.sh

# Display configuration values.
set +v
CONFIG_VARS=(
ORCA_CUSTOM_FIXTURE_INIT_ARGS
ORCA_CUSTOM_TESTS_RUN_ARGS
ORCA_FIXTURE_DIR
ORCA_FIXTURE_PROFILE
ORCA_JOB
ORCA_PACKAGES_CONFIG
ORCA_PACKAGES_CONFIG_ALTER
ORCA_ROOT
ORCA_SUT_BRANCH
ORCA_SUT_DIR
ORCA_SUT_NAME
)
for CONFIG_VAR in "${CONFIG_VARS[@]}"; do
eval "echo ${CONFIG_VAR} = $""$CONFIG_VAR"
done
set -v

# Make Composer Patches throw an error when it can't apply a patch.
export COMPOSER_EXIT_ON_PATCH_FAILURE=1

# The remaining before_install commands should only be run on Travis CI.
[[ "$TRAVIS" ]] || exit

# Display the Google Chrome version.
google-chrome-stable --version

# Disable Xdebug.
phpenv config-rm xdebug.ini

# Remove PHP memory limit.
echo 'memory_limit = -1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini

# Prevent email errors.
echo 'sendmail_path = /bin/true' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini

# Prevent PHPStan warnings about APCu constants.
echo 'extension = apcu.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
{
# Remove PHP memory limit.
echo 'memory_limit = -1'
# Prevent email errors.
echo 'sendmail_path = /bin/true'
# Prevent PHPStan warnings about APCu constants.
echo 'extension = apcu.so'
} >> "$HOME/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini"

# Install the PECL YAML parser for strict YAML parsing.
yes | pecl install yaml
Expand All @@ -34,15 +60,14 @@ composer global require \
hirak/prestissimo \
zaporylie/composer-drupal-optimizations

# Make Composer Patches throw an error when it can't apply a patch.
export COMPOSER_EXIT_ON_PATCH_FAILURE=1

# Install ORCA.
composer -d${ORCA_ROOT} install
composer -d"$ORCA_ROOT" install

orca --version

# Ensure the checked out branch is named after the nearest Git version branch.
git -C "${ORCA_SUT_DIR}" rev-parse --abbrev-ref HEAD
if [[ $(git -C "${ORCA_SUT_DIR}" rev-parse --abbrev-ref HEAD) != "$ORCA_SUT_BRANCH" ]]; then
git -C "${ORCA_SUT_DIR}" branch -f "$ORCA_SUT_BRANCH"
git -C "${ORCA_SUT_DIR}" checkout "$ORCA_SUT_BRANCH"
git -C "$ORCA_SUT_DIR" rev-parse --abbrev-ref HEAD
if [[ $(git -C "$ORCA_SUT_DIR" rev-parse --abbrev-ref HEAD) != "$ORCA_SUT_BRANCH" ]]; then
git -C "$ORCA_SUT_DIR" branch -f "$ORCA_SUT_BRANCH"
git -C "$ORCA_SUT_DIR" checkout "$ORCA_SUT_BRANCH"
fi
9 changes: 6 additions & 3 deletions bin/travis/before_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,19 @@
# Displays information about installed Composer packages and Drupal
# projects.

cd "$(dirname "$0")"; source _includes.sh
cd "$(dirname "$0")" || exit; source _includes.sh

# Exit early in the absence of a fixture.
[[ -d "$ORCA_FIXTURE_DIR" ]] || exit 0

# Display installed Composer packages.
composer -d${ORCA_FIXTURE_DIR} show
composer -d"$ORCA_FIXTURE_DIR" show

# Display outdated Composer packages information.
composer -d"$ORCA_FIXTURE_DIR" outdated

# Display the list of available Drupal extensions (modules and themes).
drush --no-ansi pm:list || true
drush --no-ansi pm:list --fields=package,display_name,type,status,version || true

# Display basic Drupal site details.
drush core-status
28 changes: 12 additions & 16 deletions bin/travis/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,18 @@
# DESCRIPTION
# Creates the test fixture.

cd "$(dirname "$0")"; source _includes.sh
cd "$(dirname "$0")" || exit; source _includes.sh

assert_env_vars

[[ "$ORCA_JOB" != "DEPRECATED_CODE_SCAN_SUT" ]] || orca fixture:init -f --sut=${ORCA_SUT_NAME} --sut-only --no-site-install

[[ "$ORCA_JOB" != "DEPRECATED_CODE_SCAN_CONTRIB" ]] || orca fixture:init -f --sut=${ORCA_SUT_NAME} --sut-only --no-site-install

[[ "$ORCA_JOB" != "ISOLATED_RECOMMENDED" ]] || orca fixture:init -f --sut=${ORCA_SUT_NAME} --sut-only

[[ "$ORCA_JOB" != "INTEGRATED_RECOMMENDED" ]] || orca fixture:init -f --sut=${ORCA_SUT_NAME}

[[ "$ORCA_JOB" != "CORE_PREVIOUS" ]] || orca fixture:init -f --sut=${ORCA_SUT_NAME} --core=PREVIOUS_RELEASE

[[ "$ORCA_JOB" != "ISOLATED_DEV" ]] || orca fixture:init -f --sut=${ORCA_SUT_NAME} --sut-only --dev

[[ "$ORCA_JOB" != "INTEGRATED_DEV" ]] || orca fixture:init -f --sut=${ORCA_SUT_NAME} --dev

[[ "$ORCA_JOB" != "CORE_NEXT" ]] || orca fixture:init -f --sut=${ORCA_SUT_NAME} --core=NEXT_DEV --dev
case "$ORCA_JOB" in
"DEPRECATED_CODE_SCAN_SUT") eval "orca fixture:init -f --sut=$ORCA_SUT_NAME --sut-only --no-site-install" ;;
"DEPRECATED_CODE_SCAN_CONTRIB") eval "orca fixture:init -f --no-site-install" ;;
"ISOLATED_RECOMMENDED") eval "orca fixture:init -f --sut=$ORCA_SUT_NAME --sut-only --core=CURRENT_RECOMMENDED --profile=$ORCA_FIXTURE_PROFILE" ;;
"INTEGRATED_RECOMMENDED") eval "orca fixture:init -f --sut=$ORCA_SUT_NAME --core=CURRENT_RECOMMENDED --profile=$ORCA_FIXTURE_PROFILE" ;;
"CORE_PREVIOUS") eval "orca fixture:init -f --sut=$ORCA_SUT_NAME --core=PREVIOUS_RELEASE --profile=$ORCA_FIXTURE_PROFILE" ;;
"ISOLATED_DEV") eval "orca fixture:init -f --sut=$ORCA_SUT_NAME --sut-only --core=CURRENT_DEV --dev --profile=$ORCA_FIXTURE_PROFILE" ;;
"INTEGRATED_DEV") eval "orca fixture:init -f --sut=$ORCA_SUT_NAME --core=CURRENT_DEV --dev --profile=$ORCA_FIXTURE_PROFILE" ;;
"CORE_NEXT") eval "orca fixture:init -f --sut=$ORCA_SUT_NAME --core=NEXT_DEV --dev --profile=$ORCA_FIXTURE_PROFILE" ;;
"CUSTOM") eval "orca fixture:init -f --sut=$ORCA_SUT_NAME --profile=$ORCA_FIXTURE_PROFILE ${ORCA_CUSTOM_FIXTURE_INIT_ARGS:=}" ;;
esac
33 changes: 15 additions & 18 deletions bin/travis/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,23 @@
# DESCRIPTION
# Runs static code analysis and automated tests.

cd "$(dirname "$0")"; source _includes.sh
cd "$(dirname "$0")" || exit; source _includes.sh

assert_env_vars

[[ ! -d "$ORCA_FIXTURE_DIR" ]] || orca fixture:status

[[ "$ORCA_JOB" != "STATIC_CODE_ANALYSIS" ]] || orca static-analysis:run ${ORCA_SUT_DIR}

[[ "$ORCA_JOB" != "DEPRECATED_CODE_SCAN_SUT" ]] || orca deprecated-code-scan:run --sut=${ORCA_SUT_NAME}

[[ "$ORCA_JOB" != "DEPRECATED_CODE_SCAN_CONTRIB" ]] || orca deprecated-code-scan:run --contrib

[[ "$ORCA_JOB" != "ISOLATED_RECOMMENDED" ]] || orca tests:run --sut=${ORCA_SUT_NAME} --sut-only

[[ "$ORCA_JOB" != "INTEGRATED_RECOMMENDED" ]] || orca tests:run --sut=${ORCA_SUT_NAME}

[[ "$ORCA_JOB" != "CORE_PREVIOUS" ]] || orca tests:run --sut=${ORCA_SUT_NAME}

[[ "$ORCA_JOB" != "ISOLATED_DEV" ]] || orca tests:run --sut=${ORCA_SUT_NAME} --sut-only

[[ "$ORCA_JOB" != "INTEGRATED_DEV" ]] || orca tests:run --sut=${ORCA_SUT_NAME}

[[ "$ORCA_JOB" != "CORE_NEXT" ]] || orca tests:run --sut=${ORCA_SUT_NAME}
[[ "$ORCA_FIXTURE_PROFILE" = "minimal" ]] || SUT_ONLY="--sut-only"

case "$ORCA_JOB" in
"STATIC_CODE_ANALYSIS") eval "orca static-analysis:run $ORCA_SUT_DIR" ;;
"DEPRECATED_CODE_SCAN_SUT") eval "orca deprecated-code-scan:run --sut=$ORCA_SUT_NAME" ;;
"DEPRECATED_CODE_SCAN_CONTRIB") eval "orca deprecated-code-scan:run --contrib" ;;
"ISOLATED_RECOMMENDED") eval "orca tests:run --sut=$ORCA_SUT_NAME --sut-only" ;;
"INTEGRATED_RECOMMENDED") eval "orca tests:run --sut=$ORCA_SUT_NAME $SUT_ONLY" ;;
"CORE_PREVIOUS") eval "orca tests:run --sut=$ORCA_SUT_NAME $SUT_ONLY" ;;
"ISOLATED_DEV") eval "orca tests:run --sut=$ORCA_SUT_NAME --sut-only" ;;
"INTEGRATED_DEV") eval "orca tests:run --sut=$ORCA_SUT_NAME $SUT_ONLY" ;;
"CORE_NEXT") eval "orca tests:run --sut=$ORCA_SUT_NAME $SUT_ONLY" ;;
"CUSTOM") eval "orca tests:run --sut=$ORCA_SUT_NAME ${ORCA_CUSTOM_TESTS_RUN_ARGS:=}" ;;
esac
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@
"pre-commit": [
"set -e",
"vendor/bin/parallel-lint --exclude vendor --no-progress .",
"vendor/bin/phpcs --cache=var/.phpcs-cache",
"vendor/bin/phpmd . text phpmd.xml.dist --ignore-violations-on-exit"
"vendor/bin/phpcs --cache=var/.phpcs-cache"
],
"post-install-cmd": "vendor/bin/cghooks add --ignore-lock",
"post-update-cmd": "vendor/bin/cghooks update"
Expand Down
Loading

0 comments on commit ed9edc4

Please sign in to comment.