Skip to content

Commit

Permalink
Generate test variants automatically based on PHP versions
Browse files Browse the repository at this point in the history
  • Loading branch information
alcaeus committed Jan 10, 2024
1 parent 8274b8d commit 4cf0410
Show file tree
Hide file tree
Showing 12 changed files with 288 additions and 143 deletions.
6 changes: 6 additions & 0 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,9 @@ include:
- filename: .evergreen/config/generated/test/csfle-5.0.yml
- filename: .evergreen/config/generated/test/csfle-4.4.yml
- filename: .evergreen/config/generated/test/csfle-4.2.yml
- filename: .evergreen/config/generated/test-variant/latest-php-8.3.yml
- filename: .evergreen/config/generated/test-variant/replicaset-php-8.2.yml
- filename: .evergreen/config/generated/test-variant/replicaset-php-8.1.yml
- filename: .evergreen/config/generated/test-variant/replicaset-php-8.0.yml
- filename: .evergreen/config/generated/test-variant/replicaset-php-7.4.yml
- filename: .evergreen/config/generated/test-variant/lowest-php-7.4.yml
8 changes: 8 additions & 0 deletions .evergreen/config/generate-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
'7.4'
];

$latestPhpVersion = max($supportedPhpVersions);
$lowestPhpVersion = min($supportedPhpVersions);

