Skip to content

Commit

Permalink
Merge pull request #378 from goaop/feature/app-veyor-integration
Browse files Browse the repository at this point in the history
Enable AppVeyor integration for Windows tests
  • Loading branch information
lisachenko committed Jan 5, 2018
2 parents 1428287 + 43c763d commit 152abbf
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 13 deletions.
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,3 @@ script:
after_script:
- sh .travis.coverage.sh

matrix:
allow_failures:
- php: 7.2
64 changes: 64 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
build: false
shallow_clone: true
platform:
- x64
clone_folder: c:\projects\goaop

## Cache composer, chocolatey and php bits
cache:
- '%LOCALAPPDATA%\Composer\files -> composer.lock'
- composer.phar
# Cache chocolatey packages
- C:\ProgramData\chocolatey\bin -> .appveyor.yml
- C:\ProgramData\chocolatey\lib -> .appveyor.yml
# Cache php install
- c:\tools\php -> .appveyor.yml

## Build matrix for lowest and highest possible targets
environment:
matrix:
- dependencies: current
php_ver_target: 5.6
- dependencies: current
php_ver_target: 7.2
#- dependencies: highest
# php_ver_target: 7.0

## Set up environment variables
init:
- SET PATH=C:\Program Files\OpenSSL;c:\tools\php;%PATH%
- SET COMPOSER_NO_INTERACTION=1
- SET PHP=1 # This var is connected to PHP install cache
- SET ANSICON=121x90 (121x90)

## Install PHP and composer, and run the appropriate composer command
install:
- IF EXIST c:\tools\php (SET PHP=0) # Checks for the PHP install being cached
- ps: appveyor-retry cinst --params '""/InstallDir:C:\tools\php""' --ignore-checksums -y php --version ((choco search php --exact --all-versions -r | select-string -pattern $env:php_ver_target | sort { [version]($_ -split '\|' | select -last 1) } -Descending | Select-Object -first 1) -replace '[php|]','')
- cd c:\tools\php
- IF %PHP%==1 copy php.ini-production php.ini /Y
- IF %PHP%==1 echo date.timezone="UTC" >> php.ini
- IF %PHP%==1 echo extension_dir=ext >> php.ini
- IF %PHP%==1 echo extension=php_openssl.dll >> php.ini
- IF %PHP%==1 echo extension=php_mbstring.dll >> php.ini
- IF %PHP%==1 echo extension=php_fileinfo.dll >> php.ini
- IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat
- appveyor-retry appveyor DownloadFile https://getcomposer.org/composer.phar
- cd c:\projects\goaop
- IF %dependencies%==lowest appveyor-retry composer update --prefer-lowest --no-progress --profile -n
- IF %dependencies%==current appveyor-retry composer install --no-progress --profile
- IF %dependencies%==highest appveyor-retry composer update --no-progress --profile -n
- composer show

test_script:
- cd c:\projects\goaop
- vendor/bin/phpunit --verbose --coverage-text --coverage-clover=clover.xml --colors

on_finish:
# Upload test results via rest-api
- ps: |
$wc = New-Object 'System.Net.WebClient'
Get-ChildItem . -Name -Recurse 'clover.xml' |
Foreach-Object {
$wc.UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $_))
}
2 changes: 1 addition & 1 deletion src/Instrument/FileSystem/Enumerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function enumerate()
$iterator = new \RecursiveIteratorIterator(
new \RecursiveDirectoryIterator(
$this->rootDirectory,
\FilesystemIterator::SKIP_DOTS
\FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS
)
);

Expand Down
3 changes: 1 addition & 2 deletions src/Instrument/Transformer/WeavingTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,7 @@ private function saveProxyToCache($class, $child)

$cacheDir = $this->cachePathManager->getCacheDir() . $cacheDirSuffix;
$relativePath = str_replace($this->options['appDir'] . DIRECTORY_SEPARATOR, '', $class->getFileName());
$classSuffix = str_replace('\\', DIRECTORY_SEPARATOR, $class->getName()) . '.php';
$proxyRelativePath = $relativePath . DIRECTORY_SEPARATOR . $classSuffix;
$proxyRelativePath = str_replace('\\', '/', $relativePath . '/' . $class->getName() . '.php');
$proxyFileName = $cacheDir . $proxyRelativePath;
$dirname = dirname($proxyFileName);
if (!file_exists($dirname)) {
Expand Down
18 changes: 11 additions & 7 deletions tests/Go/Functional/BaseFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
namespace Go\Functional;

use Go\Core\AspectContainer;
use Go\Instrument\PathResolver;
use Go\PhpUnit\ClassIsNotWovenConstraint;
use Go\PhpUnit\ClassWovenConstraint;
use Go\PhpUnit\ClassAdvisorIdentifier;
use Go\PhpUnit\ClassMemberWovenConstraint;
use Go\PhpUnit\ClassMemberNotWovenConstraint;
use PHPUnit_Framework_TestCase as TestCase;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Process\PhpExecutableFinder;
use Symfony\Component\Process\Process;

/**
Expand Down Expand Up @@ -56,9 +58,10 @@ public function tearDown()
protected function clearCache()
{
$filesystem = new Filesystem();

if ($filesystem->exists($this->configuration['cacheDir'])) {
$filesystem->remove($this->configuration['cacheDir']);
// We need to normalize path to prevent Windows 260-length filename trouble
$absoluteCacheDir = PathResolver::realpath($this->configuration['cacheDir']);
if ($filesystem->exists($absoluteCacheDir)) {
$filesystem->remove($absoluteCacheDir);
}
}

Expand Down Expand Up @@ -114,16 +117,17 @@ protected function loadConfiguration()
*/
protected function execute($command, $args = null, $expectSuccess = true, $expectedExitCode = null)
{
$commandStatement = sprintf('GO_AOP_CONFIGURATION=%s php %s %s %s %s',
$this->getConfigurationName(),
$phpExecutable = (new PhpExecutableFinder())->find();
$commandStatement = sprintf('%s %s --no-ansi %s %s %s',
$phpExecutable,
$this->configuration['console'],
$command,
$this->configuration['frontController'],
(null !== $args) ? $args : ''
);

$process = new Process($commandStatement);

$process = new Process($commandStatement, null, ['GO_AOP_CONFIGURATION' => $this->getConfigurationName()]);
$process->inheritEnvironmentVariables();
$process->run();

if ($expectSuccess) {
Expand Down

0 comments on commit 152abbf

Please sign in to comment.