From b7b5d37c5546f6222470a1ee813d85d81e09198d Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 15 Jan 2025 15:11:53 -0600 Subject: [PATCH 1/4] Add min dependency test --- .github/workflows/test-python.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/test-python.yml b/.github/workflows/test-python.yml index 6269e3f..9c71c53 100644 --- a/.github/workflows/test-python.yml +++ b/.github/workflows/test-python.yml @@ -77,3 +77,7 @@ jobs: net start MongoDB - run: just install - run: just test + - name: Run unit tests with minimum dependency versions + run: | + uv sync --python=${{ matrix.python-version }} --resolution=lowest-direct + just tests From 3915d2bed8cb0b25a14c69e087b38b317eda8622 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 15 Jan 2025 15:16:27 -0600 Subject: [PATCH 2/4] fix test --- .github/workflows/test-python.yml | 49 +++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/.github/workflows/test-python.yml b/.github/workflows/test-python.yml index 9c71c53..faa67e6 100644 --- a/.github/workflows/test-python.yml +++ b/.github/workflows/test-python.yml @@ -13,9 +13,6 @@ defaults: run: shell: bash -eux {0} -env: - MONGODB_VERSION: "7.0" - jobs: static: runs-on: ubuntu-latest @@ -55,18 +52,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: 8.0 + 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@7.0 + brew services start mongodb-community@7.0 - name: Start MongoDB on Windows if: ${{ startsWith(runner.os, 'Windows') }} shell: powershell @@ -77,7 +72,31 @@ jobs: net start MongoDB - run: just install - run: just test - - name: Run unit tests with minimum dependency versions - run: | - uv sync --python=${{ matrix.python-version }} --resolution=lowest-direct - just tests + + 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: "3.9" + - uses: extractions/setup-just@v2 + - name: Install uv + uses: astral-sh/setup-uv@v5 + with: + enable-cache: true + python-version: "3.9" + - uses: extractions/setup-just@v2 + - uses: supercharge/mongodb-github-action@1.12.0 + with: + mongodb-version: 4.0 + mongodb-replica-set: test-rs + - name: Run unit tests with minimum dependency versions + run: | + uv sync --python="3.9" --resolution=lowest-direct + just tests From 7337646f28451e479eefb5baba69068b6b4e0b2d Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 15 Jan 2025 15:18:04 -0600 Subject: [PATCH 3/4] fix test --- .github/workflows/test-python.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-python.yml b/.github/workflows/test-python.yml index faa67e6..19faabe 100644 --- a/.github/workflows/test-python.yml +++ b/.github/workflows/test-python.yml @@ -99,4 +99,4 @@ jobs: - name: Run unit tests with minimum dependency versions run: | uv sync --python="3.9" --resolution=lowest-direct - just tests + just test From 754667d1732c00e632781e5cee86ad7cae11874e Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 15 Jan 2025 16:20:55 -0600 Subject: [PATCH 4/4] address review --- .github/workflows/test-python.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test-python.yml b/.github/workflows/test-python.yml index 19faabe..cdc3343 100644 --- a/.github/workflows/test-python.yml +++ b/.github/workflows/test-python.yml @@ -13,6 +13,11 @@ defaults: run: shell: bash -eux {0} +env: + MIN_PYTHON: "3.9" + MIN_MONGODB: "4.0" + MAX_MONGODB: "8.0" + jobs: static: runs-on: ubuntu-latest @@ -54,14 +59,14 @@ jobs: if: ${{ startsWith(runner.os, 'Linux') }} uses: supercharge/mongodb-github-action@1.12.0 with: - mongodb-version: 8.0 + 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@7.0 - brew services start mongodb-community@7.0 + 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 @@ -84,19 +89,19 @@ jobs: uses: astral-sh/setup-uv@v5 with: enable-cache: true - python-version: "3.9" + 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: "3.9" + python-version: ${{ env.MIN_PYTHON }} - uses: extractions/setup-just@v2 - uses: supercharge/mongodb-github-action@1.12.0 with: - mongodb-version: 4.0 + mongodb-version: ${{ env.MIN_MONGODB }} mongodb-replica-set: test-rs - name: Run unit tests with minimum dependency versions run: | - uv sync --python="3.9" --resolution=lowest-direct + uv sync --python=${MIN_PYTHON} --resolution=lowest-direct just test