Skip to content

Commit acf3f9a

Browse files
committed
fix CI
1 parent e51ee40 commit acf3f9a

File tree

5 files changed

+72
-108
lines changed

5 files changed

+72
-108
lines changed

.github/workflows/github-actions.yml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,11 @@ on:
1313
tags:
1414
- 'v[0-9]+\.[0-9]+\.[0-9]+*'
1515
env:
16-
MONGODB_3_6: "3.6.23"
17-
MONGODB_4_0: "4.0.28"
18-
MONGODB_4_2: "4.2.25"
1916
MONGODB_4_4: "4.4.29"
2017
MONGODB_5_0: "5.0.31"
21-
MONGODB_6_0: "6.0.20"
22-
MONGODB_7_0: "7.0.17"
23-
MONGODB_8_0: "8.0.5"
18+
MONGODB_6_0: "6.0.22"
19+
MONGODB_7_0: "7.0.19"
20+
MONGODB_8_0: "8.0.9"
2421

2522
PYMONGO_3_12: "3.12.3"
2623
PYMONGO_3_13: "3.13.0"
@@ -36,8 +33,6 @@ env:
3633

3734
MAIN_PYTHON_VERSION: "3.9"
3835

39-
MONGOSH: "2.4.2" # Needed for MongoDB 6.0+
40-
4136
jobs:
4237
linting:
4338
# Run pre-commit (https://pre-commit.com/)
@@ -55,17 +50,14 @@ jobs:
5550
test:
5651
# Test suite run against recent python versions
5752
# and against a few combination of MongoDB and pymongo
58-
runs-on: ubuntu-20.04
53+
runs-on: ubuntu-22.04
5954
strategy:
6055
fail-fast: false
6156
matrix:
6257
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "pypy3.9", "pypy3.10"]
63-
MONGODB: [$MONGODB_4_0]
58+
MONGODB: [$MONGODB_4_4]
6459
PYMONGO: [$PYMONGO_3_12]
6560
include:
66-
- python-version: "3.9"
67-
MONGODB: $MONGODB_3_6
68-
PYMONGO: $PYMONGO_3_12
6961
- python-version: "3.9"
7062
MONGODB: $MONGODB_4_4
7163
PYMONGO: $PYMONGO_3_13
@@ -115,7 +107,6 @@ jobs:
115107
- name: install mongo and ci dependencies
116108
run: |
117109
bash .github/workflows/install_mongo.sh ${{ matrix.MONGODB }}
118-
bash .github/workflows/install_mongosh.sh ${{ matrix.MONGODB }} ${{ env.MONGOSH }}
119110
bash .github/workflows/install_ci_python_dep.sh
120111
bash .github/workflows/start_mongo.sh ${{ matrix.MONGODB }}
121112
- name: tox dry-run (to pre-install venv)

.github/workflows/install_mongo.sh

Lines changed: 56 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,49 +4,79 @@ set -e # Exit immediately if a command exits with a non-zero status
44
set -u # Treat unset variables as an error
55

66
if [ "$#" -ne 1 ]; then
7-
echo "Usage: $0 <mongodb-version>"
8-
echo "Example: $0 8.0.5"
7+
echo >&2 "Usage: $0 <mongodb-version>"
8+
echo >&2 "Example: $0 8.0.5"
99
exit 1
1010
fi
1111

1212
MONGODB="$1"
13+
MONGOSH=2.5.1
1314

1415
# Determine build name based on version
15-
if [[ "${MONGODB}" =~ ^(7.0|8.0) ]]; then
16+
if [[ "$MONGODB" =~ ^(6.0|7.0|8.0) ]]; then
17+
mongo_build="mongodb-linux-x86_64-ubuntu2204-${MONGODB}"
18+
elif [[ "$MONGODB" =~ ^(4.4|5.0) ]]; then
1619
mongo_build="mongodb-linux-x86_64-ubuntu2004-${MONGODB}"
17-
elif [[ "${MONGODB}" =~ ^(4.0|4.2|4.4|5.0|6.0) ]]; then
18-
mongo_build="mongodb-linux-x86_64-ubuntu1804-${MONGODB}"
19-
elif [[ "${MONGODB}" =~ ^3.6 ]]; then
20-
mongo_build="mongodb-linux-x86_64-${MONGODB}"
2120
else
22-
echo "Error: Unsupported MongoDB version: ${MONGODB}"
21+
echo >&2 "Error: Unsupported MongoDB version: ${MONGODB}"
2322
usage
2423
fi
2524

26-
download_url="http://fastdl.mongodb.org/linux/${mongo_build}.tgz"
27-
tarball="${mongo_build}.tgz"
25+
mongo_tarball="${mongo_build}.tgz"
26+
mongo_download_url="http://fastdl.mongodb.org/linux/${mongo_tarball}"
2827

