Skip to content

Commit bc540e3

Browse files
committed
try this approach
1 parent 18685e8 commit bc540e3

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

.github/workflows/test-python.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ defaults:
1313
run:
1414
shell: bash -eux {0}
1515

16+
env:
17+
MONGODB_VERSION: 8.0
18+
1619
jobs:
1720
build:
18-
# supercharge/mongodb-github-action requires containers so we don't test other platforms
1921
runs-on: ${{ matrix.os }}
2022
strategy:
2123
matrix:
@@ -27,23 +29,25 @@ jobs:
2729
- uses: actions/checkout@v4
2830
with:
2931
persist-credentials: false
30-
fetch-tags: true
32+
fetch-depth: 0
3133
- name: Setup Python
3234
uses: actions/setup-python@v5
3335
with:
3436
python-version: ${{ matrix.python-version }}
3537
- name: Start MongoDB on Linux and Windows
36-
if: ${{ ! startsWith(runner.os, 'macOS') }}
37-
uses: supercharge/[email protected]
38-
with:
39-
mongodb-version: 8.0
40-
mongodb-replica-set: test-rs
38+
if: ${{ !startsWith(runner.os, 'macOS') }}
39+
run: |
40+
docker run --name mongodb -p 27017:27017 -e MONGO_INITDB_DATABASE=unittest --detach mongo:${MONGODB_VERSION} mongod --replSet rs --setParameter transactionLifetimeLimitSeconds=5
41+
until docker exec --tty mongodb mongosh 127.0.0.1:27017 --eval "db.runCommand({ ping: 1 })"; do
42+
sleep 1
43+
done
44+
sudo docker exec --tty mongodb mongosh 127.0.0.1:27017 --eval "rs.initiate({\"_id\":\"rs\",\"members\":[{\"_id\":0,\"host\":\"127.0.0.1:27017\" }]})"
4145
- name: Start MongoDB on MacOS
4246
if: ${{ startsWith(runner.os, 'macOS') }}
4347
run: |
4448
brew tap mongodb/brew
45-
brew install mongodb-community@8.0
46-
brew services start mongodb-community@8.0
49+
brew install mongodb-community@${MONGODB_VERSION}
50+
brew services start mongodb-community@${MONGODB_VERSION}
4751
- name: Install package and pytest
4852
run: |
4953
python -m pip install .

0 commit comments

Comments
 (0)