-
Notifications
You must be signed in to change notification settings - Fork 211
PHPC-2261: Revamp Evergreen config #1473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a67441c
dc6df70
780a9e4
8f99925
16b8e44
7a4b177
038ec06
d8dbc3d
a131122
94660d5
8a72a19
6815c3e
137fa47
dbda695
9376fb2
c06b7e7
74f3e04
9535c73
4a20f4e
bebb155
6fa2324
81614c0
214b8f5
7443ace
eaee3d8
6607c0f
37c944c
5b8d711
1a92176
d52d13d
1033d86
0edd44d
7a87c85
d19f8ae
305e50d
86d8369
802b0be
10632e3
2d349d3
acf1eb7
d529aca
308bfc5
a5efc27
8c0fff7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| # Evergreen Build System Architecture | ||
|
|
||
| To avoid unnecessary tasks from being started, this project uses two separate build steps. The first step compiles the | ||
| PHP extension on the requested operating system and PHP version, caching the result. The second step runs tests on | ||
| various platforms, re-using the cached build artifacts from the first step. | ||
|
|
||
| ## Build Step 1: Compile PHP Extension | ||
|
|
||
| The extension is built for all supported PHP versions on all supported platforms. This build step is run for every | ||
| commit pushed to the development branch, as well as for stable branches and pull requests to these branches. The build | ||
| step includes a smoke test that attempts to load the compiled extension to catch errors that occur during extension | ||
| initialisation. If a build step fails, test tasks are skipped for that platform and PHP version. | ||
|
|
||
| ### Build tasks | ||
|
|
||
| Build tasks are generated automatically and included in the main config file. The `build-variants.yml` file contains | ||
| the list of supported platforms that the extension is built for. `build-task-groups.yml` defines the task groups that | ||
| contain the build tasks. Note there is a separate task that skips PHP 7.4 and 8.0, as these versions do not support | ||
| OpenSSL 3 (currently used on RHEL 9+ and Ubuntu 22.04+). | ||
|
|
||
| ## Build Step 2: Run Tests | ||
|
|
||
| Tests are not offered for all platforms, and only select tasks are run for commits and pull requests. First, all | ||
| combinations of MongoDB topologies (standalone, replica set, sharded cluster, and load balanced) are run for all | ||
| supported MongoDB versions. Then, all PHP versions are tested against the latest stable version of MongoDB. Finally, | ||
| a last build variant runs tests on PHP 8.2 against the latest stable version of MongoDB using different libmongoc | ||
| versions. | ||
|
|
||
| ## Modifying generated tasks | ||
|
|
||
| Most build and test tasks are generated using the `generate-config.php` script and referenced using tags. To modify the | ||
| configuration, change the appropriate `_template-<build>.yml` file in the `build` or `test` directory, then run the | ||
| generator script to update the files. The generator script will output a list of include statements that can be copied | ||
| to the main `config.yml` file to include all generated tasks. | ||
|
|
||
| ## Adding new tasks | ||
|
|
||
| Adding new tasks for a new MongoDB version or PHP version is done by modifying `generate-config.php` and including the | ||
| version in the corresponding arrays, then regenerating configuration. Note that obsolete files will not be deleted | ||
| automatically, but they won't be in the list of include files printed by the generator script. | ||
|
|
||
| ## Patch Aliases | ||
|
|
||
| Aliases are configured in the main Evergreen configuration file. `github_pr_aliases` defines aliases for tasks to be run | ||
| for every pull request. | ||
|
|
||
| ## Task Tags | ||
|
|
||
| Tasks are tagged to allow for a better selection in build variants. The following tags are used for build tasks: | ||
| - `build`: All build tasks are tagged with `build`. | ||
| - `build-libmongoc`: These build tasks build with different libmongoc versions. | ||
| - `php<version>`: These tags allow selection based on PHP version, e.g. `php8.2`. | ||
|
|
||
| Test tasks use the following tags: | ||
| - `local`: All tasks that run a local MongoDB cluster for testing. | ||
| - `<version>`: These tags allow selection based on MongoDB version, e.g. `7.0`. | ||
| - `standalone`, `replicaset`, `sharded`: These tags allow selection based on the MongoDB topology. | ||
| - `loadbalanced`: Allows for selecting tests using a load balancer | ||
|
||
| - `ocsp`: Used for all OCSP tasks | ||
| - `versioned_api`: Used for tests that use the stable API | ||
| - `skip_crypt_shared`: These tasks skip installing the shared library to test with libmongocrypt | ||
| - `nodb`: These tasks do not rely on a local database | ||
| - `atlas`: These tasks work on a MongoDB Atlas cluster | ||
| - `storage-engines`: Tag used for tasks that test the `inmemory` and `mmapv1` storage engines | ||
jmikola marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,24 @@ | ||
| #!/bin/sh | ||
| #!/bin/bash | ||
| set -o errexit # Exit the script with error if any of the commands fail | ||
|
|
||
| # Find PHP binary path for the requested version | ||
|
||
| if [ -z "$PHP_PATH" ]; then | ||
| if [ -d "/opt/php/${PHP_VERSION}-64bit/bin" ]; then | ||
| PHP_PATH="/opt/php/${PHP_VERSION}-64bit/bin" | ||
jmikola marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| else | ||
| # Try to find the newest version matching our constant | ||
| PHP_PATH=`find /opt/php/ -maxdepth 1 -type d -name "${PHP_VERSION}*-64bit" -print | sort -V -r | head -n 1`/bin | ||
| fi | ||
| fi | ||
|
|
||
| if [ ! -x "$PHP_PATH/php" ]; then | ||
| echo "Could not find PHP binaries for version ${PHP_VERSION}. Listing available versions..." | ||
| ls -1 /opt/php | ||
| exit 1 | ||
| fi | ||
|
|
||
| PATH="$PHP_PATH:$PATH" | ||
|
|
||
| # Supported/used environment variables: | ||
| # MARCH Machine Architecture. Defaults to lowercase uname -m | ||
| # LIBMONGOC_VERSION Optional libmongoc version (regenerate version file if set) | ||
|
|
@@ -45,7 +63,7 @@ case "$OS" in | |
| esac | ||
|
|
||
| # Report the current PHP version | ||
| echo "PHP: `php --version | head -1`" | ||
| echo "PHP: `php --version | head -n 1`" | ||
|
|
||
| phpize | ||
| ./configure --enable-mongodb-developer-flags | ||
|
|
@@ -55,4 +73,4 @@ if [ -n "$LIBMONGOC_VERSION" ]; then | |
| make libmongoc-version-current | ||
| fi | ||
|
|
||
| make | ||
| make test TESTS="tests/smoketest.phpt" | ||