Skip to content

Commit 1c71095

Browse files
committed
Try fixing e2e issue
1 parent 638bbff commit 1c71095

2 files changed

Lines changed: 42 additions & 12 deletions

File tree

.github/workflows/grumphp.yml

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,20 @@ jobs:
2929
php -v
3030
php -m
3131
composer --version
32+
- name: Print env
33+
run: |
34+
printenv
35+
- name: Debug global composer.json
36+
run: |
37+
ls -la /Users/runner/.composer || true
38+
if [ -f /Users/runner/.composer/composer.json ]; then
39+
cat /Users/runner/.composer/composer.json
40+
else
41+
echo "No global composer.json present"
42+
fi
43+
- name: Remove global composer.json if present
44+
run: |
45+
rm -f /Users/runner/.composer/composer.json
3246
- name: Set env vars for latest PHP version
3347
if: matrix.php-versions == '8.5'
3448
run: |
@@ -59,13 +73,13 @@ jobs:
5973
git config --global user.email "you@example.com"
6074
git config --global user.name "Your Name"
6175
git config --global protocol.file.allow always
62-
- name: Run the tests on Windows
63-
if: runner.os == 'Windows'
64-
run: php vendor/bin/grumphp run --no-interaction --testsuite=windows
65-
continue-on-error: ${{ matrix.php-versions == '8.5' }} # Psalm is not there yet
66-
- name: Run the tests on unix
67-
if: runner.os != 'Windows'
68-
run: php vendor/bin/grumphp run --no-interaction --testsuite=ci
69-
continue-on-error: ${{ matrix.php-versions == '8.5' }} # Psalm is not there yet
76+
# - name: Run the tests on Windows
77+
# if: runner.os == 'Windows'
78+
# run: php vendor/bin/grumphp run --no-interaction --testsuite=windows
79+
# continue-on-error: ${{ matrix.php-versions == '8.5' }} # Psalm is not there yet
80+
# - name: Run the tests on unix
81+
# if: runner.os != 'Windows'
82+
# run: php vendor/bin/grumphp run --no-interaction --testsuite=ci
83+
# continue-on-error: ${{ matrix.php-versions == '8.5' }} # Psalm is not there yet
7084
- name: Run paratest outside of grumphp
7185
run: php ./vendor/bin/paratest --testsuite=E2E --functional --verbose

test/E2E/AbstractE2ETestCase.php

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ protected function initializeComposer(string $path): string
101101
'init',
102102
'--name=grumphp/testsuite'.$this->hash,
103103
'--type=library',
104+
'--author=GrumPHP Test Suite',
104105
'--require-dev=phpro/grumphp:'.$this->detectCurrentGrumphpGitBranchForComposerWithFallback(),
105106
'--require-dev=phpunit/phpunit:*',
106107
'--repository='.json_encode([
@@ -115,10 +116,17 @@ protected function initializeComposer(string $path): string
115116
$path
116117
);
117118

118-
$this->runCommand('initialize composer', $process);
119-
120119
$composerFile = $path.$this->useCorrectDirectorySeparator('/composer.json');
121120

121+
try {
122+
$this->runCommand('initialize composer', $process);
123+
} catch (\Exception $e) {
124+
throw new Exception('Could not initialize composer in '.$composerFile.'!' . PHP_EOL . PHP_EOL . file_get_contents($composerFile), 0, $e);
125+
}
126+
127+
echo file_get_contents($composerFile);
128+
129+
122130
$this->mergeComposerConfig($composerFile, [
123131
'autoload' => [
124132
'psr-4' => [
@@ -132,6 +140,8 @@ protected function initializeComposer(string $path): string
132140
],
133141
]);
134142

143+
echo file_get_contents($composerFile);
144+
135145
return $composerFile;
136146
}
137147

@@ -172,7 +182,7 @@ protected function mergeComposerConfig(string $composerFile, array $config, $rec
172182
$this->assertFileExists($composerFile);
173183
$source = json_decode(file_get_contents($composerFile), true);
174184
$newSource = $recursive ? array_merge_recursive($source, $config) : array_merge($source, $config);
175-
$flags = JSON_FORCE_OBJECT+JSON_PRETTY_PRINT+JSON_UNESCAPED_SLASHES;
185+
$flags = JSON_PRETTY_PRINT+JSON_UNESCAPED_SLASHES;
176186
$this->dumpFile($composerFile, json_encode($newSource, $flags));
177187
}
178188

@@ -373,7 +383,13 @@ protected function installComposer(string $path, array $arguments = [])
373383
$path
374384
);
375385

376-
$this->runCommand('install composer', $process);
386+
$composerFile = $path.$this->useCorrectDirectorySeparator('/composer.json');
387+
try {
388+
$this->runCommand('install composer', $process);
389+
} catch (\Exception $e) {
390+
throw new \Exception('Could not initialize composer in '.$composerFile.'!' . PHP_EOL . PHP_EOL . file_get_contents($composerFile), 0, $e);
391+
}
392+
377393
}
378394

379395
protected function commitAll(?string $gitPath = null)

0 commit comments

Comments
 (0)