Skip to content

Commit

Permalink
Updating PHPUnit automation scripts based on code review
Browse files Browse the repository at this point in the history
Update config_override
Update GIT_HUB to GITHUB
Update config_si

Fix headers error

Remove sudo from calls to get install to work on local machine
  • Loading branch information
lschaefer-sugarcrm committed Apr 2, 2018
1 parent 4dcba4d commit 7f9c771
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 67 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- cd ../scripts
- sudo service mysql stop
script:
- ./SetupEnvAndRunPHPUnitTests.sh $DEV_COMMUNITY_USERNAME $DEV_COMMUNITY_PASSWORD $SUGAR_VERSION $SUGAR_EDITION $GIT_HUB_USERNAME $GIT_HUB_PASSWORD workspace/sugardocker
- ./SetupEnvAndRunPHPUnitTests.sh $DEV_COMMUNITY_USERNAME $DEV_COMMUNITY_PASSWORD $SUGAR_VERSION $SUGAR_EDITION $GITHUB_USERNAME $GITHUB_PASSWORD workspace/sugardocker
- stage: Run PHPUnit
sudo: required
language: php
Expand All @@ -47,7 +47,7 @@ jobs:
- cd ../scripts
- sudo service mysql stop
script:
- ./SetupEnvAndRunPHPUnitTests.sh $DEV_COMMUNITY_USERNAME $DEV_COMMUNITY_PASSWORD $SUGAR_VERSION $SUGAR_EDITION $GIT_HUB_USERNAME $GIT_HUB_PASSWORD workspace/sugardocker
- ./SetupEnvAndRunPHPUnitTests.sh $DEV_COMMUNITY_USERNAME $DEV_COMMUNITY_PASSWORD $SUGAR_VERSION $SUGAR_EDITION $GITHUB_USERNAME $GITHUB_PASSWORD workspace/sugardocker
- stage: Run PHPUnit
sudo: required
language: php
Expand All @@ -63,7 +63,7 @@ jobs:
- cd ../scripts
- sudo service mysql stop
script:
- ./SetupEnvAndRunPHPUnitTests.sh $DEV_COMMUNITY_USERNAME $DEV_COMMUNITY_PASSWORD $SUGAR_VERSION $SUGAR_EDITION $GIT_HUB_USERNAME $GIT_HUB_PASSWORD workspace/sugardocker
- ./SetupEnvAndRunPHPUnitTests.sh $DEV_COMMUNITY_USERNAME $DEV_COMMUNITY_PASSWORD $SUGAR_VERSION $SUGAR_EDITION $GITHUB_USERNAME $GITHUB_PASSWORD workspace/sugardocker
- stage: Build & Post on GitHub
language: php
php: '7.1'
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ The build has four Environment Variables that have been configured in the projec
- DEV_COMMUNITY_USERNAME: The username for an account that has access to the
[SugarCRM Developer Builds Space](https://community.sugarcrm.com/community/developer/developer-builds)
- DEV_COMMUNITY_PASSWORD: The password associated with the above account
- GIT_HUB_USERNAME: The username for a GitHub account that has access to https://github.com/sugarcrm/unit-tests
- GIT_HUB_PASSWORD: The password associated with the above account
- GITHUB_USERNAME: The username for a GitHub account that has access to https://github.com/sugarcrm/unit-tests
- GITHUB_PASSWORD: The password associated with the above account

![Travis CI Environment Variables](images/travisenvvars.png)

Expand Down Expand Up @@ -300,8 +300,8 @@ and manually trigger the builds instead.
1. In the **Build Environment** section, select the **Delete workspace before build starts** option and the **Use secret
text(s) or file(s)** option.
1. In the **Bindings** section, select **Add** > **Username and password (separated)**. Then input the following:
1. Username Variable: `GIT_HUB_USERNAME`
1. Password Variable: `GIT_HUB_PASSWORD`
1. Username Variable: `GITHUB_USERNAME`
1. Password Variable: `GITHUB_PASSWORD`
1. Credentials: **Specific credentials**
1. Select the GITHUB_SUGARCRM_UNIT_TESTS credentials.
1. In the **Bindings** section, select **Add** > **Username and password (separated)**. Then input the following:
Expand Down Expand Up @@ -338,7 +338,7 @@ text(s) or file(s)** option.
bash -ex RunPackUnitTestsAndBuildProfMPackage.sh $SUGAR_WORKSPACE_PATH
bash SetupEnvAndRunPHPUnitTests.sh $DEV_COMMUNITY_USERNAME $DEV_COMMUNITY_PASSWORD $SUGAR_VERSION $SUGAR_EDITION $GIT_HUB_USERNAME $GIT_HUB_PASSWORD $SUGAR_DOCKER_DIRECTORY $SUGAR_SOURCE_ZIPS_DIRECTORY
bash SetupEnvAndRunPHPUnitTests.sh $DEV_COMMUNITY_USERNAME $DEV_COMMUNITY_PASSWORD $SUGAR_VERSION $SUGAR_EDITION $GITHUB_USERNAME $GITHUB_PASSWORD $SUGAR_DOCKER_DIRECTORY $SUGAR_SOURCE_ZIPS_DIRECTORY
```
Be sure to update the variables appropriately.
1. In the **Post-build Actions** section, click **Add post-build action** and select **Archive the artifacts**.
Expand Down
Binary file modified images/travisenvvars.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 2 additions & 3 deletions scripts/GetCopyOfSugar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,8 @@ cd $sugarDirectory
# Delete the cookie jar file if it exists
rm -f $cookieFile

# Create the cookie file and set the file permissions (required for Travis CI)
#sudo touch $cookieFile

# Set the file permissions for when sudo is required and is not required
chmod -R 777 .
sudo chmod -R 777 .


Expand Down
13 changes: 5 additions & 8 deletions scripts/InstallSugarAndProfM.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,21 @@ cp cliModuleInstall.php $sugarDirectory/cliModuleInstall.php
# Copy the Professor M module loadable package to the Sugar directory
cp ../package/releases/sugarcrm-ProfessorM-*-standard.zip $sugarDirectory/sugarcrm-ProfessorM-standard.zip

# Update the permissions for the Sugar directory
sudo chmod -R 777 $sugarDirectory -q

# Update the permissions for the Sugar directory for when sudo is required and is not required
chmod -R 777 $sugarDirectory
sudo chmod -R 777 $sugarDirectory

######################################################################
# Install Sugar
######################################################################

echo "Installing Sugar..."
# Install Sugar using the configs in config_si.php
docker exec sugar-web1 php cliSilentInstall.php
echo "Finished installing Sugar."

docker exec sugar-web1 bash -c "php cliSilentInstall.php"

######################################################################
# Install the Professor M Module Loadable Package
######################################################################

echo "Installing the Professor M module loadable package..."
docker exec sugar-web1 php cliModuleInstall.php -i . -z sugarcrm-ProfessorM-standard.zip
echo "Finished installing the Professor M module loadable package."
docker exec sugar-web1 bash -c "php cliModuleInstall.php -i . -z sugarcrm-ProfessorM-standard.zip"
2 changes: 2 additions & 0 deletions scripts/SetupEnvAndRunPHPUnitTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ sugarSourceZipsDirectory=$8
# Setup
######################################################################

# Set permission for when sudo is required and is not required
chmod -R 777 .
sudo chmod -R 777 .

mkdir workspace
Expand Down
3 changes: 2 additions & 1 deletion scripts/SetupSugarPHPUnitTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,5 @@ perl -0777 -i -pe "s#,\n *{\n *\"type\"\: \"composer\",\n *\"url\"\: \"https:\/\
rm $sugarDirectory/composer.lock

# Install the dependencies
docker exec sugar-web1 composer install
#docker exec sugar-web1 composer install
docker exec sugar-web1 bash -c "composer install"
1 change: 0 additions & 1 deletion scripts/cliModuleInstall.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env php

<?php

# Script taken from https://github.com/sugarcrm/IPRestrictionManager/blob/master/.travis/cliModuleInstall.php
Expand Down
26 changes: 0 additions & 26 deletions scripts/config_override.php
Original file line number Diff line number Diff line change
@@ -1,29 +1,3 @@
<?php
$sugar_config['external_cache_disabled'] = false;
$sugar_config['external_cache_disabled_redis'] = false;
$sugar_config['external_cache_force_backend'] = 'redis';
$sugar_config['external_cache']['redis']['host'] = 'sugar-redis';
$sugar_config['external_cache_disabled_wincache'] = true;
$sugar_config['external_cache_disabled_db'] = true;
$sugar_config['external_cache_disabled_smash'] = true;
$sugar_config['external_cache_disabled_apc'] = true;
$sugar_config['external_cache_disabled_zend'] = true;
$sugar_config['external_cache_disabled_memcache'] = true;
$sugar_config['external_cache_disabled_memcached'] = true;
$sugar_config['cache_expire_timeout'] = 600; // default: 5 minutes, increased to 10 minutes
$sugar_config['disable_vcr'] = true; // bwc module only
$sugar_config['disable_count_query'] = true; // bwc module only
$sugar_config['save_query'] = 'populate_only'; // bwc module only
$sugar_config['collapse_subpanels'] = true; // 7.6.0.0+
$sugar_config['hide_subpanels'] = true; // bwc module only
$sugar_config['hide_subpanels_on_login'] = true; // bwc module only
$sugar_config['logger']['level'] = 'fatal';
$sugar_config['logger']['file']['maxSize'] = '10MB';
$sugar_config['developerMode'] = false;
$sugar_config['dump_slow_queries'] = false;
$sugar_config['slow_query_time_msec'] = '1000';
$sugar_config['perfProfile']['TeamSecurity']['default']['teamset_prefetch'] = true;
$sugar_config['perfProfile']['TeamSecurity']['default']['teamset_prefetch_max'] = 500;
$sugar_config['perfProfile']['TeamSecurity']['default']['where_condition'] = true;
$sugar_config['import_max_records_total_limit'] = '2000';
$sugar_config['verify_client_ip'] = false;
35 changes: 15 additions & 20 deletions scripts/config_si.php
Original file line number Diff line number Diff line change
@@ -1,36 +1,31 @@
<?php
$sugar_config_si = array (
'setup_db_host_name' => 'sugar-mysql',
'setup_db_database_name' => 'sugar',
'setup_db_drop_tables' => 1,
'setup_db_create_database' => 1,
'demoData' => 0,
'developerMode' => 1,
'setup_site_admin_user_name' => 'admin',
'setup_site_admin_password' => 'sugarcrm',
'setup_db_admin_user_name' => 'root',
'setup_db_admin_password' => 'root',
'setup_db_type' => 'mysql',
'setup_site_url' => 'http://sugar-web1/sugar',
'setup_system_name' => 'SugarCRM',
'default_currency_iso4217' => 'USD',
'default_currency_name' => 'US Dollars',
'default_currency_significant_digits' => '2',
'default_currency_symbol' => '$',
'default_date_format' => 'Y-m-d',
'default_time_format' => 'H:i',
'default_decimal_seperator' => '.',
'default_export_charset' => 'ISO-8859-1',
'default_language' => 'en_us',
'default_locale_name_format' => 's f l',
'default_number_grouping_seperator' => ',',
'default_time_format' => 'H:i',
'demoData' => 0,
'export_delimiter' => ',',
'setup_db_admin_user_name' => 'root',
'setup_db_admin_password' => 'root',
'setup_db_create_database' => 1,
'setup_db_create_sugarsales_user' => 0,
'setup_db_database_name' => 'sugar',
'setup_db_drop_tables' => 1,
'setup_db_host_name' => 'sugar-mysql',
'setup_db_type' => 'mysql',
'setup_fts_type' => 'Elastic',
'setup_fts_host' => 'sugar-elasticsearch',
'setup_fts_port' => '9200',
'setup_fts_type' => 'Elastic',
'setup_license_key_expire_date' => '2017-03-18',
'setup_license_key_oc_licences' => 0,
'setup_license_key_users' => 10,
'setup_num_lic_oc' => 0,
'setup_site_admin_password' => 'sugarcrm',
'setup_site_admin_user_name' => 'admin',
'setup_site_sugarbeet_automatic_checks' => false,
'setup_site_url' => 'http://sugar-web1/sugar',
'setup_system_name' => 'Sugar',
);

0 comments on commit 7f9c771

Please sign in to comment.