Add support for db in GridFS functions (#178) #40
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Python Tests | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
concurrency: | |
group: tests-${{ github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash -eux {0} | |
env: | |
MONGODB_VERSION: "7.0" | |
jobs: | |
static: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
enable-cache: true | |
python-version: ${{ matrix.python-version }} | |
- uses: extractions/setup-just@v2 | |
- run: just install | |
- run: just lint | |
- run: just docs | |
- run: uv run pre-commit run --hook-stage manual --all-files | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: ["ubuntu-latest", "macos-latest", "windows-latest"] | |
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] | |
fail-fast: false | |
name: CPython ${{ matrix.python-version }}-${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
enable-cache: true | |
python-version: ${{ matrix.python-version }} | |
- uses: extractions/setup-just@v2 | |
- name: Start MongoDB on Linux | |
if: ${{ startsWith(runner.os, 'Linux') }} | |
run: | | |
docker run --name mongodb -p 27017:27017 -e MONGO_INITDB_DATABASE=unittest --detach mongo:${MONGODB_VERSION} mongod --replSet rs --setParameter transactionLifetimeLimitSeconds=5 | |
until docker exec --tty mongodb mongosh 127.0.0.1:27017 --eval "db.runCommand({ ping: 1 })"; do | |
sleep 1 | |
done | |
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\" }]})" | |
- name: Start MongoDB on MacOS | |
if: ${{ startsWith(runner.os, 'macOS') }} | |
run: | | |
brew tap mongodb/brew | |
brew install mongodb/brew/mongodb-community@${MONGODB_VERSION} | |
brew services start mongodb-community@${MONGODB_VERSION} | |
- name: Start MongoDB on Windows | |
if: ${{ startsWith(runner.os, 'Windows') }} | |
shell: powershell | |
run: | | |
mkdir data | |
mongod --remove | |
mongod --install --dbpath=$(pwd)/data --logpath=$PWD/mongo.log | |
net start MongoDB | |
- run: just install | |
- run: just test |