Skip to content

Commit a204130

Browse files
authored
PHPC-2261: Revamp Evergreen config (#1473)
* Remove unused functions and tasks * Fix indentation * POC: Use task group to test local deployments * Add make target to test without building This is necessary if we don't want to change all `.dep` files to the new path. * Cache compiled build for later use * Rename tasks for better filtering * Remove working dir upload as it's already uploaded along with the build * Update tags in test tasks * Create build variants for building driver * Fetch correct build file * Extract configuration to separate files * Add task group for builds * Add builds for different libmongoc versions * Test MongoDB 7.0 on Debian 11 * Move Atlas Connectivity and crypt_shared tests to new format * Move storage engine and libmongoc variants to new format * Run smoketest after build * Extract generatable tasks * Remove obsolete file * Remove obsolete variant * Move requireApiVersion tests to new format * Move loadbalanced tests to new format * Move OCSP tests to new format * Generate test and build tasks from templates * Remove obsolete files * Refactor generation script * Remove version identifier from libmongoc task names * Add variant tags to facilitate patch filters * Define pull request aliases in evergreen config * Add architecture documentation * Use regular expression for PR aliases * Mark generated files as such * Remove unnecessary functions - Artifactory uploads are not used, so we can save on disk space - Evergreen isn't used to test Windows builds, so we don't need to make Windows fixes - Files should already be executable * Update CI documentation * Remove unused YAML tags * Document references of libmongoc build tasks * Document tags used in tasks * Make versions in config generator more readable * Split templates and generated configs * Add blank lines to task files for readability * Add note about libmongoc build tasks in contributing guide * Use real server version in architecture docs * Treat loadbalanced as its own topology in tests * Kill tasks after 10 minutes
1 parent befb835 commit a204130

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+4689
-1293
lines changed

.evergreen/architecture.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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

.evergreen/compile-unix.sh

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
1-
#!/bin/sh
1+
#!/bin/bash
22
set -o errexit # Exit the script with error if any of the commands fail
33

4+
# Find PHP binary path for the requested version
5+
if [ -z "$PHP_PATH" ]; then
6+
if [ -d "/opt/php/${PHP_VERSION}-64bit/bin" ]; then
7+
PHP_PATH="/opt/php/${PHP_VERSION}-64bit/bin"
8+
else
9+
# Try to find the newest version matching our constant
10+
PHP_PATH=`find /opt/php/ -maxdepth 1 -type d -name "${PHP_VERSION}*-64bit" -print | sort -V -r | head -n 1`/bin
11+
fi
12+
fi
13+
14+
if [ ! -x "$PHP_PATH/php" ]; then
15+
echo "Could not find PHP binaries for version ${PHP_VERSION}. Listing available versions..."
16+
ls -1 /opt/php
17+
exit 1
18+
fi
19+
20+
PATH="$PHP_PATH:$PATH"
21+
422
# Supported/used environment variables:
523
# MARCH Machine Architecture. Defaults to lowercase uname -m
624
# LIBMONGOC_VERSION Optional libmongoc version (regenerate version file if set)
@@ -45,7 +63,7 @@ case "$OS" in
4563
esac
4664

4765
# Report the current PHP version
48-
echo "PHP: `php --version | head -1`"
66+
echo "PHP: `php --version | head -n 1`"
4967

5068
phpize
5169
./configure --enable-mongodb-developer-flags
@@ -55,4 +73,4 @@ if [ -n "$LIBMONGOC_VERSION" ]; then
5573
make libmongoc-version-current
5674
fi
5775

58-
make
76+
make test TESTS="tests/smoketest.phpt"

0 commit comments

Comments
 (0)