diff --git a/.evergreen/config.yml b/.evergreen/config.yml new file mode 100644 index 000000000..6490b069f --- /dev/null +++ b/.evergreen/config.yml @@ -0,0 +1,76 @@ +exec_timeout_secs: 3600 + +# Mark a failure as a system/bootstrap failure (purple box) rather then a task +# failure by default. +# Actual testing tasks are marked with `type: test` +command_type: system + +# Ensure that setup and teardown is working as expected. +pre_error_fails_task: true +pre_timeout_secs: 1800 # 5 minutes +post_error_fails_task: true +post_timeout_secs: 1800 # 5 minutes + +functions: + "setup": + - command: git.get_project + params: + directory: src + - command: subprocess.exec + params: + binary: bash + working_dir: "src" + add_expansions_to_env: true + args: + - ./.evergreen/setup.sh + - command: expansions.update + params: + file: src/expansion.yml + + "bootstrap mongo-orchestration": + - command: subprocess.exec + params: + binary: bash + env: + MONGODB_VERSION: "5.0" + TOPOLOGY: server + AUTH: "noauth" + SSL: "nossl" + args: + - ${DRIVERS_TOOLS}/.evergreen/run-orchestration.sh + + "run unit tests": + - command: subprocess.exec + type: test + params: + binary: bash + working_dir: "src" + include_expansions_in_env: ["DRIVERS_TOOLS"] + args: + - ./.evergreen/run-tests.sh + + "teardown": + - command: subprocess.exec + params: + binary: bash + args: + - ${DRIVERS_TOOLS}/.evergreen/teardown.sh + +pre: + - func: setup + - func: bootstrap mongo-orchestration + +post: + - func: teardown + +tasks: +- name: run-tests + commands: + - func: "run unit tests" + +buildvariants: +- name: tests + display_name: Run Tests + run_on: rhel87-small + tasks: + - name: run-tests diff --git a/.evergreen/run-tests.sh b/.evergreen/run-tests.sh new file mode 100644 index 000000000..88ec602c5 --- /dev/null +++ b/.evergreen/run-tests.sh @@ -0,0 +1,25 @@ +#!/usr/bin/bash + +set -eux + +# Install the django-mongodb backend +/opt/python/3.10/bin/python3 -m venv venv +. venv/bin/activate +python -m pip install -U pip +pip install -e . + +# Install django and test dependencies +git clone --branch mongodb-5.0.x https://github.com/mongodb-forks/django django_repo +pushd django_repo/tests/ +pip install -e .. +pip install -r requirements/py3.txt +popd + +# Copy the test settings file +cp ./.github/workflows/mongodb_settings.py django_repo/tests/ + +# Copy the test runner file +cp ./.github/workflows/runtests.py django_repo/tests/runtests_.py + +# Run tests +python django_repo/tests/runtests_.py diff --git a/.evergreen/setup.sh b/.evergreen/setup.sh new file mode 100644 index 000000000..4709ed9bd --- /dev/null +++ b/.evergreen/setup.sh @@ -0,0 +1,48 @@ +#!/usr/bin/bash + +set -eux + +# Get the current unique version of this checkout +# shellcheck disable=SC2154 +if [ "${is_patch}" = "true" ]; then + # shellcheck disable=SC2154 + CURRENT_VERSION=$(git describe || echo "null")-patch-${version_id} +else + CURRENT_VERSION=latest +fi + +# Python has cygwin path problems on Windows. +DRIVERS_TOOLS="$(dirname "$(pwd)")/drivers-tools" +PROJECT_DIRECTORY="$(pwd)" + +if [ "Windows_NT" = "${OS:-}" ]; then + DRIVERS_TOOLS=$(cygpath -m $DRIVERS_TOOLS) + PROJECT_DIRECTORY=$(cygpath -m $PROJECT_DIRECTORY) +fi +export PROJECT_DIRECTORY +export DRIVERS_TOOLS + +export MONGO_ORCHESTRATION_HOME="$DRIVERS_TOOLS/.evergreen/orchestration" +export MONGODB_BINARIES="$DRIVERS_TOOLS/mongodb/bin" +# shellcheck disable=SC2154 +export UPLOAD_BUCKET="${project}" + +cat < expansion.yml +CURRENT_VERSION: "$CURRENT_VERSION" +DRIVERS_TOOLS: "$DRIVERS_TOOLS" +MONGO_ORCHESTRATION_HOME: "$MONGO_ORCHESTRATION_HOME" +MONGODB_BINARIES: "$MONGODB_BINARIES" +UPLOAD_BUCKET: "$UPLOAD_BUCKET" +PROJECT_DIRECTORY: "$PROJECT_DIRECTORY" +EOT + +# Set up drivers-tools with a .env file. +git clone https://github.com/mongodb-labs/drivers-evergreen-tools.git ${DRIVERS_TOOLS} +cat < ${DRIVERS_TOOLS}/.env +CURRENT_VERSION="$CURRENT_VERSION" +DRIVERS_TOOLS="$DRIVERS_TOOLS" +MONGO_ORCHESTRATION_HOME="$MONGO_ORCHESTRATION_HOME" +MONGODB_BINARIES="$MONGODB_BINARIES" +UPLOAD_BUCKET="$UPLOAD_BUCKET" +PROJECT_DIRECTORY="$PROJECT_DIRECTORY" +EOT diff --git a/sbom.json b/sbom.json new file mode 100644 index 000000000..dc6714671 --- /dev/null +++ b/sbom.json @@ -0,0 +1,12 @@ +{ + "metadata": { + "timestamp": "2024-11-05T12:48:05.688090+00:00" + }, + "components": [], + "serialNumber": "urn:uuid:f3728d07-e448-4fae-8e28-c08f8c75f747", + "version": 1, + "$schema": "http://cyclonedx.org/schema/bom-1.5.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.5", + "vulnerabilities": [] +}