Skip to content

Commit

Permalink
Merge branch 'v1.19' into merge-v1.19-into-master-1721217639779
Browse files Browse the repository at this point in the history
* v1.19:
  Reduce amount of evergreen config includes (#1612)
  • Loading branch information
alcaeus committed Jul 17, 2024
2 parents 03feb57 + 5ac56a5 commit 0ccf239
Show file tree
Hide file tree
Showing 63 changed files with 3,995 additions and 4,101 deletions.
55 changes: 10 additions & 45 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,48 +67,13 @@ include:
- filename: .evergreen/config/test-tasks.yml

# Automatically generated files
- filename: .evergreen/config/generated/build/build-php-8.3.yml
- filename: .evergreen/config/generated/build/build-php-8.2.yml
- filename: .evergreen/config/generated/build/build-php-8.1.yml
- filename: .evergreen/config/generated/build/build-php-8.0.yml
- filename: .evergreen/config/generated/build/build-php-7.4.yml
- filename: .evergreen/config/generated/build/build-libmongoc-8.3.yml
- filename: .evergreen/config/generated/test/local-latest.yml
- filename: .evergreen/config/generated/test/local-rapid.yml
- filename: .evergreen/config/generated/test/local-8.0.yml
- filename: .evergreen/config/generated/test/local-7.0.yml
- filename: .evergreen/config/generated/test/local-6.0.yml
- filename: .evergreen/config/generated/test/local-5.0.yml
- filename: .evergreen/config/generated/test/local-4.4.yml
- filename: .evergreen/config/generated/test/local-4.2.yml
- filename: .evergreen/config/generated/test/local-4.0.yml
- filename: .evergreen/config/generated/test/load-balanced-latest.yml
- filename: .evergreen/config/generated/test/load-balanced-rapid.yml
- filename: .evergreen/config/generated/test/load-balanced-8.0.yml
- filename: .evergreen/config/generated/test/load-balanced-7.0.yml
- filename: .evergreen/config/generated/test/load-balanced-6.0.yml
- filename: .evergreen/config/generated/test/load-balanced-5.0.yml
- filename: .evergreen/config/generated/test/ocsp-latest.yml
- filename: .evergreen/config/generated/test/ocsp-rapid.yml
- filename: .evergreen/config/generated/test/ocsp-8.0.yml
- filename: .evergreen/config/generated/test/ocsp-7.0.yml
- filename: .evergreen/config/generated/test/ocsp-6.0.yml
- filename: .evergreen/config/generated/test/ocsp-5.0.yml
- filename: .evergreen/config/generated/test/ocsp-4.4.yml
- filename: .evergreen/config/generated/test/require-api-version-latest.yml
- filename: .evergreen/config/generated/test/require-api-version-rapid.yml
- filename: .evergreen/config/generated/test/require-api-version-8.0.yml
- filename: .evergreen/config/generated/test/require-api-version-7.0.yml
- filename: .evergreen/config/generated/test/require-api-version-6.0.yml
- filename: .evergreen/config/generated/test/require-api-version-5.0.yml
- filename: .evergreen/config/generated/test/skip-crypt-shared-latest.yml
- filename: .evergreen/config/generated/test/skip-crypt-shared-rapid.yml
- filename: .evergreen/config/generated/test/skip-crypt-shared-8.0.yml
- filename: .evergreen/config/generated/test/skip-crypt-shared-7.0.yml
- filename: .evergreen/config/generated/test/skip-crypt-shared-6.0.yml
- filename: .evergreen/config/generated/test-variant/full-php-8.3.yml
- filename: .evergreen/config/generated/test-variant/full-php-8.2.yml
- filename: .evergreen/config/generated/test-variant/full-php-8.1.yml
- filename: .evergreen/config/generated/test-variant/full-php-8.0.yml
- filename: .evergreen/config/generated/test-variant/full-php-7.4.yml
- filename: .evergreen/config/generated/test-variant/libmongoc-php-8.3.yml
- filename: .evergreen/config/generated/build/build-php.yml
- filename: .evergreen/config/generated/build/build-libmongoc.yml
- filename: .evergreen/config/generated/test/local.yml
- filename: .evergreen/config/generated/test/load-balanced.yml
- filename: .evergreen/config/generated/test/ocsp.yml
- filename: .evergreen/config/generated/test/require-api-version.yml
- filename: .evergreen/config/generated/test/skip-crypt-shared.yml
- filename: .evergreen/config/generated/test-variant/modern-php-full.yml
- filename: .evergreen/config/generated/test-variant/legacy-php-full.yml
- filename: .evergreen/config/generated/test-variant/libmongoc.yml
47 changes: 26 additions & 21 deletions .evergreen/config/generate-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,54 +57,59 @@
$allFiles = [];

// Build tasks
$allFiles[] = generateConfigs('build', 'phpVersion', 'build-php.yml', 'build-php-%s', $supportedPhpVersions);
$allFiles[] = generateConfigs('build', 'phpVersion', 'build-libmongoc.yml', 'build-libmongoc-%s', $libmongocBuildPhpVersions);
$allFiles[] = generateConfigs('tasks', 'build', 'phpVersion', 'build-php.yml', $supportedPhpVersions);
$allFiles[] = generateConfigs('tasks', 'build', 'phpVersion', 'build-libmongoc.yml', $libmongocBuildPhpVersions);

// Test tasks
$allFiles[] = generateConfigs('test', 'mongodbVersion', 'local.yml', 'local-%s', $localServerVersions);
$allFiles[] = generateConfigs('test', 'mongodbVersion', 'load-balanced.yml', 'load-balanced-%s', $loadBalancedServerVersions);
$allFiles[] = generateConfigs('test', 'mongodbVersion', 'ocsp.yml', 'ocsp-%s', $ocspServerVersions);
$allFiles[] = generateConfigs('test', 'mongodbVersion', 'require-api-version.yml', 'require-api-version-%s', $requireApiServerVersions);
$allFiles[] = generateConfigs('test', 'mongodbVersion', 'skip-crypt-shared.yml', 'skip-crypt-shared-%s', $skipCryptSharedServerVersions);
$allFiles[] = generateConfigs('tasks', 'test', 'mongodbVersion', 'local.yml', $localServerVersions);
$allFiles[] = generateConfigs('tasks', 'test', 'mongodbVersion', 'load-balanced.yml', $loadBalancedServerVersions);
$allFiles[] = generateConfigs('tasks', 'test', 'mongodbVersion', 'ocsp.yml', $ocspServerVersions);
$allFiles[] = generateConfigs('tasks', 'test', 'mongodbVersion', 'require-api-version.yml', $requireApiServerVersions);
$allFiles[] = generateConfigs('tasks', 'test', 'mongodbVersion', 'skip-crypt-shared.yml', $skipCryptSharedServerVersions);

// Test variants
$allFiles[] = generateConfigs('test-variant', 'phpVersion', 'modern-php-full.yml', 'full-php-%s', $modernPhpVersions);
$allFiles[] = generateConfigs('test-variant', 'phpVersion', 'legacy-php-full.yml', 'full-php-%s', $legacyPhpVersions);
$allFiles[] = generateConfigs('test-variant', 'phpVersion', 'libmongoc.yml', 'libmongoc-php-%s', [$latestPhpVersion]);
$allFiles[] = generateConfigs('buildvariants', 'test-variant', 'phpVersion', 'modern-php-full.yml', $modernPhpVersions);
$allFiles[] = generateConfigs('buildvariants', 'test-variant', 'phpVersion', 'legacy-php-full.yml', $legacyPhpVersions);
$allFiles[] = generateConfigs('buildvariants', 'test-variant', 'phpVersion', 'libmongoc.yml', [$latestPhpVersion]);

echo "Generated config. Use the following list to import files:\n";
echo implode("\n", array_map('getImportConfig', array_merge(...$allFiles))) . "\n";
echo implode("\n", array_map('getImportConfig', $allFiles)) . "\n";

function getImportConfig(string $filename): string
{
return '- filename: ' . $filename;
}

function generateConfigs(
string $type,
string $directory,
string $replacementName,
string $templateFile,
string $outputFormat,
array $versions,
): array {
): string {
$templateRelativePath = 'templates/' . $directory . '/' . $templateFile;
$template = file_get_contents(__DIR__ . '/' . $templateRelativePath);
$header = sprintf(
'# This file is generated automatically - please edit the "%s" template file instead.',
$templateRelativePath
);

$files = [];
$contents = <<<HEADER
$header
$type:
foreach ($versions as $version) {
$filename = sprintf('/generated/%s/' . $outputFormat . '.yml', $directory, $version);
$files[] = '.evergreen/config' . $filename;

$replacements = ['%' . $replacementName . '%' => $version];
HEADER;

file_put_contents(__DIR__ . $filename, $header . "\n" . strtr($template, $replacements));
foreach ($versions as $version) {
$contents .= strtr(
$template,
['%' . $replacementName . '%' => $version],
);
}

return $files;
$filename = '/generated/' . $directory . '/' . $templateFile;
file_put_contents(__DIR__ . $filename, $contents);

return '.evergreen/config' . $filename;
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions .evergreen/config/generated/build/build-php-7.4.yml

This file was deleted.

9 changes: 0 additions & 9 deletions .evergreen/config/generated/build/build-php-8.0.yml

This file was deleted.

9 changes: 0 additions & 9 deletions .evergreen/config/generated/build/build-php-8.1.yml

This file was deleted.

9 changes: 0 additions & 9 deletions .evergreen/config/generated/build/build-php-8.2.yml

This file was deleted.

9 changes: 0 additions & 9 deletions .evergreen/config/generated/build/build-php-8.3.yml

This file was deleted.

37 changes: 37 additions & 0 deletions .evergreen/config/generated/build/build-php.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

61 changes: 0 additions & 61 deletions .evergreen/config/generated/test-variant/full-php-8.0.yml

This file was deleted.

82 changes: 0 additions & 82 deletions .evergreen/config/generated/test-variant/full-php-8.1.yml

This file was deleted.

Loading

0 comments on commit 0ccf239

Please sign in to comment.