From 561b3448ae3ac2534864a2c62ec7a4057bafec90 Mon Sep 17 00:00:00 2001 From: Caesar Bell Date: Mon, 24 Feb 2025 13:25:24 -0500 Subject: [PATCH 01/18] =?UTF-8?q?=F0=9F=94=A7=20DOP-5399=20uploads=20the?= =?UTF-8?q?=20osiris.toml=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 +++ osiris.toml | 40 ++++++++++++++++++++++++++++++++++++ source/api-documentation.txt | 32 ----------------------------- 3 files changed, 43 insertions(+), 32 deletions(-) create mode 100644 osiris.toml delete mode 100644 source/api-documentation.txt diff --git a/.gitignore b/.gitignore index 49c66f9d2..36e40ac70 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,6 @@ giza.log .vscode* *.swp *.code-workspace + +# GitHub Actions +.secrets \ No newline at end of file diff --git a/osiris.toml b/osiris.toml new file mode 100644 index 000000000..79e7f6a46 --- /dev/null +++ b/osiris.toml @@ -0,0 +1,40 @@ +[[sites]] +name = "java-sync" +url = "https://mongodb.github.io/mongo-java-driver/5.2/apidocs/mongodb-driver-sync/index.html" +site_type = "java" +source_dir = "source" +output = "api-documentation/java-sync" + +[sites.href_mapping] +"*//mongodb.github.io/mongo-java-driver/*/apidocs/mongodb-driver-sync/" = "/api-documentation/java-sync/" + +[[sites]] +name = "core" +url = "https://mongodb.github.io/mongo-java-driver/5.2/apidocs/mongodb-driver-core/index.html" +site_type = "java" +source_dir = "source" +output = "api-documentation/core" + +[sites.href_mapping] +"*//mongodb.github.io/mongo-java-driver/*/apidocs/mongodb-driver-core/" = "/api-documentation/core/" + +[[sites]] +name = "scala" +url = "https://mongodb.github.io/mongo-java-driver/5.1/apidocs/mongo-scala-driver/index.html" +site_type = "scala" +source_dir = "source" +output = "api-documentation/scala" + +[sites.href_mapping] +"*//mongodb.github.io/mongo-java-driver/*/apidocs/mongo-scala-driver/" = "/api-documentation/scala/" + +[[sites]] +name = "kotlin" +url = "https://mongodb.github.io/mongo-java-driver/5.3/apidocs/mongodb-driver-kotlin-sync/index.html" +site_type = "kotlin" +source_dir = "source" +output = "api-documentation/kotlin" + +[sites.href_mapping] +"*//mongodb.github.io/mongo-java-driver/*/apidocs/mongodb-driver-kotlin-sync/" = "/api-documentation/kotlin/" + diff --git a/source/api-documentation.txt b/source/api-documentation.txt deleted file mode 100644 index 894200ee7..000000000 --- a/source/api-documentation.txt +++ /dev/null @@ -1,32 +0,0 @@ -.. _java-api-landing: - -================= -API Documentation -================= - -.. meta:: - :description: Read the API documentation for the {+driver-long+} and related packages. - -- `BSON <{+api+}/apidocs/bson/index.html>`__ - classes for working with the - BSON data format. -- `BSON Record Codec <{+api+}/apidocs/bson-record-codec/index.html>`__ - - classes for encoding and decoding between Java records and the BSON data - format. -- `Core <{+api+}/apidocs/mongodb-driver-core/index.html>`__ - classes that - contain essential driver functionality. -- `Java Driver (modern API) <{+api+}/apidocs/mongodb-driver-sync/index.html>`__ - - classes for the current driver API. -- `Java Driver (legacy API) <{+api+}/apidocs/mongodb-driver-legacy/index.html>`__ - - classes that support the legacy driver API. To learn how to upgrade from the - legacy API to the modern API from the :ref:`` documentation. - -.. toctree:: - :titlesonly: - :maxdepth: 1 - - BSON <{+api+}/apidocs/bson/index.html> - BSON Record Codec <{+api+}/apidocs/bson-record-codec/index.html> - Core <{+api+}/apidocs/mongodb-driver-core/index.html> - Java Driver (modern API) <{+api+}/apidocs/mongodb-driver-sync/index.html> - Java Driver (legacy API) <{+api+}/apidocs/mongodb-driver-legacy/index.html> - From ed230af6edef755dbf55e183556a0df9cacaf9c7 Mon Sep 17 00:00:00 2001 From: Caesar Bell Date: Mon, 24 Feb 2025 14:07:20 -0500 Subject: [PATCH 02/18] =?UTF-8?q?=F0=9F=94=A7=20DOP-5399=20adds=20the=20to?= =?UTF-8?q?ml=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- osiris.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osiris.toml b/osiris.toml index 79e7f6a46..5fd8fcd3c 100644 --- a/osiris.toml +++ b/osiris.toml @@ -36,5 +36,4 @@ source_dir = "source" output = "api-documentation/kotlin" [sites.href_mapping] -"*//mongodb.github.io/mongo-java-driver/*/apidocs/mongodb-driver-kotlin-sync/" = "/api-documentation/kotlin/" - +"*//mongodb.github.io/mongo-java-driver/*/apidocs/mongodb-driver-kotlin-sync/" = "/api-documentation/kotlin/" \ No newline at end of file From 6d2586e05e514b2391074c0b80ca9bb2d0c371a8 Mon Sep 17 00:00:00 2001 From: Caesar Bell Date: Tue, 25 Feb 2025 17:25:51 -0500 Subject: [PATCH 03/18] =?UTF-8?q?=F0=9F=94=A7=20DOP-5399=20added=20the=20n?= =?UTF-8?q?ew=20github=20workflow=20for=20osiris=20coverage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/osiris-subpar-coverage.yml | 114 +++++++++++++++++++ .gitignore | 3 +- 2 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/osiris-subpar-coverage.yml diff --git a/.github/workflows/osiris-subpar-coverage.yml b/.github/workflows/osiris-subpar-coverage.yml new file mode 100644 index 000000000..e87442edf --- /dev/null +++ b/.github/workflows/osiris-subpar-coverage.yml @@ -0,0 +1,114 @@ +name: Coverage Check for Osiris Generated AST files +on: + pull_request: + paths: + - '**/*.ast' # Only trigger if .ast files are changed + branches: + - main + - DOP-5399 + workflow_dispatch: + +jobs: + check-coverage: + runs-on: ubuntu-latest + outputs: + coverage_percent: ${{ steps.set_coverage.outputs.coverage_percent }} + coverage_below_threshold: ${{ steps.set_coverage.outputs.coverage_below_threshold }} + low_coverage_sites: ${{ steps.set_coverage.outputs.low_coverage_sites }} + + steps: + - name: Checkout Repos + uses: actions/checkout@v4 + + - name: Install Wget + run: sudo apt-get update && sudo apt-get install -y wget + + - name: Clone Docs Java + run: git clone --branch DOP-5399 https://github.com/mongodb/docs-java.git cloned-docs-java-repo + + - name: Clone Osiris + run: git clone https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/10gen/osiris.git cloned-osiris-repo + + - name: Run Coverage Check + id: run_coverage + run: | + cd cloned-osiris-repo + npm ci + COVERAGE_OUTPUT=$(npm run dev -- -c "$GITHUB_WORKSPACE/cloned-docs-java-repo" -v --sp 95 | tee /dev/tty) + + + # Extract the last reported overall coverage percentage + COVERAGE_PERCENT=$(echo "$COVERAGE_OUTPUT" | grep -oE 'Average Coverage: [0-9]+(\.[0-9]+)?%' | tail -1 | grep -oE '[0-9]+(\.[0-9]+)?') + + REQUIRED_COVERAGE=90.0 + + # Extract site names where Average Coverage is below the required coverage% + LOW_COVERAGE_SITES=$(echo "$COVERAGE_OUTPUT" | awk -v threshold=$REQUIRED_COVERAGE ' + /Average Coverage:/ { + coverage = $3 + 0; # Convert to number + if (coverage < threshold) { + low_coverage_detected = 1; # Flag that we have low coverage + } else { + low_coverage_detected = 0; # Reset if coverage is above threshold + } + } + /Finished processing site "/ { + if (low_coverage_detected) { + site = $4; + gsub(/"/, "", site); # Extract site name + sites[site] = 1; # Store site name + } + } + END { for (s in sites) printf "%s,", s } + ' | sed 's/,$//') + + echo "Detected Coverage: $COVERAGE_PERCENT%" + echo "Sites with Low Coverage: $LOW_COVERAGE_SITES" + + # Ensure we have a valid number + if [ -z "$COVERAGE_PERCENT" ]; then + echo "Coverage percentage could not be determined." + exit 1 + fi + + echo "Required Coverage: $REQUIRED_COVERAGE" + + if awk "BEGIN {exit !($COVERAGE_PERCENT < $REQUIRED_COVERAGE)}"; then + echo "Test coverage ($COVERAGE_PERCENT%) is below required threshold ($REQUIRED_COVERAGE%)." + echo "coverage_below_threshold=true" >> $GITHUB_ENV + echo "COVERAGE_PERCENT=$COVERAGE_PERCENT" >> $GITHUB_ENV + echo "LOW_COVERAGE_SITES=$LOW_COVERAGE_SITES" >> $GITHUB_ENV + else + echo "Test coverage ($COVERAGE_PERCENT%) meets the required threshold." + echo "coverage_below_threshold=false" >> $GITHUB_ENV + fi + + - name: Set Workflow Outputs + id: set_coverage + run: | + echo "coverage_percent=${COVERAGE_PERCENT}" >> $GITHUB_OUTPUT + echo "coverage_below_threshold=${coverage_below_threshold}" >> $GITHUB_OUTPUT + echo "low_coverage_sites=${LOW_COVERAGE_SITES}" >> $GITHUB_OUTPUT + + send-slack-notification: + runs-on: ubuntu-latest + needs: check-coverage + if: needs.check-coverage.outputs.coverage_below_threshold == 'true' + + steps: + - name: Send Slack Notification + env: + COVERAGE_PERCENT: ${{ needs.check-coverage.outputs.coverage_percent }} + LOW_COVERAGE_SITES: ${{ needs.check-coverage.outputs.low_coverage_sites }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + REPOSITORY: ${{ github.repository }} + PR_TITLE: ${{ github.event.pull_request.title }} + PR_NUMBER: ${{ github.event.pull_request.number }} + PR_URL: ${{ github.event.pull_request.html_url }} + PR_SHA: ${{ github.event.pull_request.head.sha }} + run: | + curl -v -X POST -H 'Content-type: application/json' \ + --data '{ + "text": "⚠️ *Test Coverage Alert* ⚠️\n\nThe test coverage is below the required threshold of 90%.\n\n*Detected Coverage:* '"$COVERAGE_PERCENT"%'\n\n*Repository:* \n*PR Title:* '"$PR_TITLE"'\n*PR Number:* #'"$PR_NUMBER"'\n*PR URL:* <'"$PR_URL"'|View PR>\n*Commit SHA:* `'"$PR_SHA"'`\n\n*Sites with Low Coverage:* \n`'"$LOW_COVERAGE_SITES"'`\n\nPlease review the test coverage and take action if necessary." + }' \ + $SLACK_WEBHOOK_URL \ No newline at end of file diff --git a/.gitignore b/.gitignore index 36e40ac70..2a4b4a887 100644 --- a/.gitignore +++ b/.gitignore @@ -36,4 +36,5 @@ giza.log *.code-workspace # GitHub Actions -.secrets \ No newline at end of file +.secrets +event.json \ No newline at end of file From fdc9fe02932b589ad72fb3a600f78d8afbc3fdc1 Mon Sep 17 00:00:00 2001 From: Caesar Bell Date: Wed, 26 Feb 2025 11:07:27 -0500 Subject: [PATCH 04/18] =?UTF-8?q?=F0=9F=94=A7=20DOP-5399=20updates=20the?= =?UTF-8?q?=20github=20workflow=20with=20the=20secret=20personal=20token?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/osiris-subpar-coverage.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/osiris-subpar-coverage.yml b/.github/workflows/osiris-subpar-coverage.yml index e87442edf..d07d9b5e0 100644 --- a/.github/workflows/osiris-subpar-coverage.yml +++ b/.github/workflows/osiris-subpar-coverage.yml @@ -27,7 +27,7 @@ jobs: run: git clone --branch DOP-5399 https://github.com/mongodb/docs-java.git cloned-docs-java-repo - name: Clone Osiris - run: git clone https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/10gen/osiris.git cloned-osiris-repo + run: git clone https://x-access-token:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/10gen/osiris.git cloned-osiris-repo - name: Run Coverage Check id: run_coverage @@ -40,7 +40,7 @@ jobs: # Extract the last reported overall coverage percentage COVERAGE_PERCENT=$(echo "$COVERAGE_OUTPUT" | grep -oE 'Average Coverage: [0-9]+(\.[0-9]+)?%' | tail -1 | grep -oE '[0-9]+(\.[0-9]+)?') - REQUIRED_COVERAGE=90.0 + REQUIRED_COVERAGE=100.0 # Extract site names where Average Coverage is below the required coverage% LOW_COVERAGE_SITES=$(echo "$COVERAGE_OUTPUT" | awk -v threshold=$REQUIRED_COVERAGE ' From 6d209b4efecefc098bf424b57bd69e626a26900f Mon Sep 17 00:00:00 2001 From: Caesar Bell Date: Wed, 26 Feb 2025 11:29:49 -0500 Subject: [PATCH 05/18] =?UTF-8?q?=F0=9F=90=9B=20DOP-5399=20added=20a=20tem?= =?UTF-8?q?p=20debug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/osiris-subpar-coverage.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/osiris-subpar-coverage.yml b/.github/workflows/osiris-subpar-coverage.yml index d07d9b5e0..00f0dee10 100644 --- a/.github/workflows/osiris-subpar-coverage.yml +++ b/.github/workflows/osiris-subpar-coverage.yml @@ -26,6 +26,16 @@ jobs: - name: Clone Docs Java run: git clone --branch DOP-5399 https://github.com/mongodb/docs-java.git cloned-docs-java-repo + - name: Debug GitHub Secrets + run: | + echo "Checking if PERSONAL_ACCESS_TOKEN is set..." + if [ -z "${{ secrets.PERSONAL_ACCESS_TOKEN }}" ]; then + echo "❌ PERSONAL_ACCESS_TOKEN is missing or not available in this environment." + exit 1 + else + echo "✅ PERSONAL_ACCESS_TOKEN is set." + fi + - name: Clone Osiris run: git clone https://x-access-token:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/10gen/osiris.git cloned-osiris-repo From 6a3caacc74a6bf053cdbc7f359d0c798ed2e61c3 Mon Sep 17 00:00:00 2001 From: Caesar Bell Date: Wed, 26 Feb 2025 11:47:19 -0500 Subject: [PATCH 06/18] =?UTF-8?q?=F0=9F=8E=A8=20DOP-5399=20removes=20the?= =?UTF-8?q?=20debug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/osiris-subpar-coverage.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/workflows/osiris-subpar-coverage.yml b/.github/workflows/osiris-subpar-coverage.yml index 00f0dee10..d07d9b5e0 100644 --- a/.github/workflows/osiris-subpar-coverage.yml +++ b/.github/workflows/osiris-subpar-coverage.yml @@ -26,16 +26,6 @@ jobs: - name: Clone Docs Java run: git clone --branch DOP-5399 https://github.com/mongodb/docs-java.git cloned-docs-java-repo - - name: Debug GitHub Secrets - run: | - echo "Checking if PERSONAL_ACCESS_TOKEN is set..." - if [ -z "${{ secrets.PERSONAL_ACCESS_TOKEN }}" ]; then - echo "❌ PERSONAL_ACCESS_TOKEN is missing or not available in this environment." - exit 1 - else - echo "✅ PERSONAL_ACCESS_TOKEN is set." - fi - - name: Clone Osiris run: git clone https://x-access-token:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/10gen/osiris.git cloned-osiris-repo From 6627404ee392d9a278a118b1eb059ba82e87c1c2 Mon Sep 17 00:00:00 2001 From: Caesar Bell Date: Wed, 26 Feb 2025 12:28:26 -0500 Subject: [PATCH 07/18] =?UTF-8?q?=F0=9F=94=A7=20DOP-5399=20exporting=20PAT?= =?UTF-8?q?=20and=20assigning=20it=20to=20GITHUB=5FTOKEN=20variable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/osiris-subpar-coverage.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/osiris-subpar-coverage.yml b/.github/workflows/osiris-subpar-coverage.yml index d07d9b5e0..bfa51664b 100644 --- a/.github/workflows/osiris-subpar-coverage.yml +++ b/.github/workflows/osiris-subpar-coverage.yml @@ -27,7 +27,9 @@ jobs: run: git clone --branch DOP-5399 https://github.com/mongodb/docs-java.git cloned-docs-java-repo - name: Clone Osiris - run: git clone https://x-access-token:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/10gen/osiris.git cloned-osiris-repo + run: | + export GITHUB_TOKEN=${{ secrets.PERSONAL_ACCESS_TOKEN }} + git clone https://x-access-token:$GITHUB_TOKEN@github.com/10gen/osiris.git cloned-osiris-repo - name: Run Coverage Check id: run_coverage From 55bea8539d0f1d7691fbb3777b7ce3fa24153f7b Mon Sep 17 00:00:00 2001 From: Caesar Bell Date: Wed, 26 Feb 2025 12:32:44 -0500 Subject: [PATCH 08/18] =?UTF-8?q?=F0=9F=94=A7=20DOP-5399=20trying=20the=20?= =?UTF-8?q?ssh=20route?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/osiris-subpar-coverage.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/osiris-subpar-coverage.yml b/.github/workflows/osiris-subpar-coverage.yml index bfa51664b..b22ff2376 100644 --- a/.github/workflows/osiris-subpar-coverage.yml +++ b/.github/workflows/osiris-subpar-coverage.yml @@ -27,9 +27,7 @@ jobs: run: git clone --branch DOP-5399 https://github.com/mongodb/docs-java.git cloned-docs-java-repo - name: Clone Osiris - run: | - export GITHUB_TOKEN=${{ secrets.PERSONAL_ACCESS_TOKEN }} - git clone https://x-access-token:$GITHUB_TOKEN@github.com/10gen/osiris.git cloned-osiris-repo + run: git clone git@github.com:10gen/osiris.git cloned-osiris-repo - name: Run Coverage Check id: run_coverage From a93c4d084b3571d63f00532a05d4fb32966d1134 Mon Sep 17 00:00:00 2001 From: Caesar Bell Date: Wed, 26 Feb 2025 12:34:56 -0500 Subject: [PATCH 09/18] =?UTF-8?q?=F0=9F=94=A7=20DOP-5399=20went=20back=20t?= =?UTF-8?q?o=20the=20git=20clone=20with=20the=20acces=20token?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/osiris-subpar-coverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/osiris-subpar-coverage.yml b/.github/workflows/osiris-subpar-coverage.yml index b22ff2376..d07d9b5e0 100644 --- a/.github/workflows/osiris-subpar-coverage.yml +++ b/.github/workflows/osiris-subpar-coverage.yml @@ -27,7 +27,7 @@ jobs: run: git clone --branch DOP-5399 https://github.com/mongodb/docs-java.git cloned-docs-java-repo - name: Clone Osiris - run: git clone git@github.com:10gen/osiris.git cloned-osiris-repo + run: git clone https://x-access-token:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/10gen/osiris.git cloned-osiris-repo - name: Run Coverage Check id: run_coverage From 97cdd3da1a2f5218d53ee709f5c86d194d9937f7 Mon Sep 17 00:00:00 2001 From: Caesar Bell Date: Wed, 26 Feb 2025 13:34:07 -0500 Subject: [PATCH 10/18] =?UTF-8?q?=F0=9F=94=A7=20DOP-5399=20went=20back=20t?= =?UTF-8?q?o=20the=20git=20clone=20with=20the=20acces=20token?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/osiris-subpar-coverage.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/osiris-subpar-coverage.yml b/.github/workflows/osiris-subpar-coverage.yml index d07d9b5e0..06bac0e5d 100644 --- a/.github/workflows/osiris-subpar-coverage.yml +++ b/.github/workflows/osiris-subpar-coverage.yml @@ -23,6 +23,9 @@ jobs: - name: Install Wget run: sudo apt-get update && sudo apt-get install -y wget + - name: Debug Secrets + run: echo "Token Length: ${#secrets.PERSONAL_ACCESS_TOKEN}" + - name: Clone Docs Java run: git clone --branch DOP-5399 https://github.com/mongodb/docs-java.git cloned-docs-java-repo From 03b2207feaa15c722ab2a85b6e2f79c1f322b2de Mon Sep 17 00:00:00 2001 From: Caesar Bell Date: Wed, 26 Feb 2025 13:43:35 -0500 Subject: [PATCH 11/18] =?UTF-8?q?=F0=9F=8E=A8=20DOP-5399=20fix=20syntax=20?= =?UTF-8?q?error?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/osiris-subpar-coverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/osiris-subpar-coverage.yml b/.github/workflows/osiris-subpar-coverage.yml index 06bac0e5d..a5d343278 100644 --- a/.github/workflows/osiris-subpar-coverage.yml +++ b/.github/workflows/osiris-subpar-coverage.yml @@ -24,7 +24,7 @@ jobs: run: sudo apt-get update && sudo apt-get install -y wget - name: Debug Secrets - run: echo "Token Length: ${#secrets.PERSONAL_ACCESS_TOKEN}" + run: "echo Token Length: ${#secrets.PERSONAL_ACCESS_TOKEN}" - name: Clone Docs Java run: git clone --branch DOP-5399 https://github.com/mongodb/docs-java.git cloned-docs-java-repo From fd97a7880cc582ee35f9a4dfd2f0f3cc2089d952 Mon Sep 17 00:00:00 2001 From: Caesar Bell Date: Wed, 26 Feb 2025 14:07:18 -0500 Subject: [PATCH 12/18] =?UTF-8?q?=F0=9F=94=A7=20DOP-5399=20properly=20hand?= =?UTF-8?q?ling=20the=20debug=20for=20secrets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/osiris-subpar-coverage.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/osiris-subpar-coverage.yml b/.github/workflows/osiris-subpar-coverage.yml index a5d343278..d26420675 100644 --- a/.github/workflows/osiris-subpar-coverage.yml +++ b/.github/workflows/osiris-subpar-coverage.yml @@ -24,7 +24,8 @@ jobs: run: sudo apt-get update && sudo apt-get install -y wget - name: Debug Secrets - run: "echo Token Length: ${#secrets.PERSONAL_ACCESS_TOKEN}" + run: | + echo "Token Length: $(echo -n "${{ secrets.PERSONAL_ACCESS_TOKEN }}" | wc -c)" - name: Clone Docs Java run: git clone --branch DOP-5399 https://github.com/mongodb/docs-java.git cloned-docs-java-repo From e8239565dbd13a4a07a557af08e4d0e7c232fd66 Mon Sep 17 00:00:00 2001 From: Caesar Bell Date: Wed, 26 Feb 2025 15:14:06 -0500 Subject: [PATCH 13/18] =?UTF-8?q?=F0=9F=94=A5=20DOP-5399=20removes=20the?= =?UTF-8?q?=20debug=20for=20token?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/osiris-subpar-coverage.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/osiris-subpar-coverage.yml b/.github/workflows/osiris-subpar-coverage.yml index d26420675..d07d9b5e0 100644 --- a/.github/workflows/osiris-subpar-coverage.yml +++ b/.github/workflows/osiris-subpar-coverage.yml @@ -23,10 +23,6 @@ jobs: - name: Install Wget run: sudo apt-get update && sudo apt-get install -y wget - - name: Debug Secrets - run: | - echo "Token Length: $(echo -n "${{ secrets.PERSONAL_ACCESS_TOKEN }}" | wc -c)" - - name: Clone Docs Java run: git clone --branch DOP-5399 https://github.com/mongodb/docs-java.git cloned-docs-java-repo From 2890542287273688464f853eeefe0b62374288c9 Mon Sep 17 00:00:00 2001 From: Caesar Bell Date: Wed, 26 Feb 2025 16:44:38 -0500 Subject: [PATCH 14/18] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20DOP-5399=20removes?= =?UTF-8?q?=20the=20tty=20because=20there=20is=20no=20interactive=20termin?= =?UTF-8?q?al=20in=20GHA=20available?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/osiris-subpar-coverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/osiris-subpar-coverage.yml b/.github/workflows/osiris-subpar-coverage.yml index d07d9b5e0..3484e2b30 100644 --- a/.github/workflows/osiris-subpar-coverage.yml +++ b/.github/workflows/osiris-subpar-coverage.yml @@ -34,7 +34,7 @@ jobs: run: | cd cloned-osiris-repo npm ci - COVERAGE_OUTPUT=$(npm run dev -- -c "$GITHUB_WORKSPACE/cloned-docs-java-repo" -v --sp 95 | tee /dev/tty) + COVERAGE_OUTPUT=$(npm run dev -- -c "$GITHUB_WORKSPACE/cloned-docs-java-repo" -v --sp 95) # Extract the last reported overall coverage percentage From 36ae4fb1d63fd3fb6d8384df935111c2802b9a0b Mon Sep 17 00:00:00 2001 From: Caesar Bell Date: Thu, 27 Feb 2025 13:25:11 -0500 Subject: [PATCH 15/18] =?UTF-8?q?=F0=9F=94=A7=20DOP-5399=20adds=20the=20lo?= =?UTF-8?q?gic=20and=20format=20for=20Osiris=20Coverage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/osiris-subpar-coverage.yml | 36 ++++++++++++-------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/.github/workflows/osiris-subpar-coverage.yml b/.github/workflows/osiris-subpar-coverage.yml index 3484e2b30..e3cf98329 100644 --- a/.github/workflows/osiris-subpar-coverage.yml +++ b/.github/workflows/osiris-subpar-coverage.yml @@ -12,7 +12,7 @@ jobs: check-coverage: runs-on: ubuntu-latest outputs: - coverage_percent: ${{ steps.set_coverage.outputs.coverage_percent }} + coverage_percent_list: ${{ steps.set_coverage.outputs.coverage_percent_list }} coverage_below_threshold: ${{ steps.set_coverage.outputs.coverage_below_threshold }} low_coverage_sites: ${{ steps.set_coverage.outputs.low_coverage_sites }} @@ -36,11 +36,16 @@ jobs: npm ci COVERAGE_OUTPUT=$(npm run dev -- -c "$GITHUB_WORKSPACE/cloned-docs-java-repo" -v --sp 95) + REQUIRED_COVERAGE=90.0 - # Extract the last reported overall coverage percentage - COVERAGE_PERCENT=$(echo "$COVERAGE_OUTPUT" | grep -oE 'Average Coverage: [0-9]+(\.[0-9]+)?%' | tail -1 | grep -oE '[0-9]+(\.[0-9]+)?') - - REQUIRED_COVERAGE=100.0 + # Extract all Average Coverage values below the threshold + COVERAGE_PERCENT_LIST=$(echo "$COVERAGE_OUTPUT" | awk -v threshold=$REQUIRED_COVERAGE ' + /Average Coverage:/ { + coverage = $3 + 0; + if (coverage < threshold) { + printf "%s,", coverage "%"; + } + }' | sed 's/,$//') # Extract site names where Average Coverage is below the required coverage% LOW_COVERAGE_SITES=$(echo "$COVERAGE_OUTPUT" | awk -v threshold=$REQUIRED_COVERAGE ' @@ -62,31 +67,34 @@ jobs: END { for (s in sites) printf "%s,", s } ' | sed 's/,$//') - echo "Detected Coverage: $COVERAGE_PERCENT%" + # Print detected values + echo "Detected Coverage: $COVERAGE_PERCENT_LIST" + echo "Sites with Low Coverage: $LOW_COVERAGE_SITES" # Ensure we have a valid number - if [ -z "$COVERAGE_PERCENT" ]; then + if [ -z "$COVERAGE_PERCENT_LIST" ]; then echo "Coverage percentage could not be determined." exit 1 fi echo "Required Coverage: $REQUIRED_COVERAGE" - if awk "BEGIN {exit !($COVERAGE_PERCENT < $REQUIRED_COVERAGE)}"; then - echo "Test coverage ($COVERAGE_PERCENT%) is below required threshold ($REQUIRED_COVERAGE%)." + # If COVERAGE_PERCENT_LIST is not empty, it means there are coverage values below the threshold + if [ -n "$COVERAGE_PERCENT_LIST" ]; then + echo "Test coverage is below the required threshold ($REQUIRED_COVERAGE%)." echo "coverage_below_threshold=true" >> $GITHUB_ENV - echo "COVERAGE_PERCENT=$COVERAGE_PERCENT" >> $GITHUB_ENV + echo "COVERAGE_PERCENT_LIST=$COVERAGE_PERCENT_LIST" >> $GITHUB_ENV echo "LOW_COVERAGE_SITES=$LOW_COVERAGE_SITES" >> $GITHUB_ENV else - echo "Test coverage ($COVERAGE_PERCENT%) meets the required threshold." + echo "Test coverage meets the required threshold." echo "coverage_below_threshold=false" >> $GITHUB_ENV fi - name: Set Workflow Outputs id: set_coverage run: | - echo "coverage_percent=${COVERAGE_PERCENT}" >> $GITHUB_OUTPUT + echo "coverage_percent_list=${COVERAGE_PERCENT_LIST}" >> $GITHUB_OUTPUT echo "coverage_below_threshold=${coverage_below_threshold}" >> $GITHUB_OUTPUT echo "low_coverage_sites=${LOW_COVERAGE_SITES}" >> $GITHUB_OUTPUT @@ -98,7 +106,7 @@ jobs: steps: - name: Send Slack Notification env: - COVERAGE_PERCENT: ${{ needs.check-coverage.outputs.coverage_percent }} + COVERAGE_PERCENT_LIST: ${{ needs.check-coverage.outputs.coverage_percent_list }} LOW_COVERAGE_SITES: ${{ needs.check-coverage.outputs.low_coverage_sites }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} REPOSITORY: ${{ github.repository }} @@ -109,6 +117,6 @@ jobs: run: | curl -v -X POST -H 'Content-type: application/json' \ --data '{ - "text": "⚠️ *Test Coverage Alert* ⚠️\n\nThe test coverage is below the required threshold of 90%.\n\n*Detected Coverage:* '"$COVERAGE_PERCENT"%'\n\n*Repository:* \n*PR Title:* '"$PR_TITLE"'\n*PR Number:* #'"$PR_NUMBER"'\n*PR URL:* <'"$PR_URL"'|View PR>\n*Commit SHA:* `'"$PR_SHA"'`\n\n*Sites with Low Coverage:* \n`'"$LOW_COVERAGE_SITES"'`\n\nPlease review the test coverage and take action if necessary." + "text": "⚠️ *Test Coverage Alert* ⚠️\n\nThe test coverage is below the required threshold of 90%.\n\n*Detected Coverage:* \n• '"$(echo "$COVERAGE_PERCENT_LIST" | sed 's/,/\n• /g')"' \n\n*Repository:* \n*PR Title:* '"$PR_TITLE"'\n*PR Number:* #'"$PR_NUMBER"'\n*PR URL:* <'"$PR_URL"'|View PR>\n*Commit SHA:* `'"$PR_SHA"'`\n\n*Sites with Low Coverage:* \n• '"$(echo "$LOW_COVERAGE_SITES" | sed 's/,/\n• /g')"' \n\nPlease review the test coverage and take action if necessary." }' \ $SLACK_WEBHOOK_URL \ No newline at end of file From 45ec626640907216577cd83f96f428092c60c6bf Mon Sep 17 00:00:00 2001 From: Caesar Bell Date: Thu, 27 Feb 2025 15:09:52 -0500 Subject: [PATCH 16/18] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20DOP-5399=20updates?= =?UTF-8?q?=20with=20the=20new=20message=20format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/osiris-subpar-coverage.yml | 96 +++++++++----------- 1 file changed, 45 insertions(+), 51 deletions(-) diff --git a/.github/workflows/osiris-subpar-coverage.yml b/.github/workflows/osiris-subpar-coverage.yml index e3cf98329..5c4428530 100644 --- a/.github/workflows/osiris-subpar-coverage.yml +++ b/.github/workflows/osiris-subpar-coverage.yml @@ -12,9 +12,8 @@ jobs: check-coverage: runs-on: ubuntu-latest outputs: - coverage_percent_list: ${{ steps.set_coverage.outputs.coverage_percent_list }} + site_coverage_list: ${{ steps.set_coverage.outputs.site_coverage_list }} coverage_below_threshold: ${{ steps.set_coverage.outputs.coverage_below_threshold }} - low_coverage_sites: ${{ steps.set_coverage.outputs.low_coverage_sites }} steps: - name: Checkout Repos @@ -36,67 +35,48 @@ jobs: npm ci COVERAGE_OUTPUT=$(npm run dev -- -c "$GITHUB_WORKSPACE/cloned-docs-java-repo" -v --sp 95) - REQUIRED_COVERAGE=90.0 + REQUIRED_COVERAGE=100.0 # Extract all Average Coverage values below the threshold - COVERAGE_PERCENT_LIST=$(echo "$COVERAGE_OUTPUT" | awk -v threshold=$REQUIRED_COVERAGE ' - /Average Coverage:/ { - coverage = $3 + 0; - if (coverage < threshold) { - printf "%s,", coverage "%"; - } - }' | sed 's/,$//') - - # Extract site names where Average Coverage is below the required coverage% - LOW_COVERAGE_SITES=$(echo "$COVERAGE_OUTPUT" | awk -v threshold=$REQUIRED_COVERAGE ' + SITE_COVERAGE_LIST=$(echo "$COVERAGE_OUTPUT" | awk -v threshold=$REQUIRED_COVERAGE ' /Average Coverage:/ { - coverage = $3 + 0; # Convert to number - if (coverage < threshold) { - low_coverage_detected = 1; # Flag that we have low coverage - } else { - low_coverage_detected = 0; # Reset if coverage is above threshold - } + coverage = $3 + 0; + if (coverage < threshold) { + low_coverage_detected = 1; + last_coverage = coverage; + } else { + low_coverage_detected = 0; + } } /Finished processing site "/ { - if (low_coverage_detected) { - site = $4; - gsub(/"/, "", site); # Extract site name - sites[site] = 1; # Store site name - } + if (low_coverage_detected) { + site = $4; + gsub(/"/, "", site); # Extract site name + print site ":" last_coverage; # Store as site:coverage + } } - END { for (s in sites) printf "%s,", s } - ' | sed 's/,$//') + ' | paste -sd ',' - ) # Print detected values - echo "Detected Coverage: $COVERAGE_PERCENT_LIST" - - echo "Sites with Low Coverage: $LOW_COVERAGE_SITES" - - # Ensure we have a valid number - if [ -z "$COVERAGE_PERCENT_LIST" ]; then - echo "Coverage percentage could not be determined." - exit 1 - fi + echo "Detected Coverage Below Threshold: $SITE_COVERAGE_LIST" echo "Required Coverage: $REQUIRED_COVERAGE" - # If COVERAGE_PERCENT_LIST is not empty, it means there are coverage values below the threshold - if [ -n "$COVERAGE_PERCENT_LIST" ]; then - echo "Test coverage is below the required threshold ($REQUIRED_COVERAGE%)." - echo "coverage_below_threshold=true" >> $GITHUB_ENV - echo "COVERAGE_PERCENT_LIST=$COVERAGE_PERCENT_LIST" >> $GITHUB_ENV - echo "LOW_COVERAGE_SITES=$LOW_COVERAGE_SITES" >> $GITHUB_ENV + # Check if SITE_COVERAGE_LIST is empty or not + if [ -n "$SITE_COVERAGE_LIST" ]; then + echo "Test coverage is below the required threshold ($REQUIRED_COVERAGE%)." + echo "coverage_below_threshold=true" >> $GITHUB_ENV + echo "SITE_COVERAGE_LIST=$SITE_COVERAGE_LIST" >> $GITHUB_ENV else - echo "Test coverage meets the required threshold." - echo "coverage_below_threshold=false" >> $GITHUB_ENV + echo "Test coverage meets the required threshold." + echo "coverage_below_threshold=false" >> $GITHUB_ENV fi - name: Set Workflow Outputs id: set_coverage run: | - echo "coverage_percent_list=${COVERAGE_PERCENT_LIST}" >> $GITHUB_OUTPUT echo "coverage_below_threshold=${coverage_below_threshold}" >> $GITHUB_OUTPUT - echo "low_coverage_sites=${LOW_COVERAGE_SITES}" >> $GITHUB_OUTPUT + echo "site_coverage_list=${SITE_COVERAGE_LIST}" >> $GITHUB_OUTPUT send-slack-notification: runs-on: ubuntu-latest @@ -106,8 +86,7 @@ jobs: steps: - name: Send Slack Notification env: - COVERAGE_PERCENT_LIST: ${{ needs.check-coverage.outputs.coverage_percent_list }} - LOW_COVERAGE_SITES: ${{ needs.check-coverage.outputs.low_coverage_sites }} + SITE_COVERAGE_LIST: ${{ needs.check-coverage.outputs.site_coverage_list }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} REPOSITORY: ${{ github.repository }} PR_TITLE: ${{ github.event.pull_request.title }} @@ -115,8 +94,23 @@ jobs: PR_URL: ${{ github.event.pull_request.html_url }} PR_SHA: ${{ github.event.pull_request.head.sha }} run: | + TEXT_MESSAGE="⚠️ *Test Coverage Alert* ⚠️\n\nThe test coverage is below the required threshold of 90%.\n\n*Sites with Low Coverage:* \n" + + IFS=',' read -r -a SITE_COVERAGE_ARRAY <<< "$SITE_COVERAGE_LIST" + + for item in "${SITE_COVERAGE_ARRAY[@]}"; do + site_name="${item%%:*}" + coverage_value="${item##*:}" + TEXT_MESSAGE+="• ${site_name}: ${coverage_value}%\n" + done + + TEXT_MESSAGE+="\n*Repository:* \n" + TEXT_MESSAGE+="*PR Title:* $PR_TITLE\n" + TEXT_MESSAGE+="*PR Number:* #$PR_NUMBER\n" + TEXT_MESSAGE+="*PR URL:* <$PR_URL|View PR>\n" + TEXT_MESSAGE+="*Commit SHA:* \`$PR_SHA\`\n\n" + TEXT_MESSAGE+="Please review the test coverage and take action if necessary." + curl -v -X POST -H 'Content-type: application/json' \ - --data '{ - "text": "⚠️ *Test Coverage Alert* ⚠️\n\nThe test coverage is below the required threshold of 90%.\n\n*Detected Coverage:* \n• '"$(echo "$COVERAGE_PERCENT_LIST" | sed 's/,/\n• /g')"' \n\n*Repository:* \n*PR Title:* '"$PR_TITLE"'\n*PR Number:* #'"$PR_NUMBER"'\n*PR URL:* <'"$PR_URL"'|View PR>\n*Commit SHA:* `'"$PR_SHA"'`\n\n*Sites with Low Coverage:* \n• '"$(echo "$LOW_COVERAGE_SITES" | sed 's/,/\n• /g')"' \n\nPlease review the test coverage and take action if necessary." - }' \ - $SLACK_WEBHOOK_URL \ No newline at end of file + --data '{"text": "'"$TEXT_MESSAGE"'"}' \ + $SLACK_WEBHOOK_URL \ No newline at end of file From 04e1c6cd0e6c2ff4545dc8e133b1bc1175559860 Mon Sep 17 00:00:00 2001 From: Caesar Bell Date: Thu, 27 Feb 2025 16:38:52 -0500 Subject: [PATCH 17/18] =?UTF-8?q?=E2=9E=95=20Put=20back=20the=20api-docume?= =?UTF-8?q?ntation.txt=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/api-documentation.txt | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 source/api-documentation.txt diff --git a/source/api-documentation.txt b/source/api-documentation.txt new file mode 100644 index 000000000..2403052f8 --- /dev/null +++ b/source/api-documentation.txt @@ -0,0 +1,32 @@ +.. _java-api-landing: + +================= +API Documentation +================= + +.. meta:: + :description: Read the API documentation for the {+driver-long+} and related packages. + +- `BSON <{+api+}/apidocs/bson/index.html>`__ - classes for working with the + BSON data format. +- `BSON Record Codec <{+api+}/apidocs/bson-record-codec/index.html>`__ - + classes for encoding and decoding between Java records and the BSON data + format. +- `Core <{+api+}/apidocs/mongodb-driver-core/index.html>`__ - classes that + contain essential driver functionality. +- `Java Driver (modern API) <{+api+}/apidocs/mongodb-driver-sync/index.html>`__ - + classes for the current driver API. +- `Java Driver (legacy API) <{+api+}/apidocs/mongodb-driver-legacy/index.html>`__ - + classes that support the legacy driver API. To learn how to upgrade from the + legacy API to the modern API from the :ref:`` documentation. + +.. toctree:: + :titlesonly: + :maxdepth: 1 + + BSON <{+api+}/apidocs/bson/index.html> + BSON Record Codec <{+api+}/apidocs/bson-record-codec/index.html> + Core <{+api+}/apidocs/mongodb-driver-core/index.html> + Java Driver (modern API) <{+api+}/apidocs/mongodb-driver-sync/index.html> + Java Driver (legacy API) <{+api+}/apidocs/mongodb-driver-legacy/index.html> + \ No newline at end of file From a02fa03ecc6e2797062b84155c2c0c2ac0dad4a5 Mon Sep 17 00:00:00 2001 From: Caesar Bell Date: Thu, 27 Feb 2025 16:39:36 -0500 Subject: [PATCH 18/18] =?UTF-8?q?=F0=9F=97=83=EF=B8=8F=20Put=20back=20the?= =?UTF-8?q?=20api-documentation.txt=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/api-documentation.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/api-documentation.txt b/source/api-documentation.txt index 2403052f8..1edcde67b 100644 --- a/source/api-documentation.txt +++ b/source/api-documentation.txt @@ -28,5 +28,4 @@ API Documentation BSON Record Codec <{+api+}/apidocs/bson-record-codec/index.html> Core <{+api+}/apidocs/mongodb-driver-core/index.html> Java Driver (modern API) <{+api+}/apidocs/mongodb-driver-sync/index.html> - Java Driver (legacy API) <{+api+}/apidocs/mongodb-driver-legacy/index.html> - \ No newline at end of file + Java Driver (legacy API) <{+api+}/apidocs/mongodb-driver-legacy/index.html> \ No newline at end of file