django-mongodb-backend 5.0.0a3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- django_mongodb_backend-5.0.0a3/.evergreen/config.yml +76 -0
- django_mongodb_backend-5.0.0a3/.evergreen/run-tests.sh +25 -0
- django_mongodb_backend-5.0.0a3/.evergreen/setup.sh +48 -0
- django_mongodb_backend-5.0.0a3/.github/dependabot.yml +16 -0
- django_mongodb_backend-5.0.0a3/.github/workflows/codeql.yml +71 -0
- django_mongodb_backend-5.0.0a3/.github/workflows/dist.yml +38 -0
- django_mongodb_backend-5.0.0a3/.github/workflows/linters.yml +48 -0
- django_mongodb_backend-5.0.0a3/.github/workflows/mongodb_settings.py +14 -0
- django_mongodb_backend-5.0.0a3/.github/workflows/release-python.yml +112 -0
- django_mongodb_backend-5.0.0a3/.github/workflows/runtests.py +168 -0
- django_mongodb_backend-5.0.0a3/.github/workflows/test-python.yml +57 -0
- django_mongodb_backend-5.0.0a3/.github/workflows/zizmor.yml +32 -0
- django_mongodb_backend-5.0.0a3/.gitignore +51 -0
- django_mongodb_backend-5.0.0a3/.pre-commit-config.yaml +80 -0
- django_mongodb_backend-5.0.0a3/.readthedocs.yaml +25 -0
- django_mongodb_backend-5.0.0a3/LICENSE +201 -0
- django_mongodb_backend-5.0.0a3/PKG-INFO +480 -0
- django_mongodb_backend-5.0.0a3/README.md +250 -0
- django_mongodb_backend-5.0.0a3/THIRD-PARTY-NOTICES +79 -0
- django_mongodb_backend-5.0.0a3/django_mongodb_backend/__init__.py +25 -0
- django_mongodb_backend-5.0.0a3/django_mongodb_backend/aggregates.py +79 -0
- django_mongodb_backend-5.0.0a3/django_mongodb_backend/base.py +202 -0
- django_mongodb_backend-5.0.0a3/django_mongodb_backend/client.py +50 -0
- django_mongodb_backend-5.0.0a3/django_mongodb_backend/compiler.py +806 -0
- django_mongodb_backend-5.0.0a3/django_mongodb_backend/creation.py +18 -0
- django_mongodb_backend-5.0.0a3/django_mongodb_backend/dbapi.py +37 -0
- django_mongodb_backend-5.0.0a3/django_mongodb_backend/expressions.py +216 -0
- django_mongodb_backend-5.0.0a3/django_mongodb_backend/features.py +610 -0
- django_mongodb_backend-5.0.0a3/django_mongodb_backend/fields/__init__.py +19 -0
- django_mongodb_backend-5.0.0a3/django_mongodb_backend/fields/array.py +391 -0
- django_mongodb_backend-5.0.0a3/django_mongodb_backend/fields/auto.py +61 -0
- django_mongodb_backend-5.0.0a3/django_mongodb_backend/fields/duration.py +15 -0
- django_mongodb_backend-5.0.0a3/django_mongodb_backend/fields/embedded_model.py +161 -0
- django_mongodb_backend-5.0.0a3/django_mongodb_backend/fields/json.py +171 -0
- django_mongodb_backend-5.0.0a3/django_mongodb_backend/fields/objectid.py +57 -0
- django_mongodb_backend-5.0.0a3/django_mongodb_backend/forms/__init__.py +15 -0
- django_mongodb_backend-5.0.0a3/django_mongodb_backend/forms/fields/__init__.py +11 -0
- django_mongodb_backend-5.0.0a3/django_mongodb_backend/forms/fields/array.py +242 -0
- django_mongodb_backend-5.0.0a3/django_mongodb_backend/forms/fields/embedded_model.py +62 -0
- django_mongodb_backend-5.0.0a3/django_mongodb_backend/forms/fields/objectid.py +27 -0
- django_mongodb_backend-5.0.0a3/django_mongodb_backend/functions.py +257 -0
- django_mongodb_backend-5.0.0a3/django_mongodb_backend/indexes.py +74 -0
- django_mongodb_backend-5.0.0a3/django_mongodb_backend/introspection.py +32 -0
- django_mongodb_backend-5.0.0a3/django_mongodb_backend/jinja2/mongodb/widgets/split_array.html +1 -0
- django_mongodb_backend-5.0.0a3/django_mongodb_backend/lookups.py +135 -0
- django_mongodb_backend-5.0.0a3/django_mongodb_backend/managers.py +7 -0
- django_mongodb_backend-5.0.0a3/django_mongodb_backend/operations.py +297 -0
- django_mongodb_backend-5.0.0a3/django_mongodb_backend/query.py +304 -0
- django_mongodb_backend-5.0.0a3/django_mongodb_backend/query_utils.py +54 -0
- django_mongodb_backend-5.0.0a3/django_mongodb_backend/queryset.py +96 -0
- django_mongodb_backend-5.0.0a3/django_mongodb_backend/schema.py +428 -0
- django_mongodb_backend-5.0.0a3/django_mongodb_backend/templates/mongodb/widgets/split_array.html +1 -0
- django_mongodb_backend-5.0.0a3/django_mongodb_backend/utils.py +183 -0
- django_mongodb_backend-5.0.0a3/django_mongodb_backend/validation.py +20 -0
- django_mongodb_backend-5.0.0a3/django_mongodb_backend/validators.py +18 -0
- django_mongodb_backend-5.0.0a3/docs/Makefile +20 -0
- django_mongodb_backend-5.0.0a3/docs/make.bat +35 -0
- django_mongodb_backend-5.0.0a3/docs/source/_ext/djangodocs.py +16 -0
- django_mongodb_backend-5.0.0a3/docs/source/conf.py +52 -0
- django_mongodb_backend-5.0.0a3/docs/source/embedded-models.rst +55 -0
- django_mongodb_backend-5.0.0a3/docs/source/fields.rst +264 -0
- django_mongodb_backend-5.0.0a3/docs/source/forms.rst +171 -0
- django_mongodb_backend-5.0.0a3/docs/source/index.rst +18 -0
- django_mongodb_backend-5.0.0a3/docs/source/querysets.rst +69 -0
- django_mongodb_backend-5.0.0a3/pyproject.toml +121 -0
- django_mongodb_backend-5.0.0a3/requirements.txt +3 -0
- django_mongodb_backend-5.0.0a3/sbom.json +12 -0
- django_mongodb_backend-5.0.0a3/tests/backend_/__init__.py +0 -0
- django_mongodb_backend-5.0.0a3/tests/backend_/test_base.py +14 -0
- django_mongodb_backend-5.0.0a3/tests/backend_/utils/__init__.py +0 -0
- django_mongodb_backend-5.0.0a3/tests/backend_/utils/test_parse_uri.py +71 -0
- django_mongodb_backend-5.0.0a3/tests/dbshell_/__init__.py +0 -0
- django_mongodb_backend-5.0.0a3/tests/dbshell_/tests.py +116 -0
- django_mongodb_backend-5.0.0a3/tests/expressions_/__init__.py +0 -0
- django_mongodb_backend-5.0.0a3/tests/expressions_/test_value.py +43 -0
- django_mongodb_backend-5.0.0a3/tests/forms_tests_/__init__.py +0 -0
- django_mongodb_backend-5.0.0a3/tests/forms_tests_/test_array.py +405 -0
- django_mongodb_backend-5.0.0a3/tests/forms_tests_/test_objectidfield.py +33 -0
- django_mongodb_backend-5.0.0a3/tests/indexes_/__init__.py +0 -0
- django_mongodb_backend-5.0.0a3/tests/indexes_/models.py +7 -0
- django_mongodb_backend-5.0.0a3/tests/indexes_/test_condition.py +126 -0
- django_mongodb_backend-5.0.0a3/tests/invalid_models_tests_/__init__.py +0 -0
- django_mongodb_backend-5.0.0a3/tests/invalid_models_tests_/test_autofield.py +63 -0
- django_mongodb_backend-5.0.0a3/tests/lookup_/__init__.py +0 -0
- django_mongodb_backend-5.0.0a3/tests/lookup_/models.py +11 -0
- django_mongodb_backend-5.0.0a3/tests/lookup_/tests.py +17 -0
- django_mongodb_backend-5.0.0a3/tests/model_fields_/__init__.py +0 -0
- django_mongodb_backend-5.0.0a3/tests/model_fields_/array_default_migrations/0001_initial.py +30 -0
- django_mongodb_backend-5.0.0a3/tests/model_fields_/array_default_migrations/0002_integerarraymodel_field_2.py +20 -0
- django_mongodb_backend-5.0.0a3/tests/model_fields_/array_default_migrations/__init__.py +0 -0
- django_mongodb_backend-5.0.0a3/tests/model_fields_/array_index_migrations/0001_initial.py +37 -0
- django_mongodb_backend-5.0.0a3/tests/model_fields_/array_index_migrations/__init__.py +0 -0
- django_mongodb_backend-5.0.0a3/tests/model_fields_/models.py +121 -0
- django_mongodb_backend-5.0.0a3/tests/model_fields_/test_arrayfield.py +882 -0
- django_mongodb_backend-5.0.0a3/tests/model_fields_/test_autofield.py +20 -0
- django_mongodb_backend-5.0.0a3/tests/model_fields_/test_embedded_model.py +125 -0
- django_mongodb_backend-5.0.0a3/tests/model_fields_/test_objectidfield.py +130 -0
- django_mongodb_backend-5.0.0a3/tests/model_forms_/__init__.py +0 -0
- django_mongodb_backend-5.0.0a3/tests/model_forms_/forms.py +9 -0
- django_mongodb_backend-5.0.0a3/tests/model_forms_/models.py +22 -0
- django_mongodb_backend-5.0.0a3/tests/model_forms_/test_embedded_model.py +130 -0
- django_mongodb_backend-5.0.0a3/tests/queries_/__init__.py +0 -0
- django_mongodb_backend-5.0.0a3/tests/queries_/models.py +55 -0
- django_mongodb_backend-5.0.0a3/tests/queries_/test_mql.py +26 -0
- django_mongodb_backend-5.0.0a3/tests/queries_/test_objectid.py +111 -0
- django_mongodb_backend-5.0.0a3/tests/raw_query_/__init__.py +0 -0
- django_mongodb_backend-5.0.0a3/tests/raw_query_/models.py +60 -0
- django_mongodb_backend-5.0.0a3/tests/raw_query_/test_raw_aggregate.py +310 -0
- django_mongodb_backend-5.0.0a3/tests/schema_/__init__.py +0 -0
- django_mongodb_backend-5.0.0a3/tests/schema_/models.py +37 -0
- django_mongodb_backend-5.0.0a3/tests/schema_/test_embedded_model.py +629 -0
|
@@ -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
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/bash
|
|
2
|
+
|
|
3
|
+
set -eux
|
|
4
|
+
|
|
5
|
+
# Install 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
|
|
@@ -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
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
# GitHub Actions
|
|
4
|
+
- package-ecosystem: "github-actions"
|
|
5
|
+
directory: "/"
|
|
6
|
+
schedule:
|
|
7
|
+
interval: "weekly"
|
|
8
|
+
groups:
|
|
9
|
+
actions:
|
|
10
|
+
patterns:
|
|
11
|
+
- "*"
|
|
12
|
+
# Python
|
|
13
|
+
- package-ecosystem: "pip"
|
|
14
|
+
directory: "/"
|
|
15
|
+
schedule:
|
|
16
|
+
interval: "weekly"
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# For most projects, this workflow file will not need changing; you simply need
|
|
2
|
+
# to commit it to your repository.
|
|
3
|
+
#
|
|
4
|
+
# You may wish to alter this file to override the set of languages analyzed,
|
|
5
|
+
# or to provide custom queries or build logic.
|
|
6
|
+
#
|
|
7
|
+
# ******** NOTE ********
|
|
8
|
+
# We have attempted to detect the languages in your repository. Please check
|
|
9
|
+
# the `language` matrix defined below to confirm you have the correct set of
|
|
10
|
+
# supported CodeQL languages.
|
|
11
|
+
#
|
|
12
|
+
name: "CodeQL"
|
|
13
|
+
|
|
14
|
+
on:
|
|
15
|
+
push:
|
|
16
|
+
branches: [ "main", "*" ]
|
|
17
|
+
pull_request:
|
|
18
|
+
branches: [ "main", "*" ]
|
|
19
|
+
schedule:
|
|
20
|
+
- cron: '35 23 * * 5'
|
|
21
|
+
workflow_call:
|
|
22
|
+
inputs:
|
|
23
|
+
ref:
|
|
24
|
+
required: true
|
|
25
|
+
type: string
|
|
26
|
+
|
|
27
|
+
jobs:
|
|
28
|
+
analyze:
|
|
29
|
+
name: Analyze
|
|
30
|
+
runs-on: ubuntu-latest
|
|
31
|
+
timeout-minutes: 360
|
|
32
|
+
permissions:
|
|
33
|
+
# required for all workflows
|
|
34
|
+
security-events: write
|
|
35
|
+
# required to fetch internal or private CodeQL packs
|
|
36
|
+
packages: read
|
|
37
|
+
actions: read
|
|
38
|
+
contents: read
|
|
39
|
+
|
|
40
|
+
steps:
|
|
41
|
+
- name: Checkout repository
|
|
42
|
+
uses: actions/checkout@v4
|
|
43
|
+
with:
|
|
44
|
+
ref: ${{ inputs.ref }}
|
|
45
|
+
persist-credentials: false
|
|
46
|
+
- name: Set up Python
|
|
47
|
+
uses: actions/setup-python@v5
|
|
48
|
+
with:
|
|
49
|
+
python-version: 3.x
|
|
50
|
+
|
|
51
|
+
# Initializes the CodeQL tools for scanning.
|
|
52
|
+
- name: Initialize CodeQL
|
|
53
|
+
uses: github/codeql-action/init@v3
|
|
54
|
+
with:
|
|
55
|
+
languages: python
|
|
56
|
+
build-mode: none
|
|
57
|
+
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
|
|
58
|
+
queries: security-extended
|
|
59
|
+
config: |
|
|
60
|
+
paths-ignore:
|
|
61
|
+
- '.github/**'
|
|
62
|
+
- 'tests/**'
|
|
63
|
+
|
|
64
|
+
- shell: bash
|
|
65
|
+
run: |
|
|
66
|
+
pip install -e .
|
|
67
|
+
|
|
68
|
+
- name: Perform CodeQL Analysis
|
|
69
|
+
uses: github/codeql-action/analyze@v3
|
|
70
|
+
with:
|
|
71
|
+
category: "/language:python"
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: Python Dist
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
workflow_call:
|
|
6
|
+
inputs:
|
|
7
|
+
ref:
|
|
8
|
+
required: true
|
|
9
|
+
type: string
|
|
10
|
+
push:
|
|
11
|
+
tags:
|
|
12
|
+
- "[0-9]+.[0-9]+.[0-9]+"
|
|
13
|
+
- "[0-9]+.[0-9]+.[0-9]+.post[0-9]+"
|
|
14
|
+
- "[0-9]+.[0-9]+.[0-9]+[a-b][0-9]+"
|
|
15
|
+
- "[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
build:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
environment: release
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v4
|
|
23
|
+
with:
|
|
24
|
+
ref: ${{ inputs.ref }}
|
|
25
|
+
persist-credentials: false
|
|
26
|
+
- name: Set up Python
|
|
27
|
+
uses: actions/setup-python@v5
|
|
28
|
+
with:
|
|
29
|
+
python-version: 3.x
|
|
30
|
+
- name: Install dependencies
|
|
31
|
+
run: pip install build
|
|
32
|
+
- name: Create packages
|
|
33
|
+
run: python -m build .
|
|
34
|
+
- name: Store package artifacts
|
|
35
|
+
uses: actions/upload-artifact@v4
|
|
36
|
+
with:
|
|
37
|
+
name: all-dist-${{ github.run_id }}
|
|
38
|
+
path: "dist/*"
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
name: Linters
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
workflow_dispatch:
|
|
6
|
+
|
|
7
|
+
concurrency:
|
|
8
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
9
|
+
cancel-in-progress: true
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
lint:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
with:
|
|
17
|
+
persist-credentials: false
|
|
18
|
+
- uses: actions/setup-python@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: '3.10'
|
|
21
|
+
cache: 'pip'
|
|
22
|
+
cache-dependency-path: 'pyproject.toml'
|
|
23
|
+
- name: Install Python dependencies
|
|
24
|
+
run: |
|
|
25
|
+
python -m pip install -U pip pre-commit
|
|
26
|
+
- name: Run linters
|
|
27
|
+
run: |
|
|
28
|
+
pre-commit run --hook-stage=manual --all-files
|
|
29
|
+
docs:
|
|
30
|
+
name: Docs Checks
|
|
31
|
+
runs-on: ubuntu-latest
|
|
32
|
+
steps:
|
|
33
|
+
- uses: actions/checkout@v4
|
|
34
|
+
with:
|
|
35
|
+
persist-credentials: false
|
|
36
|
+
- uses: actions/setup-python@v5
|
|
37
|
+
with:
|
|
38
|
+
cache: 'pip'
|
|
39
|
+
cache-dependency-path: 'pyproject.toml'
|
|
40
|
+
python-version: '3.10'
|
|
41
|
+
- name: Install dependencies
|
|
42
|
+
run: |
|
|
43
|
+
pip install -U pip
|
|
44
|
+
pip install -e ".[docs]"
|
|
45
|
+
- name: Build docs
|
|
46
|
+
run: |
|
|
47
|
+
cd docs
|
|
48
|
+
make html
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
DATABASES = {
|
|
2
|
+
"default": {
|
|
3
|
+
"ENGINE": "django_mongodb_backend",
|
|
4
|
+
"NAME": "djangotests",
|
|
5
|
+
},
|
|
6
|
+
"other": {
|
|
7
|
+
"ENGINE": "django_mongodb_backend",
|
|
8
|
+
"NAME": "djangotests-other",
|
|
9
|
+
},
|
|
10
|
+
}
|
|
11
|
+
DEFAULT_AUTO_FIELD = "django_mongodb_backend.fields.ObjectIdAutoField"
|
|
12
|
+
PASSWORD_HASHERS = ("django.contrib.auth.hashers.MD5PasswordHasher",)
|
|
13
|
+
SECRET_KEY = "django_tests_secret_key"
|
|
14
|
+
USE_TZ = False
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
version:
|
|
7
|
+
description: "The new version to set"
|
|
8
|
+
required: true
|
|
9
|
+
following_version:
|
|
10
|
+
description: "The post (dev) version to set"
|
|
11
|
+
required: false
|
|
12
|
+
dry_run:
|
|
13
|
+
description: "Dry Run?"
|
|
14
|
+
default: false
|
|
15
|
+
type: boolean
|
|
16
|
+
|
|
17
|
+
env:
|
|
18
|
+
# Changes per repo
|
|
19
|
+
PRODUCT_NAME: django-mongodb-backend
|
|
20
|
+
# Changes per branch
|
|
21
|
+
SILK_ASSET_GROUP: django-mongodb-backend-main
|
|
22
|
+
EVERGREEN_PROJECT: django-mongodb-backend
|
|
23
|
+
|
|
24
|
+
defaults:
|
|
25
|
+
run:
|
|
26
|
+
shell: bash -eux {0}
|
|
27
|
+
|
|
28
|
+
jobs:
|
|
29
|
+
pre-publish:
|
|
30
|
+
environment: release
|
|
31
|
+
runs-on: ubuntu-latest
|
|
32
|
+
permissions:
|
|
33
|
+
id-token: write
|
|
34
|
+
contents: write
|
|
35
|
+
outputs:
|
|
36
|
+
version: ${{ steps.pre-publish.outputs.version }}
|
|
37
|
+
steps:
|
|
38
|
+
- uses: mongodb-labs/drivers-github-tools/secure-checkout@v2
|
|
39
|
+
with:
|
|
40
|
+
app_id: ${{ vars.APP_ID }}
|
|
41
|
+
private_key: ${{ secrets.APP_PRIVATE_KEY }}
|
|
42
|
+
- uses: mongodb-labs/drivers-github-tools/setup@v2
|
|
43
|
+
with:
|
|
44
|
+
aws_role_arn: ${{ secrets.AWS_ROLE_ARN }}
|
|
45
|
+
aws_region_name: ${{ vars.AWS_REGION_NAME }}
|
|
46
|
+
aws_secret_id: ${{ secrets.AWS_SECRET_ID }}
|
|
47
|
+
artifactory_username: ${{ vars.ARTIFACTORY_USERNAME }}
|
|
48
|
+
- uses: mongodb-labs/drivers-github-tools/python/pre-publish@v2
|
|
49
|
+
id: pre-publish
|
|
50
|
+
with:
|
|
51
|
+
version: ${{ inputs.version }}
|
|
52
|
+
dry_run: ${{ inputs.dry_run }}
|
|
53
|
+
|
|
54
|
+
build-dist:
|
|
55
|
+
needs: [pre-publish]
|
|
56
|
+
uses: ./.github/workflows/dist.yml
|
|
57
|
+
with:
|
|
58
|
+
ref: ${{ needs.pre-publish.outputs.version }}
|
|
59
|
+
|
|
60
|
+
static-scan:
|
|
61
|
+
needs: [pre-publish]
|
|
62
|
+
uses: ./.github/workflows/codeql.yml
|
|
63
|
+
with:
|
|
64
|
+
ref: ${{ needs.pre-publish.outputs.version }}
|
|
65
|
+
|
|
66
|
+
publish:
|
|
67
|
+
needs: [build-dist, static-scan]
|
|
68
|
+
name: Upload release to PyPI
|
|
69
|
+
runs-on: ubuntu-latest
|
|
70
|
+
environment: release
|
|
71
|
+
permissions:
|
|
72
|
+
id-token: write
|
|
73
|
+
steps:
|
|
74
|
+
- name: Download all the dists
|
|
75
|
+
uses: actions/download-artifact@v4
|
|
76
|
+
with:
|
|
77
|
+
name: all-dist-${{ github.run_id }}
|
|
78
|
+
path: dist/
|
|
79
|
+
- name: Publish package distributions to PyPI
|
|
80
|
+
if: startsWith(inputs.dry_run, 'false')
|
|
81
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
82
|
+
|
|
83
|
+
post-publish:
|
|
84
|
+
needs: [publish]
|
|
85
|
+
runs-on: ubuntu-latest
|
|
86
|
+
environment: release
|
|
87
|
+
permissions:
|
|
88
|
+
id-token: write
|
|
89
|
+
contents: write
|
|
90
|
+
attestations: write
|
|
91
|
+
security-events: write
|
|
92
|
+
steps:
|
|
93
|
+
- uses: mongodb-labs/drivers-github-tools/secure-checkout@v2
|
|
94
|
+
with:
|
|
95
|
+
app_id: ${{ vars.APP_ID }}
|
|
96
|
+
private_key: ${{ secrets.APP_PRIVATE_KEY }}
|
|
97
|
+
- uses: mongodb-labs/drivers-github-tools/setup@v2
|
|
98
|
+
with:
|
|
99
|
+
aws_role_arn: ${{ secrets.AWS_ROLE_ARN }}
|
|
100
|
+
aws_region_name: ${{ vars.AWS_REGION_NAME }}
|
|
101
|
+
aws_secret_id: ${{ secrets.AWS_SECRET_ID }}
|
|
102
|
+
artifactory_username: ${{ vars.ARTIFACTORY_USERNAME }}
|
|
103
|
+
- uses: mongodb-labs/drivers-github-tools/python/post-publish@v2
|
|
104
|
+
with:
|
|
105
|
+
version: ${{ inputs.version }}
|
|
106
|
+
following_version: ${{ inputs.following_version }}
|
|
107
|
+
product_name: ${{ env.PRODUCT_NAME }}
|
|
108
|
+
silk_asset_group: ${{ env.SILK_ASSET_GROUP }}
|
|
109
|
+
evergreen_project: ${{ env.EVERGREEN_PROJECT }}
|
|
110
|
+
token: ${{ github.token }}
|
|
111
|
+
repository_url: https://test.pypi.org/legacy/
|
|
112
|
+
dry_run: ${{ inputs.dry_run }}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
import os
|
|
3
|
+
import pathlib
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
test_apps = [
|
|
7
|
+
"admin_changelist",
|
|
8
|
+
"admin_checks",
|
|
9
|
+
"admin_custom_urls",
|
|
10
|
+
"admin_docs",
|
|
11
|
+
"admin_filters",
|
|
12
|
+
"admin_inlines",
|
|
13
|
+
"admin_ordering",
|
|
14
|
+
"admin_scripts",
|
|
15
|
+
"admin_utils",
|
|
16
|
+
"admin_views",
|
|
17
|
+
"admin_widgets",
|
|
18
|
+
"aggregation",
|
|
19
|
+
"aggregation_regress",
|
|
20
|
+
"annotations",
|
|
21
|
+
"apps",
|
|
22
|
+
"async",
|
|
23
|
+
"auth_tests",
|
|
24
|
+
"backends",
|
|
25
|
+
"basic",
|
|
26
|
+
"bulk_create",
|
|
27
|
+
"cache",
|
|
28
|
+
"check_framework",
|
|
29
|
+
"constraints",
|
|
30
|
+
"contenttypes_tests",
|
|
31
|
+
"context_processors",
|
|
32
|
+
"custom_columns",
|
|
33
|
+
"custom_lookups",
|
|
34
|
+
"custom_managers",
|
|
35
|
+
"custom_pk",
|
|
36
|
+
"datatypes",
|
|
37
|
+
"dates",
|
|
38
|
+
"datetimes",
|
|
39
|
+
"db_functions",
|
|
40
|
+
"defer",
|
|
41
|
+
"defer_regress",
|
|
42
|
+
"delete",
|
|
43
|
+
"delete_regress",
|
|
44
|
+
"empty",
|
|
45
|
+
"empty_models",
|
|
46
|
+
"expressions",
|
|
47
|
+
"expressions_case",
|
|
48
|
+
"field_defaults",
|
|
49
|
+
"file_storage",
|
|
50
|
+
"file_uploads",
|
|
51
|
+
"fixtures",
|
|
52
|
+
"fixtures_model_package",
|
|
53
|
+
"fixtures_regress",
|
|
54
|
+
"flatpages_tests",
|
|
55
|
+
"force_insert_update",
|
|
56
|
+
"foreign_object",
|
|
57
|
+
"forms_tests",
|
|
58
|
+
"from_db_value",
|
|
59
|
+
"generic_inline_admin",
|
|
60
|
+
"generic_relations",
|
|
61
|
+
"generic_relations_regress",
|
|
62
|
+
"generic_views",
|
|
63
|
+
"get_earliest_or_latest",
|
|
64
|
+
"get_object_or_404",
|
|
65
|
+
"get_or_create",
|
|
66
|
+
"i18n",
|
|
67
|
+
"indexes",
|
|
68
|
+
"inline_formsets",
|
|
69
|
+
"introspection",
|
|
70
|
+
"invalid_models_tests",
|
|
71
|
+
"known_related_objects",
|
|
72
|
+
"lookup",
|
|
73
|
+
"m2m_and_m2o",
|
|
74
|
+
"m2m_intermediary",
|
|
75
|
+
"m2m_multiple",
|
|
76
|
+
"m2m_recursive",
|
|
77
|
+
"m2m_regress",
|
|
78
|
+
"m2m_signals",
|
|
79
|
+
"m2m_through",
|
|
80
|
+
"m2m_through_regress",
|
|
81
|
+
"m2o_recursive",
|
|
82
|
+
"managers_regress",
|
|
83
|
+
"many_to_many",
|
|
84
|
+
"many_to_one",
|
|
85
|
+
"many_to_one_null",
|
|
86
|
+
"max_lengths",
|
|
87
|
+
"messages_tests",
|
|
88
|
+
"migrate_signals",
|
|
89
|
+
"migration_test_data_persistence",
|
|
90
|
+
"migrations",
|
|
91
|
+
"model_fields",
|
|
92
|
+
"model_forms",
|
|
93
|
+
"model_formsets",
|
|
94
|
+
"model_formsets_regress",
|
|
95
|
+
"model_indexes",
|
|
96
|
+
"model_inheritance",
|
|
97
|
+
"model_inheritance_regress",
|
|
98
|
+
"model_options",
|
|
99
|
+
"model_package",
|
|
100
|
+
"model_regress",
|
|
101
|
+
"model_utils",
|
|
102
|
+
"modeladmin",
|
|
103
|
+
"multiple_database",
|
|
104
|
+
"mutually_referential",
|
|
105
|
+
"nested_foreign_keys",
|
|
106
|
+
"null_fk",
|
|
107
|
+
"null_fk_ordering",
|
|
108
|
+
"null_queries",
|
|
109
|
+
"one_to_one",
|
|
110
|
+
"or_lookups",
|
|
111
|
+
"order_with_respect_to",
|
|
112
|
+
"ordering",
|
|
113
|
+
"pagination",
|
|
114
|
+
"prefetch_related",
|
|
115
|
+
"proxy_model_inheritance",
|
|
116
|
+
"proxy_models",
|
|
117
|
+
"queries",
|
|
118
|
+
"queryset_pickle",
|
|
119
|
+
"redirects_tests",
|
|
120
|
+
"reserved_names",
|
|
121
|
+
"reverse_lookup",
|
|
122
|
+
"save_delete_hooks",
|
|
123
|
+
"schema",
|
|
124
|
+
"select_for_update",
|
|
125
|
+
"select_related",
|
|
126
|
+
"select_related_onetoone",
|
|
127
|
+
"select_related_regress",
|
|
128
|
+
"serializers",
|
|
129
|
+
"servers",
|
|
130
|
+
"sessions_tests",
|
|
131
|
+
"shortcuts",
|
|
132
|
+
"signals",
|
|
133
|
+
"sitemaps_tests",
|
|
134
|
+
"sites_framework",
|
|
135
|
+
"sites_tests",
|
|
136
|
+
"string_lookup",
|
|
137
|
+
"swappable_models",
|
|
138
|
+
"syndication_tests",
|
|
139
|
+
"test_client",
|
|
140
|
+
"test_client_regress",
|
|
141
|
+
"test_runner",
|
|
142
|
+
"test_utils",
|
|
143
|
+
"timezones",
|
|
144
|
+
"transactions",
|
|
145
|
+
"unmanaged_models",
|
|
146
|
+
"update",
|
|
147
|
+
"update_only_fields",
|
|
148
|
+
"user_commands",
|
|
149
|
+
"validation",
|
|
150
|
+
"view_tests",
|
|
151
|
+
"xor_lookups",
|
|
152
|
+
# Add directories in django_mongodb_backend/tests
|
|
153
|
+
*sorted(
|
|
154
|
+
[
|
|
155
|
+
x.name
|
|
156
|
+
for x in (pathlib.Path(__file__).parent.parent.parent.resolve() / "tests").iterdir()
|
|
157
|
+
]
|
|
158
|
+
),
|
|
159
|
+
]
|
|
160
|
+
runtests = pathlib.Path(__file__).parent.resolve() / "runtests.py"
|
|
161
|
+
run_tests_cmd = f"python3 {runtests} %s --settings mongodb_settings -v 2"
|
|
162
|
+
|
|
163
|
+
shouldFail = False
|
|
164
|
+
for app_name in test_apps:
|
|
165
|
+
res = os.system(run_tests_cmd % app_name) # noqa: S605
|
|
166
|
+
if res != 0:
|
|
167
|
+
shouldFail = True
|
|
168
|
+
sys.exit(1 if shouldFail else 0)
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
name: Python Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
paths:
|
|
6
|
+
- '**.py'
|
|
7
|
+
- '!setup.py'
|
|
8
|
+
- '.github/workflows/test-python.yml'
|
|
9
|
+
workflow_dispatch:
|
|
10
|
+
|
|
11
|
+
concurrency:
|
|
12
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
13
|
+
cancel-in-progress: true
|
|
14
|
+
|
|
15
|
+
defaults:
|
|
16
|
+
run:
|
|
17
|
+
shell: bash -eux {0}
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
build:
|
|
21
|
+
name: Django Test Suite
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
steps:
|
|
24
|
+
- name: Checkout django-mongodb-backend
|
|
25
|
+
uses: actions/checkout@v4
|
|
26
|
+
with:
|
|
27
|
+
persist-credentials: false
|
|
28
|
+
- name: install django-mongodb-backend
|
|
29
|
+
run: |
|
|
30
|
+
pip3 install --upgrade pip
|
|
31
|
+
pip3 install -e .
|
|
32
|
+
- name: Checkout Django
|
|
33
|
+
uses: actions/checkout@v4
|
|
34
|
+
with:
|
|
35
|
+
repository: 'mongodb-forks/django'
|
|
36
|
+
ref: 'mongodb-5.0.x'
|
|
37
|
+
path: 'django_repo'
|
|
38
|
+
persist-credentials: false
|
|
39
|
+
- name: Install system packages for Django's Python test dependencies
|
|
40
|
+
run: |
|
|
41
|
+
sudo apt-get update
|
|
42
|
+
sudo apt-get install libmemcached-dev
|
|
43
|
+
- name: Install Django and its Python test dependencies
|
|
44
|
+
run: |
|
|
45
|
+
cd django_repo/tests/
|
|
46
|
+
pip3 install -e ..
|
|
47
|
+
pip3 install -r requirements/py3.txt
|
|
48
|
+
- name: Copy the test settings file
|
|
49
|
+
run: cp .github/workflows/mongodb_settings.py django_repo/tests/
|
|
50
|
+
- name: Copy the test runner file
|
|
51
|
+
run: cp .github/workflows/runtests.py django_repo/tests/runtests_.py
|
|
52
|
+
- name: Start MongoDB
|
|
53
|
+
uses: supercharge/mongodb-github-action@1.12.0
|
|
54
|
+
with:
|
|
55
|
+
mongodb-version: 5.0
|
|
56
|
+
- name: Run tests
|
|
57
|
+
run: python3 django_repo/tests/runtests_.py
|