Skip to content

Commit b660425

Browse files
authored
INTPYTHON-407 Add evergreen configuration for django-mongodb (#184)
* INTPYTHON-407 Add evergreen configuration for django-mongodb
1 parent 1e16ec6 commit b660425

File tree

4 files changed

+161
-0
lines changed

4 files changed

+161
-0
lines changed

.evergreen/config.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
exec_timeout_secs: 3600
2+
3+
# Mark a failure as a system/bootstrap failure (purple box) rather then a task
4+
# failure by default.
5+
# Actual testing tasks are marked with `type: test`
6+
command_type: system
7+
8+
# Ensure that setup and teardown is working as expected.
9+
pre_error_fails_task: true
10+
pre_timeout_secs: 1800 # 5 minutes
11+
post_error_fails_task: true
12+
post_timeout_secs: 1800 # 5 minutes
13+
14+
functions:
15+
"setup":
16+
- command: git.get_project
17+
params:
18+
directory: src
19+
- command: subprocess.exec
20+
params:
21+
binary: bash
22+
working_dir: "src"
23+
add_expansions_to_env: true
24+
args:
25+
- ./.evergreen/setup.sh
26+
- command: expansions.update
27+
params:
28+
file: src/expansion.yml
29+
30+
"bootstrap mongo-orchestration":
31+
- command: subprocess.exec
32+
params:
33+
binary: bash
34+
env:
35+
MONGODB_VERSION: "5.0"
36+
TOPOLOGY: server
37+
AUTH: "noauth"
38+
SSL: "nossl"
39+
args:
40+
- ${DRIVERS_TOOLS}/.evergreen/run-orchestration.sh
41+
42+
"run unit tests":
43+
- command: subprocess.exec
44+
type: test
45+
params:
46+
binary: bash
47+
working_dir: "src"
48+
include_expansions_in_env: ["DRIVERS_TOOLS"]
49+
args:
50+
- ./.evergreen/run-tests.sh
51+
52+
"teardown":
53+
- command: subprocess.exec
54+
params:
55+
binary: bash
56+
args:
57+
- ${DRIVERS_TOOLS}/.evergreen/teardown.sh
58+
59+
pre:
60+
- func: setup
61+
- func: bootstrap mongo-orchestration
62+
63+
post:
64+
- func: teardown
65+
66+
tasks:
67+
- name: run-tests
68+
commands:
69+
- func: "run unit tests"
70+
71+
buildvariants:
72+
- name: tests
73+
display_name: Run Tests
74+
run_on: rhel87-small
75+
tasks:
76+
- name: run-tests

.evergreen/run-tests.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/bash
2+
3+
set -eux
4+
5+
# Install the django-mongodb backend
6+
/opt/python/3.10/bin/python3 -m venv venv
7+
. venv/bin/activate
8+
python -m pip install -U pip
9+
pip install -e .
10+
11+
# Install django and test dependencies
12+
git clone --branch mongodb-5.0.x https://github.com/mongodb-forks/django django_repo
13+
pushd django_repo/tests/
14+
pip install -e ..
15+
pip install -r requirements/py3.txt
16+
popd
17+
18+
# Copy the test settings file
19+
cp ./.github/workflows/mongodb_settings.py django_repo/tests/
20+
21+
# Copy the test runner file
22+
cp ./.github/workflows/runtests.py django_repo/tests/runtests_.py
23+
24+
# Run tests
25+
python django_repo/tests/runtests_.py

.evergreen/setup.sh

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/usr/bin/bash
2+
3+
set -eux
4+
5+
# Get the current unique version of this checkout
6+
# shellcheck disable=SC2154
7+
if [ "${is_patch}" = "true" ]; then
8+
# shellcheck disable=SC2154
9+
CURRENT_VERSION=$(git describe || echo "null")-patch-${version_id}
10+
else
11+
CURRENT_VERSION=latest
12+
fi
13+
14+
# Python has cygwin path problems on Windows.
15+
DRIVERS_TOOLS="$(dirname "$(pwd)")/drivers-tools"
16+
PROJECT_DIRECTORY="$(pwd)"
17+
18+
if [ "Windows_NT" = "${OS:-}" ]; then
19+
DRIVERS_TOOLS=$(cygpath -m $DRIVERS_TOOLS)
20+
PROJECT_DIRECTORY=$(cygpath -m $PROJECT_DIRECTORY)
21+
fi
22+
export PROJECT_DIRECTORY
23+
export DRIVERS_TOOLS
24+
25+
export MONGO_ORCHESTRATION_HOME="$DRIVERS_TOOLS/.evergreen/orchestration"
26+
export MONGODB_BINARIES="$DRIVERS_TOOLS/mongodb/bin"
27+
# shellcheck disable=SC2154
28+
export UPLOAD_BUCKET="${project}"
29+
30+
cat <<EOT > expansion.yml
31+
CURRENT_VERSION: "$CURRENT_VERSION"
32+
DRIVERS_TOOLS: "$DRIVERS_TOOLS"
33+
MONGO_ORCHESTRATION_HOME: "$MONGO_ORCHESTRATION_HOME"
34+
MONGODB_BINARIES: "$MONGODB_BINARIES"
35+
UPLOAD_BUCKET: "$UPLOAD_BUCKET"
36+
PROJECT_DIRECTORY: "$PROJECT_DIRECTORY"
37+
EOT
38+
39+
# Set up drivers-tools with a .env file.
40+
git clone https://github.com/mongodb-labs/drivers-evergreen-tools.git ${DRIVERS_TOOLS}
41+
cat <<EOT > ${DRIVERS_TOOLS}/.env
42+
CURRENT_VERSION="$CURRENT_VERSION"
43+
DRIVERS_TOOLS="$DRIVERS_TOOLS"
44+
MONGO_ORCHESTRATION_HOME="$MONGO_ORCHESTRATION_HOME"
45+
MONGODB_BINARIES="$MONGODB_BINARIES"
46+
UPLOAD_BUCKET="$UPLOAD_BUCKET"
47+
PROJECT_DIRECTORY="$PROJECT_DIRECTORY"
48+
EOT

sbom.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"metadata": {
3+
"timestamp": "2024-11-05T12:48:05.688090+00:00"
4+
},
5+
"components": [],
6+
"serialNumber": "urn:uuid:f3728d07-e448-4fae-8e28-c08f8c75f747",
7+
"version": 1,
8+
"$schema": "http://cyclonedx.org/schema/bom-1.5.schema.json",
9+
"bomFormat": "CycloneDX",
10+
"specVersion": "1.5",
11+
"vulnerabilities": []
12+
}

0 commit comments

Comments
 (0)