// Supported MongoDB versions. Add new versions after "rapid"
$supportedMongoDBVersions = [
'latest',
Expand Down Expand Up @@ -52,6 +55,11 @@
$allFiles[] = generateConfigs('test', 'mongodbVersion', 'require-api-version.yml', 'require-api-version-%s', $requireApiServerVersions);
$allFiles[] = generateConfigs('test', 'mongodbVersion', 'csfle.yml', 'csfle-%s', $csfleServerVersions);

// Test variants
$allFiles[] = generateConfigs('test-variant', 'phpVersion', 'latest.yml', 'latest-php-%s', [$latestPhpVersion]);
$allFiles[] = generateConfigs('test-variant', 'phpVersion', 'replicaset-only.yml', 'replicaset-php-%s', array_diff($supportedPhpVersions, [$latestPhpVersion]));
$allFiles[] = generateConfigs('test-variant', 'phpVersion', 'lowest.yml', 'lowest-php-%s', [$lowestPhpVersion]);

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

Expand Down
85 changes: 85 additions & 0 deletions .evergreen/config/generated/test-variant/latest-php-8.3.yml

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

16 changes: 16 additions & 0 deletions .evergreen/config/generated/test-variant/lowest-php-7.4.yml

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

15 changes: 15 additions & 0 deletions .evergreen/config/generated/test-variant/replicaset-php-7.4.yml

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

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

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

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

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

15 changes: 15 additions & 0 deletions .evergreen/config/generated/test-variant/replicaset-php-8.2.yml

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

84 changes: 84 additions & 0 deletions .evergreen/config/templates/test-variant/latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
buildvariants:
- name: test-debian11-php-%phpVersion%-local
tags: ["test", "debian", "x64"]
display_name: "Test: Debian 11, PHP %phpVersion%"
run_on: debian11-small
expansions:
FETCH_BUILD_VARIANT: "build-debian11"
FETCH_BUILD_TASK: "build-php-%phpVersion%"
PHP_VERSION: "%phpVersion%"
VARIANT: debian11 # Referenced by ADL build script for downloading MQLRun
depends_on:
- variant: "build-debian11"
name: "build-php-%phpVersion%"
tasks:
- ".standalone .local !.csfle !.3.6 !.4.0 !.4.2 !.4.4 !.5.0"
- ".replicaset .local !.csfle !.3.6 !.4.0 !.4.2 !.4.4 !.5.0"
- ".sharded .local !.csfle !.3.6 !.4.0 !.4.2 !.4.4 !.5.0"
- ".loadbalanced .local !.csfle !.3.6 !.4.0 !.4.2 !.4.4 !.5.0"
- ".serverless"
- "test-atlas-data-lake"

- name: test-debian92-php-%phpVersion%-local
tags: ["test", "debian", "x64"]
display_name: "Test: Debian 9.2, PHP %phpVersion%"
run_on: debian92-small
expansions:
FETCH_BUILD_VARIANT: "build-debian92"
FETCH_BUILD_TASK: "build-php-%phpVersion%"
PHP_VERSION: "%phpVersion%"
depends_on:
- variant: "build-debian92"
name: "build-php-%phpVersion%"
tasks:
# Remember to add new major versions here as they are released
- ".standalone .local !.csfle !.6.0 !.7.0 !.rapid !.latest"
- ".replicaset .local !.csfle !.6.0 !.7.0 !.rapid !.latest"
- ".sharded .local !.csfle !.6.0 !.7.0 !.rapid !.latest"
- ".loadbalanced .local !.csfle !.6.0 !.7.0 !.rapid !.latest"

# Test with upcoming PHPC versions
- name: test-debian11-php-%phpVersion%-phpc-next-stable
tags: ["test", "debian", "x64"]
display_name: "Test: Debian 11, PHP %phpVersion%, PHPC next-stable"
run_on: debian11-small
expansions:
FETCH_BUILD_VARIANT: "build-debian11"
FETCH_BUILD_TASK: "build-php-%phpVersion%-next-stable"
PHP_VERSION: "%phpVersion%"
depends_on:
- variant: "build-debian11"
name: "build-php-%phpVersion%-next-stable"
tasks:
- ".replicaset .local .7.0 !.csfle"

- name: test-debian11-php-%phpVersion%-phpc-next-minor
tags: ["test", "debian", "x64"]
display_name: "Test: Debian 11, PHP %phpVersion%, PHPC next-minor"
run_on: debian11-small
expansions:
FETCH_BUILD_VARIANT: "build-debian11"
FETCH_BUILD_TASK: "build-php-%phpVersion%-next-minor"
PHP_VERSION: "%phpVersion%"
depends_on:
- variant: "build-debian11"
name: "build-php-%phpVersion%-next-minor"
tasks:
- ".replicaset .local .7.0 !.csfle"

# Test Atlas and CSFLE on RHEL 8
- name: test-rhel80-php-%phpVersion%-atlas
tags: ["test", "debian", "x64"]
display_name: "Test: RHEL 8.0, PHP %phpVersion%"
run_on: rhel80-small
expansions:
FETCH_BUILD_VARIANT: "build-rhel80"
FETCH_BUILD_TASK: "build-php-%phpVersion%"
PHP_VERSION: "%phpVersion%"
depends_on:
- variant: "build-rhel80"
name: "build-php-%phpVersion%"
tasks:
- "test_atlas_task_group"
- ".csfle"

15 changes: 15 additions & 0 deletions .evergreen/config/templates/test-variant/lowest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
buildvariants:
- name: test-debian92-php-%phpVersion%-local-lowest
tags: ["test", "debian", "x64"]
display_name: "Test: Debian 9.2, PHP %phpVersion%, Lowest Dependencies"
run_on: debian92-small
expansions:
FETCH_BUILD_VARIANT: "build-debian92"
FETCH_BUILD_TASK: "build-php-%phpVersion%-lowest"
PHP_VERSION: "%phpVersion%"
DEPENDENCIES: "lowest"
depends_on:
- variant: "build-debian92"
name: "build-php-%phpVersion%-lowest"
tasks:
- ".replicaset .local .3.6 !.csfle"
14 changes: 14 additions & 0 deletions .evergreen/config/templates/test-variant/replicaset-only.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
buildvariants:
- name: test-debian11-php-%phpVersion%-local
tags: [ "test", "debian", "x64" ]
display_name: "Test: Debian 11, PHP %phpVersion%"
run_on: debian11-small
expansions:
FETCH_BUILD_VARIANT: "build-debian11"
FETCH_BUILD_TASK: "build-php-%phpVersion%"
PHP_VERSION: "%phpVersion%"
depends_on:
- variant: "build-debian11"
name: "build-php-%phpVersion%"
tasks:
- ".replicaset .local .7.0 !.csfle"
Loading

0 comments on commit 4cf0410

Please sign in to comment.