diff --git a/.github/workflows/test-python.yml b/.github/workflows/test-python.yml index 6269e3f..cdc3343 100644 --- a/.github/workflows/test-python.yml +++ b/.github/workflows/test-python.yml @@ -14,7 +14,9 @@ defaults: shell: bash -eux {0} env: - MONGODB_VERSION: "7.0" + MIN_PYTHON: "3.9" + MIN_MONGODB: "4.0" + MAX_MONGODB: "8.0" jobs: static: @@ -55,18 +57,16 @@ jobs: - 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\" }]})" + uses: supercharge/mongodb-github-action@1.12.0 + with: + mongodb-version: ${{ env.MAX_MONGODB }} + mongodb-replica-set: test-rs - 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} + brew install mongodb/brew/mongodb-community@${MAX_MONGODB} + brew services start mongodb-community@${MAX_MONGODB} - name: Start MongoDB on Windows if: ${{ startsWith(runner.os, 'Windows') }} shell: powershell @@ -77,3 +77,31 @@ jobs: net start MongoDB - run: just install - run: just test + + build-min: + 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: ${{ env.MIN_PYTHON }} + - uses: extractions/setup-just@v2 + - name: Install uv + uses: astral-sh/setup-uv@v5 + with: + enable-cache: true + python-version: ${{ env.MIN_PYTHON }} + - uses: extractions/setup-just@v2 + - uses: supercharge/mongodb-github-action@1.12.0 + with: + mongodb-version: ${{ env.MIN_MONGODB }} + mongodb-replica-set: test-rs + - name: Run unit tests with minimum dependency versions + run: | + uv sync --python=${MIN_PYTHON} --resolution=lowest-direct + just test