forked from sugarcrm-developers/school
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSetupEnvAndRunTests.sh
executable file
·89 lines (61 loc) · 3.31 KB
/
SetupEnvAndRunTests.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/env bash
######################################################################
# Variables
######################################################################
if [[ -z "$1" ]] || [[ -z "$2" ]] || [[ -z "$3" ]] || [[ -z "$4" ]] || [[ -z "$5" ]] || [[ -z "$6" ]] || [[ -z "$7" ]]
then
echo "Not all required command line arguments were set. Please run the script again with the required arguments:
1: Email address associated with your SugarCRM account
2: Password associated with the above account
3: Sugar version (Example: 7.11)
4: Sugar edition (Options: Ult, Ent, Pro)
5: GitHub username that has access to sugarcrm/unit-tests
6: Password associated with the above account
7. Path to where the Sugar Docker files should be stored relative to the current directory. WARNING: The
data/app/sugar directory will be deleted and recreated.
8. (Optional) Path to where Sugar source zip files are stored. If this param is not provided, the Sugar
source zip files will be downloaded from the SugarCRM Developer Builds Community. The Sugar source zip files
should be named with the following pattern: Sugar$sugarEdition-$sugarVersion.zip. For example: SugarEnt-7.11.zip
For example: ./SetupEnvAndRunTests.sh communityemail@example.com mycommunitypassword 7.11 Pro githubusername
githubpassword workspace/sugardocker ../sugar_source_zips"
exit 1
fi
# Email address associated with your SugarCRM account
email=$1
# Password associated with your SugarCRM account
password=$2
# The Sugar version to download
sugarVersion=$3
# The Sugar edition to download
sugarEdition=$4
# The name we will use to refer to Sugar
sugarName="Sugar$sugarEdition-$sugarVersion"
# GitHub username
gitHubUsername=$5
# GitHub password
gitHubPassword=$6
# The path to where the Sugar Docker files should be stored relative to the current directory
sugarDockerDirectory=$7
# The path to where the Sugar source files are stored
sugarDirectory="$sugarDockerDirectory/data/app/sugar"
# The path to where the existing Sugar source files are stored (optional)
sugarSourceZipsDirectory=$8
######################################################################
# Setup
######################################################################
# Set permission for when sudo is required and is not required. Output of these commands will not be printed.
chmod -R 777 . &> /dev/null
sudo chmod -R 777 . &> /dev/null
mkdir workspace
######################################################################
# Setup the environment for PHPUnit tests and run them
######################################################################
./StartDockerStack.sh $sugarVersion $sugarDockerDirectory || exit 1
./GetCopyOfSugar.sh $email $password $sugarName "$(dirname "$sugarDirectory")" $sugarSourceZipsDirectory || exit 1
./CloneSugarUnitTestsFromGitRepo.sh $sugarVersion $gitHubUsername $gitHubPassword || exit 1
./UnzipSugarToDirectory.sh $sugarName $sugarDirectory || exit 1
./SetupSugarPHPUnitTests.sh $sugarName $sugarEdition $sugarDirectory || exit 1
./InstallSugarAndProfM.sh $sugarDirectory || exit 1
./RunProfMPHPUnitTests.sh $sugarDirectory || exit 1
./RunPostmanTests.sh $sugarVersion $sugarEdition || exit 1
./StopDockerStack.sh $sugarVersion $sugarDockerDirectory || exit 1