29-
echo "Downloading MongoDB from ${download_url}..."
30-
if ! wget --quiet "${download_url}"; then
31-
echo "Error: Failed to download MongoDB."
32-
exit 1
33-
fi
28+
mongosh_build="mongosh-${MONGOSH}-linux-x64"
29+
mongosh_tarball="${mongosh_build}.tgz"
30+
mongosh_download_url="https://github.com/mongodb-js/mongosh/releases/download/v${MONGOSH}/${mongosh_tarball}"
31+
32+
set -- \
33+
MongoDB "$mongo_tarball" "$mongo_download_url" \
34+
"MongoDB Shell" "$mongosh_tarball" "$mongosh_download_url"
35+
36+
while (( $# > 0 )) ; do
37+
name="$1"
38+
tarball="$2"
39+
download_url="$3"
40+
shift 3
41+
42+
echo >&2 "Downloading ${name} from ${download_url}..."
43+
if ! wget --quiet "$download_url"; then
44+
echo >&2 "Error: Failed to download ${name}."
45+
exit 1
46+
fi
3447

35-
echo "Extracting ${tarball}..."
36-
if ! tar xzf "${tarball}"; then
37-
echo "Error: Failed to extract ${tarball}"
48+
echo >&2 "Extracting ${tarball}..."
49+
if ! tar xzf "${tarball}"; then
50+
echo >&2 "Error: Failed to extract ${tarball}"
51+
exit 1
52+
fi
53+
done
54+
55+
mongodb_dir=$(find "${PWD}/" -type d -name "mongodb-linux-x86_64*" -print -quit)
56+
if [ -z "$mongodb_dir" ]; then
57+
echo >&2 "Error: Could not find MongoDB directory after extraction."
3858
exit 1
3959
fi
4060

41-
mongodb_dir=$(find "${PWD}/" -type d -name "mongodb-linux-x86_64*" | head -n 1)
42-
if [ -z "${mongodb_dir}" ]; then
43-
echo "Error: Could not find MongoDB directory after extraction."
44-
exit 1
61+
mongosh_dir=$(find "${PWD}/" -type d -name "$mongosh_build" -print -quit)
62+
if [ ! -d "$mongosh_dir" ]; then
63+
echo >&2 "Failed to find extracted mongosh directory."
64+
rm -f "$TARBALL"
65+
exit 1
4566
fi
4667

47-
echo "MongoDB installed at: ${mongodb_dir}"
48-
"${mongodb_dir}/bin/mongod" --version
68+
echo >&2 "Creating mongo.path"
69+
echo "export PATH='${mongodb_dir}/bin:${mongosh_dir}/bin:'"'$PATH' \
70+
| tee >&2 mongo.path
71+
72+
. mongo.path
73+
74+
echo >&2 "MongoDB installed at: ${mongodb_dir}"
75+
mongod >&2 --version
76+
77+
echo >&2 "Testing mongosh installation..."
78+
mongosh >&2 --version
4979

5080
# Cleanup
51-
echo "Cleaning up..."
52-
rm -f "${tarball}"
81+
echo >&2 "Cleaning up..."
82+
rm -f "$mongo_tarball" "$mongosh_tarball"

.github/workflows/install_mongosh.sh

Lines changed: 0 additions & 56 deletions
This file was deleted.

.github/workflows/start_mongo.sh

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
#!/bin/bash
22

3+
set -e # Exit immediately if a command exits with a non-zero status
4+
set -u # Treat unset variables as an error
5+
6+
. mongo.path
7+
38
MONGODB=$1
49

5-
mongodb_dir=$(find ${PWD}/ -type d -name "mongodb-linux-x86_64*")
10+
mongodb_dir=$(find ${PWD}/ -type d -name "mongodb-linux-x86_64*" -quit)
611

712
mkdir $mongodb_dir/data
813

@@ -15,12 +20,6 @@ if [ "$MAJOR" -gt 3 ] || ([ "$MAJOR" -eq 3 ] && [ "$MINOR" -ge 8 ]); then
1520
args+=(--setParameter maxTransactionLockRequestTimeoutMillis=1000)
1621
fi
1722

18-
$mongodb_dir/bin/mongod "${args[@]}"
19-
20-
if [ "$MAJOR" -lt 6 ]; then
21-
mongo --verbose --eval "rs.initiate()"
22-
mongo --quiet --eval "rs.status().ok"
23-
else
23+
mongod "${args[@]}"
2424
mongosh --verbose --eval "rs.initiate()"
2525
mongosh --quiet --eval "rs.status().ok"
26-
fi

README.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ an `API reference <https://mongoengine-odm.readthedocs.io/apireference.html>`_.
3535

3636
Supported MongoDB Versions
3737
==========================
38-
MongoEngine is currently tested against MongoDB v3.6, v4.0, v4.4, v5.0, v6.0, v7.0 and v8.0. Future versions
39-
should be supported as well, but aren't actively tested at the moment. Make
40-
sure to open an issue or submit a pull request if you experience any problems
41-
with a more recent MongoDB versions.
38+
MongoEngine is currently tested against MongoDB v4.4, v5.0, v6.0, v7.0 and
39+
v8.0. Future versions should be supported as well, but aren't actively tested
40+
at the moment. Make sure to open an issue or submit a pull request if you
41+
experience any problems with a more recent MongoDB versions.
4242

4343
Installation
4444
============

0 commit comments

Comments
 (0)