Skip to content

Commit

Permalink
Merge pull request #2826 from vtomasr5/support-pymongo-4.7-and-4.8
Browse files Browse the repository at this point in the history
Add pymongo 4.7 and pymongo 4.8 to the CI
  • Loading branch information
bagerard authored Aug 14, 2024
2 parents 9e3f1d9 + 04f7f88 commit e9a12ef
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 2 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@ env:
PYMONGO_4_3: 4.3.3
PYMONGO_4_4: 4.4.1
PYMONGO_4_6: 4.6.2
PYMONGO_4_7: 4.7.3
PYMONGO_4_8: 4.8.0

MAIN_PYTHON_VERSION: 3.9

MONGOSH: 2.2.15 # Needed for MongoDB 6.0+

jobs:
linting:
# Run pre-commit (https://pre-commit.com/)
Expand Down Expand Up @@ -78,6 +82,12 @@ jobs:
- python-version: "3.11"
MONGODB: $MONGODB_7_0
PYMONGO: $PYMONGO_4_6
- python-version: "3.11"
MONGODB: $MONGODB_7_0
PYMONGO: $PYMONGO_4_7
- python-version: "3.11"
MONGODB: $MONGODB_7_0
PYMONGO: $PYMONGO_4_8
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -88,6 +98,7 @@ jobs:
- name: install mongo and ci dependencies
run: |
bash .github/workflows/install_mongo.sh ${{ matrix.MONGODB }}
bash .github/workflows/install_mongosh.sh ${{ matrix.MONGODB }} ${{ env.MONGOSH }}
bash .github/workflows/install_ci_python_dep.sh
bash .github/workflows/start_mongo.sh ${{ matrix.MONGODB }}
- name: tox dry-run (to pre-install venv)
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/install_mongosh.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

MONGODB=$1
MONGOSH=$2

if (( $(echo "$MONGODB < 6.0" | bc -l) )); then
echo "mongosh is not needed for MongoDB versions less than 6.0"
exit 0
fi

wget https://downloads.mongodb.com/compass/mongosh-${MONGOSH}-linux-x64.tgz
tar xzf mongosh-${MONGOSH}-linux-x64.tgz

mongosh_dir=$(find ${PWD}/ -type d -name "mongosh-${MONGOSH}-linux-x64")
$mongosh_dir/bin/mongosh --version
7 changes: 6 additions & 1 deletion .github/workflows/start_mongo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,9 @@ mongodb_dir=$(find ${PWD}/ -type d -name "mongodb-linux-x86_64*")

mkdir $mongodb_dir/data
$mongodb_dir/bin/mongod --dbpath $mongodb_dir/data --logpath $mongodb_dir/mongodb.log --fork
mongo --eval 'db.version();' # Make sure mongo is awake

if (( $(echo "$MONGODB < 6.0" | bc -l) )); then
mongo --quiet --eval 'db.runCommand("ping").ok' # Make sure mongo is awake
else
mongosh --quiet --eval 'db.runCommand("ping").ok' # Make sure mongo is awake
fi
4 changes: 3 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = pypy3-{mg34,mg36,mg39,mg311,mg312,mg4,mg432,mg441,mg460}
envlist = pypy3-{mg34,mg36,mg39,mg311,mg312,mg4,mg432,mg441,mg462,mg473,mg480}
skipsdist = True

[testenv]
Expand All @@ -14,5 +14,7 @@ deps =
mg433: pymongo>=4.3,<4.4
mg441: pymongo>=4.4,<4.5
mg462: pymongo>=4.6,<4.7
mg473: pymongo>=4.7,<4.8
mg480: pymongo>=4.8,<4.9
setenv =
PYTHON_EGG_CACHE = {envdir}/python-eggs

0 comments on commit e9a12ef

Please sign in to comment.