Cleanup CI scripts
This commit is contained in:
parent
262525b95b
commit
09e51d6b42
@ -49,9 +49,8 @@ install:
|
|||||||
- git config --global user.email ""
|
- git config --global user.email ""
|
||||||
- git config --global user.name "Symfony"
|
- git config --global user.name "Symfony"
|
||||||
- FOR /F "tokens=* USEBACKQ" %%F IN (`bash -c "grep branch-version composer.json | grep -o '[0-9.x]*'"`) DO (SET SYMFONY_VERSION=%%F)
|
- FOR /F "tokens=* USEBACKQ" %%F IN (`bash -c "grep branch-version composer.json | grep -o '[0-9.x]*'"`) DO (SET SYMFONY_VERSION=%%F)
|
||||||
- php .github/build-packages.php "HEAD^" %SYMFONY_VERSION% src\Symfony\Bridge\PhpUnit src\Symfony\Contracts
|
- php .github/build-packages.php HEAD^ %SYMFONY_VERSION% src\Symfony\Bridge\PhpUnit
|
||||||
- SET "SYMFONY_REQUIRE=>=%SYMFONY_VERSION%"
|
- SET "SYMFONY_REQUIRE=>=%SYMFONY_VERSION%"
|
||||||
- SET COMPOSER_ROOT_VERSION=%SYMFONY_VERSION%.x-dev
|
|
||||||
- php composer.phar update --no-progress --ansi
|
- php composer.phar update --no-progress --ansi
|
||||||
- php phpunit install
|
- php phpunit install
|
||||||
|
|
||||||
|
23
.github/build-packages.php
vendored
23
.github/build-packages.php
vendored
@ -6,17 +6,12 @@ if (3 > $_SERVER['argc']) {
|
|||||||
}
|
}
|
||||||
chdir(dirname(__DIR__));
|
chdir(dirname(__DIR__));
|
||||||
|
|
||||||
$json = ltrim(file_get_contents('composer.json'));
|
|
||||||
if ($json !== $package = preg_replace('/\n "repositories": \[\n.*?\n \],/s', '', $json)) {
|
|
||||||
file_put_contents('composer.json', $package);
|
|
||||||
}
|
|
||||||
|
|
||||||
$dirs = $_SERVER['argv'];
|
$dirs = $_SERVER['argv'];
|
||||||
array_shift($dirs);
|
array_shift($dirs);
|
||||||
$mergeBase = trim(shell_exec(sprintf('git merge-base "%s" HEAD', array_shift($dirs))));
|
$mergeBase = trim(shell_exec(sprintf('git merge-base "%s" HEAD', array_shift($dirs))));
|
||||||
$version = array_shift($dirs);
|
$version = array_shift($dirs);
|
||||||
|
|
||||||
$packages = array();
|
$packages = [];
|
||||||
$flags = JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;
|
$flags = JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;
|
||||||
$preferredInstall = json_decode(file_get_contents(__DIR__.'/composer-config.json'), true)['config']['preferred-install'];
|
$preferredInstall = json_decode(file_get_contents(__DIR__.'/composer-config.json'), true)['config']['preferred-install'];
|
||||||
|
|
||||||
@ -36,12 +31,12 @@ foreach ($dirs as $k => $dir) {
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$package->repositories = array(array(
|
$package->repositories = [[
|
||||||
'type' => 'composer',
|
'type' => 'composer',
|
||||||
'url' => 'file://'.str_replace(DIRECTORY_SEPARATOR, '/', dirname(__DIR__)).'/',
|
'url' => 'file://'.str_replace(DIRECTORY_SEPARATOR, '/', dirname(__DIR__)).'/',
|
||||||
));
|
]];
|
||||||
if (false === strpos($json, "\n \"repositories\": [\n")) {
|
if (false === strpos($json, "\n \"repositories\": [\n")) {
|
||||||
$json = rtrim(json_encode(array('repositories' => $package->repositories), $flags), "\n}").','.substr($json, 1);
|
$json = rtrim(json_encode(['repositories' => $package->repositories], $flags), "\n}").','.substr($json, 1);
|
||||||
file_put_contents($dir.'/composer.json', $json);
|
file_put_contents($dir.'/composer.json', $json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +56,7 @@ foreach ($dirs as $k => $dir) {
|
|||||||
$versions = json_decode($versions)->packages->{$package->name};
|
$versions = json_decode($versions)->packages->{$package->name};
|
||||||
|
|
||||||
foreach ($versions as $v => $package) {
|
foreach ($versions as $v => $package) {
|
||||||
$packages[$package->name] += array($v => $package);
|
$packages[$package->name] += [$v => $package];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,10 +69,12 @@ if ($dirs) {
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$package->repositories = array(array(
|
$package->repositories[] = [
|
||||||
'type' => 'composer',
|
'type' => 'composer',
|
||||||
'url' => 'file://'.str_replace(DIRECTORY_SEPARATOR, '/', dirname(__DIR__)).'/',
|
'url' => 'file://'.str_replace(DIRECTORY_SEPARATOR, '/', dirname(__DIR__)).'/',
|
||||||
));
|
];
|
||||||
$json = rtrim(json_encode(array('repositories' => $package->repositories), $flags), "\n}").','.substr($json, 1);
|
|
||||||
|
$json = preg_replace('/\n "repositories": \[\n.*?\n \],/s', '', $json);
|
||||||
|
$json = rtrim(json_encode(['repositories' => $package->repositories], $flags), "\n}").','.substr($json, 1);
|
||||||
file_put_contents('composer.json', $json);
|
file_put_contents('composer.json', $json);
|
||||||
}
|
}
|
||||||
|
20
.github/rm-invalid-lowest-lock-files.php
vendored
20
.github/rm-invalid-lowest-lock-files.php
vendored
@ -11,7 +11,7 @@ $dirs = $_SERVER['argv'];
|
|||||||
|
|
||||||
function getRelevantContent(array $composerJson)
|
function getRelevantContent(array $composerJson)
|
||||||
{
|
{
|
||||||
$relevantKeys = array(
|
$relevantKeys = [
|
||||||
'name',
|
'name',
|
||||||
'require',
|
'require',
|
||||||
'require-dev',
|
'require-dev',
|
||||||
@ -22,9 +22,9 @@ function getRelevantContent(array $composerJson)
|
|||||||
'prefer-stable',
|
'prefer-stable',
|
||||||
'repositories',
|
'repositories',
|
||||||
'extra',
|
'extra',
|
||||||
);
|
];
|
||||||
|
|
||||||
$relevantContent = array();
|
$relevantContent = [];
|
||||||
|
|
||||||
foreach (array_intersect($relevantKeys, array_keys($composerJson)) as $key) {
|
foreach (array_intersect($relevantKeys, array_keys($composerJson)) as $key) {
|
||||||
$relevantContent[$key] = $composerJson[$key];
|
$relevantContent[$key] = $composerJson[$key];
|
||||||
@ -44,7 +44,7 @@ function getContentHash(array $composerJson)
|
|||||||
return md5(json_encode($relevantContent));
|
return md5(json_encode($relevantContent));
|
||||||
}
|
}
|
||||||
|
|
||||||
$composerJsons = array();
|
$composerJsons = [];
|
||||||
|
|
||||||
foreach ($dirs as $dir) {
|
foreach ($dirs as $dir) {
|
||||||
if (!file_exists($dir.'/composer.lock') || !$composerLock = @json_decode(file_get_contents($dir.'/composer.lock'), true)) {
|
if (!file_exists($dir.'/composer.lock') || !$composerLock = @json_decode(file_get_contents($dir.'/composer.lock'), true)) {
|
||||||
@ -61,11 +61,11 @@ foreach ($dirs as $dir) {
|
|||||||
@unlink($dir.'/composer.lock');
|
@unlink($dir.'/composer.lock');
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$composerLock += array('packages' => array(), 'packages-dev' => array());
|
$composerLock += ['packages' => [], 'packages-dev' => []];
|
||||||
$composerJsons[$composerJson['name']] = array($dir, $composerLock['packages'] + $composerLock['packages-dev'], getRelevantContent($composerJson));
|
$composerJsons[$composerJson['name']] = [$dir, $composerLock['packages'] + $composerLock['packages-dev'], getRelevantContent($composerJson)];
|
||||||
}
|
}
|
||||||
|
|
||||||
$referencedCommits = array();
|
$referencedCommits = [];
|
||||||
|
|
||||||
foreach ($composerJsons as list($dir, $lockedPackages)) {
|
foreach ($composerJsons as list($dir, $lockedPackages)) {
|
||||||
foreach ($lockedPackages as $lockedJson) {
|
foreach ($lockedPackages as $lockedJson) {
|
||||||
@ -85,7 +85,7 @@ foreach ($composerJsons as list($dir, $lockedPackages)) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (array('minimum-stability', 'prefer-stable') as $key) {
|
foreach (['minimum-stability', 'prefer-stable'] as $key) {
|
||||||
if (array_key_exists($key, $composerJsons[$name][2])) {
|
if (array_key_exists($key, $composerJsons[$name][2])) {
|
||||||
$lockedJson[$key] = $composerJsons[$name][2][$key];
|
$lockedJson[$key] = $composerJsons[$name][2][$key];
|
||||||
}
|
}
|
||||||
@ -116,10 +116,10 @@ $sh = curl_share_init();
|
|||||||
curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE);
|
curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE);
|
||||||
curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS);
|
curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS);
|
||||||
curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_SSL_SESSION);
|
curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_SSL_SESSION);
|
||||||
$chs = array();
|
$chs = [];
|
||||||
|
|
||||||
foreach ($referencedCommits as $name => $dirsByCommit) {
|
foreach ($referencedCommits as $name => $dirsByCommit) {
|
||||||
$chs[] = $ch = array(curl_init(), fopen($_SERVER['HOME'].'/.cache/composer/repo/https---repo.packagist.org/provider-'.strtr($name, '/', '$').'.json', 'wb'));
|
$chs[] = $ch = [curl_init(), fopen($_SERVER['HOME'].'/.cache/composer/repo/https---repo.packagist.org/provider-'.strtr($name, '/', '$').'.json', 'wb')];
|
||||||
curl_setopt($ch[0], CURLOPT_URL, 'https://repo.packagist.org/p/'.$name.'.json');
|
curl_setopt($ch[0], CURLOPT_URL, 'https://repo.packagist.org/p/'.$name.'.json');
|
||||||
curl_setopt($ch[0], CURLOPT_FILE, $ch[1]);
|
curl_setopt($ch[0], CURLOPT_FILE, $ch[1]);
|
||||||
curl_setopt($ch[0], CURLOPT_SHARE, $sh);
|
curl_setopt($ch[0], CURLOPT_SHARE, $sh);
|
||||||
|
2
.github/workflows/tests.yml
vendored
2
.github/workflows/tests.yml
vendored
@ -97,7 +97,7 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
echo "::group::composer update"
|
echo "::group::composer update"
|
||||||
composer update --no-progress --no-suggest --ansi
|
composer update --no-progress --ansi
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
echo "::group::install phpunit"
|
echo "::group::install phpunit"
|
||||||
./phpunit install
|
./phpunit install
|
||||||
|
@ -185,7 +185,7 @@ install:
|
|||||||
export SYMFONY_VERSION=$(grep branch-version composer.json | grep -o '[0-9.x]*')
|
export SYMFONY_VERSION=$(grep branch-version composer.json | grep -o '[0-9.x]*')
|
||||||
|
|
||||||
if [[ ! $deps ]]; then
|
if [[ ! $deps ]]; then
|
||||||
php .github/build-packages.php HEAD^ $SYMFONY_VERSION src/Symfony/Bridge/PhpUnit src/Symfony/Contracts
|
php .github/build-packages.php HEAD^ $SYMFONY_VERSION src/Symfony/Bridge/PhpUnit
|
||||||
else
|
else
|
||||||
export SYMFONY_DEPRECATIONS_HELPER=weak &&
|
export SYMFONY_DEPRECATIONS_HELPER=weak &&
|
||||||
cp composer.json composer.json.orig &&
|
cp composer.json composer.json.orig &&
|
||||||
@ -228,7 +228,6 @@ install:
|
|||||||
# Legacy tests are skipped when deps=high and when the current branch version has not the same major version number as the next one
|
# Legacy tests are skipped when deps=high and when the current branch version has not the same major version number as the next one
|
||||||
[[ $deps = high && ${SYMFONY_VERSION%.*} != $(git ls-remote -q --heads | cut -f2 | grep -FA1 /$SYMFONY_VERSION | tail -n 1 | grep -o '[0-9]*' | head -n 1) ]] && export LEGACY=,legacy
|
[[ $deps = high && ${SYMFONY_VERSION%.*} != $(git ls-remote -q --heads | cut -f2 | grep -FA1 /$SYMFONY_VERSION | tail -n 1 | grep -o '[0-9]*' | head -n 1) ]] && export LEGACY=,legacy
|
||||||
|
|
||||||
export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev
|
|
||||||
if [[ $deps ]]; then mv composer.json.phpunit composer.json; fi
|
if [[ $deps ]]; then mv composer.json.phpunit composer.json; fi
|
||||||
|
|
||||||
- |
|
- |
|
||||||
@ -268,7 +267,6 @@ install:
|
|||||||
SYMFONY_VERSION=$(echo $SYMFONY_VERSION | awk '{print $1 - 1}')
|
SYMFONY_VERSION=$(echo $SYMFONY_VERSION | awk '{print $1 - 1}')
|
||||||
echo -e "\\n\\e[33;1mChecking out Symfony $SYMFONY_VERSION and running tests with patched components as deps\\e[0m"
|
echo -e "\\n\\e[33;1mChecking out Symfony $SYMFONY_VERSION and running tests with patched components as deps\\e[0m"
|
||||||
export SYMFONY_REQUIRE=">=$SYMFONY_VERSION"
|
export SYMFONY_REQUIRE=">=$SYMFONY_VERSION"
|
||||||
export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev
|
|
||||||
git fetch --depth=2 origin $SYMFONY_VERSION
|
git fetch --depth=2 origin $SYMFONY_VERSION
|
||||||
git checkout -m FETCH_HEAD
|
git checkout -m FETCH_HEAD
|
||||||
COMPONENTS=$(echo "$COMPONENTS" | xargs dirname | xargs -n1 -I{} bash -c "[ -e '{}/phpunit.xml.dist' ] && echo '{}'" | sort)
|
COMPONENTS=$(echo "$COMPONENTS" | xargs dirname | xargs -n1 -I{} bash -c "[ -e '{}/phpunit.xml.dist' ] && echo '{}'" | sort)
|
||||||
@ -287,8 +285,6 @@ install:
|
|||||||
else
|
else
|
||||||
if [[ $PHP = 7.4* ]]; then
|
if [[ $PHP = 7.4* ]]; then
|
||||||
# add return types before running the test suite
|
# add return types before running the test suite
|
||||||
rm src/Symfony/Contracts -Rf && mv vendor/symfony/contracts src/Symfony/Contracts
|
|
||||||
ln -sd $(realpath src/Symfony/Contracts) vendor/symfony/contracts
|
|
||||||
sed -i 's/"\*\*\/Tests\/"//' composer.json
|
sed -i 's/"\*\*\/Tests\/"//' composer.json
|
||||||
composer install --optimize-autoloader
|
composer install --optimize-autoloader
|
||||||
SYMFONY_PATCH_TYPE_DECLARATIONS=force=object php .github/patch-types.php
|
SYMFONY_PATCH_TYPE_DECLARATIONS=force=object php .github/patch-types.php
|
||||||
|
@ -37,13 +37,13 @@
|
|||||||
"symfony/config": "^4.2|^5.0",
|
"symfony/config": "^4.2|^5.0",
|
||||||
"symfony/dependency-injection": "^3.4|^4.1|^5.0",
|
"symfony/dependency-injection": "^3.4|^4.1|^5.0",
|
||||||
"symfony/filesystem": "^4.4|^5.0",
|
"symfony/filesystem": "^4.4|^5.0",
|
||||||
"symfony/http-kernel": "^4.4|^5.0",
|
"symfony/http-kernel": "^4.4",
|
||||||
"symfony/var-dumper": "^4.4|^5.0"
|
"symfony/var-dumper": "^4.4|^5.0"
|
||||||
},
|
},
|
||||||
"conflict": {
|
"conflict": {
|
||||||
"doctrine/dbal": "<2.5",
|
"doctrine/dbal": "<2.5",
|
||||||
"symfony/dependency-injection": "<3.4",
|
"symfony/dependency-injection": "<3.4",
|
||||||
"symfony/http-kernel": "<4.4",
|
"symfony/http-kernel": "<4.4|>=5.0",
|
||||||
"symfony/var-dumper": "<4.4"
|
"symfony/var-dumper": "<4.4"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
Reference in New Issue
Block a user