province abbreviation patch - issue 724
[civicrm-core.git] / tools / scripts / phpunit-jenkins
CommitLineData
6a488035
TO
1#!/bin/bash
2set -ex
3
4## Setup a test site based on source code in the Jenkins workspace
5## and run the test suite.
6##
7## To configure a Jenkins job which runs tests and produces code-coverage,
8## put something like this in the job configuration:
9##
10## [ -d "${WORKSPACE}/build" ] && rm -rf "${WORKSPACE}/build"
11## mkdir -p "${WORKSPACE}/build" "${WORKSPACE}/build/CodeCoverage"
12## ${WORKSPACE}/civicrm/tools/scripts/phpunit-jenkins \
13## --tap \
14## --coverage-clover "${WORKSPACE}/build/CodeCoverage/clover.xml" \
15## --coverage-html "${WORKSPACE}/build/CodeCoverage/" \
16## --log-junit "${WORKSPACE}/build/junit.xml" \
17## CRM_AllTests
18##
19## To configure a Jenkins job which run tests but omits code-coverage:
20##
21## [ -d "${WORKSPACE}/build" ] && rm -rf "${WORKSPACE}/build"
22## mkdir -p "${WORKSPACE}/build"
23## ${WORKSPACE}/civicrm/tools/scripts/phpunit-jenkins \
24## --tap \
25## --log-junit "${WORKSPACE}/build/junit.xml" \
26## CRM_AllTests
bcd9e9f5 27##
6a488035
TO
28
29if [ -z "$EXECUTOR_NUMBER" -o -z "$WORKSPACE" ]; then
30 echo "This script requires the following environment variables:"
31 echo "EXECUTOR_NUMBER"
32 echo "WORKSPACE"
33 exit 1
34fi
35
36## Configuration
37OUTPUT="${WORKSPACE}/build"
38DRUPAL_ROOT="/var/www/drupal"
39SITE_URL="jenkins-${EXECUTOR_NUMBER}.localhost"
40SITE_DB="jenkins_${EXECUTOR_NUMBER}"
41export CIVICRM_LOCALES=en_US,fr_FR
42
43## Prepare workspace
44bash "${WORKSPACE}/civicrm/tools/scripts/mk-drupal-test-site" "${SITE_URL}" "${SITE_DB}" "${DRUPAL_ROOT}" "${WORKSPACE}/civicrm/"
45
46## Run tests
47pushd "${DRUPAL_ROOT}/sites/${SITE_URL}/modules/civicrm/tools"
48./scripts/phpunit "$@"
49# --process-isolation \
50popd