From 1df58d576a7324617ba8057f23b03a2d281989c8 Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 15 Dec 2025 11:31:49 +0800 Subject: [PATCH] Add MongoDB Service Configuration to CI Workflows - Added a MongoDB service to both `pr-test.yml` and `unit-test.yml` workflows to support database testing. - Configured MongoDB with necessary environment variables for root credentials and database name, improving the test environment setup. --- .github/workflows/pr-test.yml | 9 +++++++++ .github/workflows/unit-test.yml | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index 52d10462..ea148165 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -357,6 +357,15 @@ jobs: - "3021:3021" - "3022:3022" + mongodb: + image: mongo:6.0 + ports: + - 27017:27017 + env: + MONGO_INITDB_ROOT_USERNAME: root + MONGO_INITDB_ROOT_PASSWORD: 123456 + MONGO_INITDB_DATABASE: test + strategy: matrix: go: [1.24] diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 388bc79d..c936b7a1 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -302,6 +302,15 @@ jobs: - "3021:3021" - "3022:3022" + mongodb: + image: mongo:6.0 + ports: + - 27017:27017 + env: + MONGO_INITDB_ROOT_USERNAME: root + MONGO_INITDB_ROOT_PASSWORD: 123456 + MONGO_INITDB_DATABASE: test + strategy: matrix: go: [1.24]