|
| 1 | +# Evergreen Build System Architecture |
| 2 | + |
| 3 | +To avoid unnecessary tasks from being started, this project uses two separate build steps. The first step compiles the |
| 4 | +PHP extension on the requested operating system and PHP version, caching the result. The second step runs tests on |
| 5 | +various platforms, re-using the cached build artifacts from the first step. |
| 6 | + |
| 7 | +## Build Step 1: Compile PHP Extension |
| 8 | + |
| 9 | +The extension is built for all supported PHP versions on all supported platforms. This build step is run for every |
| 10 | +commit pushed to the development branch, as well as for stable branches and pull requests to these branches. The build |
| 11 | +step includes a smoke test that attempts to load the compiled extension to catch errors that occur during extension |
| 12 | +initialisation. If a build step fails, test tasks are skipped for that platform and PHP version. |
| 13 | + |
| 14 | +### Build tasks |
| 15 | + |
| 16 | +Build tasks are generated automatically and included in the main config file. The `build-variants.yml` file contains |
| 17 | +the list of supported platforms that the extension is built for. `build-task-groups.yml` defines the task groups that |
| 18 | +contain the build tasks. Note there is a separate task that skips PHP 7.4 and 8.0, as these versions do not support |
| 19 | +OpenSSL 3 (currently used on RHEL 9+ and Ubuntu 22.04+). |
| 20 | + |
| 21 | +## Build Step 2: Run Tests |
| 22 | + |
| 23 | +Tests are not offered for all platforms, and only select tasks are run for commits and pull requests. First, all |
| 24 | +combinations of MongoDB topologies (standalone, replica set, sharded cluster, and load balanced) are run for all |
| 25 | +supported MongoDB versions. Then, all PHP versions are tested against the latest stable version of MongoDB. Finally, |
| 26 | +a last build variant runs tests on PHP 8.2 against the latest stable version of MongoDB using different libmongoc |
| 27 | +versions. |
| 28 | + |
| 29 | +## Modifying generated tasks |
| 30 | + |
| 31 | +Most build and test tasks are generated using the `generate-config.php` script and referenced using tags. To modify the |
| 32 | +configuration, change the appropriate `_template-<build>.yml` file in the `build` or `test` directory, then run the |
| 33 | +generator script to update the files. The generator script will output a list of include statements that can be copied |
| 34 | +to the main `config.yml` file to include all generated tasks. |
| 35 | + |
| 36 | +## Adding new tasks |
| 37 | + |
| 38 | +Adding new tasks for a new MongoDB version or PHP version is done by modifying `generate-config.php` and including the |
| 39 | +version in the corresponding arrays, then regenerating configuration. Note that obsolete files will not be deleted |
| 40 | +automatically, but they won't be in the list of include files printed by the generator script. |
| 41 | + |
| 42 | +## Patch Aliases |
| 43 | + |
| 44 | +Aliases are configured in the main Evergreen configuration file. `github_pr_aliases` defines aliases for tasks to be run |
| 45 | +for every pull request. |
| 46 | + |
| 47 | +## Task Tags |
| 48 | + |
| 49 | +Tasks are tagged to allow for a better selection in build variants. The following tags are used for build tasks: |
| 50 | +- `build`: All build tasks are tagged with `build`. |
| 51 | +- `build-libmongoc`: These build tasks build with different libmongoc versions. |
| 52 | +- `php<version>`: These tags allow selection based on PHP version, e.g. `php8.2`. |
| 53 | + |
| 54 | +Test tasks use the following tags: |
| 55 | +- `local`: All tasks that run a local MongoDB cluster for testing. |
| 56 | +- `<version>`: These tags allow selection based on MongoDB version, e.g. `7.0`. |
| 57 | +- `standalone`, `replicaset`, `sharded`: These tags allow selection based on the MongoDB topology. |
| 58 | +- `loadbalanced`: Allows for selecting tests using a load balancer |
| 59 | +- `ocsp`: Used for all OCSP tasks |
| 60 | +- `versioned_api`: Used for tests that use the stable API |
| 61 | +- `skip_crypt_shared`: These tasks skip installing the shared library to test with libmongocrypt |
| 62 | +- `nodb`: These tasks do not rely on a local database |
| 63 | +- `atlas`: These tasks work on a MongoDB Atlas cluster |
| 64 | +- `storage-engines`: Tag used for tasks that test the `inmemory` and `mmapv1` storage engines |
0 commit comments