Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1de36fb

Browse files
authored
Add testing of all PRs on Windows (via Appveyor) (#3931)
1 parent d129e2d commit 1de36fb

26 files changed

+225
-158
lines changed

.scenarios.lock/php5/composer.lock

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

appveyor.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
build: false
2+
shallow_clone: false
3+
platform: 'x86'
4+
clone_folder: C:\projects\work
5+
branches:
6+
only:
7+
- appveyor
8+
except:
9+
- gh-pages
10+
11+
## Cache composer bits
12+
cache:
13+
- '%LOCALAPPDATA%\Composer\files -> composer.lock'
14+
15+
services:
16+
- mysql
17+
18+
init:
19+
#https://github.com/composer/composer/blob/master/appveyor.yml
20+
#- SET ANSICON=121x90 (121x90)
21+
22+
# Inspired by https://github.com/Codeception/base/blob/master/appveyor.yml and https://github.com/phpmd/phpmd/blob/master/appveyor.yml
23+
install:
24+
- ps: Set-Service wuauserv -StartupType Manual
25+
- cinst -y curl
26+
- SET PATH=C:\Program Files\curl;%PATH%
27+
#which is only needed by the test suite.
28+
- cinst -y which
29+
- SET PATH=C:\Program Files\which;%PATH%
30+
- git clone -q https://github.com/acquia/DevDesktopCommon.git #For tar, cksum, ...
31+
- SET PATH=%APPVEYOR_BUILD_FOLDER%/DevDesktopCommon/bintools-win/msys/bin;%PATH%
32+
- SET PATH=C:\Program Files\MySql\MySQL Server 5.7\bin\;%PATH%
33+
#Install PHP per https://blog.wyrihaximus.net/2016/11/running-php-unit-tests-on-windows-using-appveyor-and-chocolatey/
34+
- ps: appveyor-retry cinst --ignore-checksums -y php --version ((choco search php --exact --all-versions -r | select-string -pattern $Env:php_ver_target | Select-Object -first 1) -replace '[php|]','')
35+
- cd c:\tools\php71
36+
- copy php.ini-production php.ini
37+
38+
- echo extension_dir=ext >> php.ini
39+
- echo extension=php_openssl.dll >> php.ini
40+
- echo date.timezone="UTC" >> php.ini
41+
- echo variables_order="EGPCS" >> php.ini #May be unneeded.
42+
- echo mbstring.http_input=pass >> php.ini
43+
- echo mbstring.http_output=pass >> php.ini
44+
- echo sendmail_path=nul >> php.ini
45+
- echo extension=php_mbstring.dll >> php.ini
46+
- echo extension=php_curl.dll >> php.ini
47+
- echo extension=php_pdo_mysql.dll >> php.ini
48+
- echo extension=php_pdo_pgsql.dll >> php.ini
49+
- echo extension=php_pdo_sqlite.dll >> php.ini
50+
- echo extension=php_pgsql.dll >> php.ini
51+
- echo extension=php_gd2.dll >> php.ini
52+
- SET PATH=C:\tools\php71;%PATH%
53+
#Install Composer
54+
- cd %APPVEYOR_BUILD_FOLDER%
55+
#- appveyor DownloadFile https://getcomposer.org/composer.phar
56+
- php -r "readfile('http://getcomposer.org/installer');" | php
57+
#Install dependencies via Composer
58+
- php composer.phar install --prefer-dist -n
59+
- SET PATH=%APPVEYOR_BUILD_FOLDER%;%APPVEYOR_BUILD_FOLDER%/vendor/bin;%PATH%
60+
# Uncomment this and on_finish line below to enable RDP into build machine https://www.appveyor.com/docs/how-to/rdp-to-build-worker/
61+
# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
62+
63+
test_script:
64+
- vendor/bin/phpunit --colors=always --configuration tests --testsuite functional --debug
65+
- vendor/bin/phpunit --colors=always --configuration tests --testsuite integration --debug
66+
- vendor/bin/phpunit --colors=always --configuration tests --testsuite unit --debug
67+
68+
on_finish:
69+
# Uncomment this and above line to enable RDP into build machine https://www.appveyor.com/docs/how-to/rdp-to-build-worker/
70+
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
71+
72+
# environment variables
73+
environment:
74+
global:
75+
php_ver_target: 7.1
76+
UNISH_DB_URL: "mysql://root:Password12!@localhost"
77+
APPVEYOR_RDP_PASSWORD: un1sh@Windows

composer.lock

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dr.bat renamed to drush.bat

File renamed without changes.

includes/batch.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ function _drush_backend_batch_process($command = 'batch-process', $args, $option
149149

150150
while (!$finished) {
151151
$process = Drush::drush(Drush::aliasManager()->getSelf(), $command, $args);
152-
// Suppress printing stdout since we return a JSON array to the caller there.
152+
// Suppress printing stdout since a JSON array is returned to us here.
153153
$process->run($process->showRealtime()->hideStdout());
154154
$result = $process->getOutputAsJson();
155155
$finished = !$process->isSuccessful() || (isset($result['drush_batch_process_finished']) && $result['drush_batch_process_finished'] === TRUE);

includes/filesystem.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ function drush_tempnam($pattern, $tmp_dir = NULL, $suffix = '') {
277277
if ($tmp_dir == NULL) {
278278
$tmp_dir = Drush::config()->tmp();
279279
}
280-
$tmp_file = tempnam($tmp_dir, $pattern);
280+
$tmp_file = Path::canonicalize(tempnam($tmp_dir, $pattern));
281281
drush_register_file_for_deletion($tmp_file);
282282
$tmp_file_with_suffix = $tmp_file . $suffix;
283283
drush_register_file_for_deletion($tmp_file_with_suffix);

src/Commands/core/SshCommands.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,9 @@ public function ssh(array $args, $options = ['cd' => self::REQ, 'tty' => false])
4848

4949
$process = $this->processManager()->siteProcess($alias, $args);
5050
$process->setTty($options['tty']);
51-
if ($options['cd']) {
52-
$process->setWorkingDirectory($options['cd']);
53-
} else {
54-
$process->chdirToSiteRoot();
55-
}
51+
// The transport handles the chdir during processArgs().
52+
$fallback = $alias->hasRoot() ? $alias->root() : null;
53+
$process->setWorkingDirectory($options['cd'] ?: $fallback);
5654
$process->mustRun($process->showRealtime());
5755
}
5856
}

src/Commands/generate/GenerateCommands.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Drush\Commands\generate;
44

5+
use Consolidation\SiteProcess\Util\Escape;
56
use DrupalCodeGenerator\GeneratorDiscovery;
67
use DrupalCodeGenerator\Helper\Dumper;
78
use DrupalCodeGenerator\Helper\Renderer;
@@ -44,7 +45,6 @@ class GenerateCommands extends DrushCommands
4445
*/
4546
public function generate($generator = '', $options = ['answers' => self::REQ, 'directory' => self::REQ])
4647
{
47-
4848
// Disallow default Symfony console commands.
4949
if ($generator == 'help' || $generator == 'list') {
5050
$generator = null;
@@ -68,7 +68,7 @@ public function generate($generator = '', $options = ['answers' => self::REQ, 'd
6868
// Create an isolated input.
6969
$argv = [
7070
$generator,
71-
'--answers=' . escapeshellarg($options['answers']),
71+
'--answers=' . Escape::shellArg($options['answers'], 'LINUX'),
7272
'--directory=' . $options['directory']
7373
];
7474
if ($options['ansi']) {

src/Config/ConfigLocator.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Drush\Config\Loader\YamlConfigLoader;
66
use Consolidation\Config\Loader\ConfigProcessor;
77
use Consolidation\Config\Util\EnvConfig;
8+
use Webmozart\PathUtil\Path;
89

910
/**
1011
* Locate Drush configuration files and load them into the configuration
@@ -340,7 +341,7 @@ protected function addConfigFiles(ConfigProcessor $processor, ConfigLoaderInterf
340341
{
341342
foreach ($configFiles as $configFile) {
342343
$processor->extend($loader->load($configFile));
343-
$this->configFilePaths[] = $configFile;
344+
$this->configFilePaths[] = Path::canonicalize($configFile);
344345
}
345346
}
346347

@@ -401,7 +402,7 @@ public function getSiteAliasPaths($paths, Environment $environment)
401402
$base_dirs = array_filter(array_merge($this->siteRoots, [$this->composerRoot]));
402403
$site_local_paths = array_map(
403404
function ($item) {
404-
return "$item/drush/sites";
405+
return Path::join($item, '/drush/sites');
405406
},
406407
$base_dirs
407408
);

src/Config/Environment.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function __construct($homeDir, $cwd, $autoloadFile)
3737
$this->originalCwd = Path::canonicalize($cwd);
3838
$this->etcPrefix = '';
3939
$this->sharePrefix = '';
40-
$this->drushBasePath = dirname(dirname(__DIR__));
40+
$this->drushBasePath = Path::canonicalize(dirname(dirname(__DIR__)));
4141
$this->vendorDir = FsUtils::realpath(dirname($autoloadFile));
4242
}
4343

@@ -395,7 +395,7 @@ protected static function systemPathPrefix($override = '', $defaultPrefix = '')
395395
if ($override) {
396396
return $override;
397397
}
398-
return static::isWindows() ? getenv('ALLUSERSPROFILE') . '/Drush' : $defaultPrefix;
398+
return static::isWindows() ? Path::join(getenv('ALLUSERSPROFILE'), 'Drush') : $defaultPrefix;
399399
}
400400

401401
/**
@@ -461,7 +461,7 @@ public function calculateColumns()
461461
$columns = $matches[1];
462462
}
463463

464-
// If stty fails and Drush us running on Windows are we trying with mode con.
464+
// If stty fails and Drush is running on Windows are we trying with mode con.
465465
if (($columns_status || !$matched) && static::isWindows()) {
466466
$columns_output = [];
467467
exec('mode con', $columns_output, $columns_status);

0 commit comments

Comments
 (0)