From b28fd743a87bb6c5bd3051d98b8b0b48283a1d64 Mon Sep 17 00:00:00 2001 From: dacharyc Date: Wed, 5 Nov 2025 11:15:25 -0500 Subject: [PATCH 01/12] Add CI workflows for Java and Express --- .github/workflows/run-express-tests.yml | 43 ++++++++++++++ .../workflows/run-java-spring-boot-tests.yml | 58 +++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 .github/workflows/run-express-tests.yml create mode 100644 .github/workflows/run-java-spring-boot-tests.yml diff --git a/.github/workflows/run-express-tests.yml b/.github/workflows/run-express-tests.yml new file mode 100644 index 0000000..c83b23f --- /dev/null +++ b/.github/workflows/run-express-tests.yml @@ -0,0 +1,43 @@ +name: Run Express Tests + +on: + pull_request: + branches: + - development + push: + branches: + - development + +jobs: + test: + name: Run Express Tests + runs-on: ubuntu-latest + + defaults: + run: + working-directory: server/express + + steps: + - name: Checkout code + uses: actions/checkout@v5 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install dependencies + run: npm install + + - name: Run tests + run: npm test + env: + MONGODB_URI: ${{ secrets.MFLIX_URI }} + + - name: Upload test results + uses: actions/upload-artifact@v4 + if: always() + with: + name: test-results + path: server/express/coverage/ + retention-days: 30 diff --git a/.github/workflows/run-java-spring-boot-tests.yml b/.github/workflows/run-java-spring-boot-tests.yml new file mode 100644 index 0000000..001cfba --- /dev/null +++ b/.github/workflows/run-java-spring-boot-tests.yml @@ -0,0 +1,58 @@ +name: Run Java Spring Boot Tests + +on: + pull_request: + branches: + - development + push: + branches: + - development + +jobs: + test: + name: Run Java Spring Boot Tests + runs-on: ubuntu-latest + + defaults: + run: + working-directory: server/java-spring + + steps: + - name: Checkout code + uses: actions/checkout@v5 + + - name: Set up JDK 21 + uses: actions/setup-java@v5 + with: + java-version: '21' + distribution: 'temurin' + cache: 'maven' + + - name: Make mvnw executable + run: chmod +x mvnw + + - name: Run unit tests + run: ./mvnw test + env: + MONGODB_URI: ${{ secrets.MFLIX_URI }} + + - name: Run integration tests + run: ./mvnw test -Dtest=MongoDBSearchIntegrationTest + env: + MONGODB_URI: ${{ secrets.MFLIX_URI }} + ENABLE_SEARCH_TESTS: true + continue-on-error: true + + - name: Upload test results + uses: actions/upload-artifact@v4 + if: always() + with: + name: test-results + path: server/java-spring/target/surefire-reports/ + retention-days: 30 + + - name: Test Summary + uses: test-summary/action@v2 + if: always() + with: + paths: server/java-spring/target/surefire-reports/TEST-*.xml From 1f6fd3267ab79469d3ded65072437a02ee0eeae1 Mon Sep 17 00:00:00 2001 From: dacharyc Date: Wed, 5 Nov 2025 17:12:31 -0500 Subject: [PATCH 02/12] Update GitHub workflows to use local scripts for test summary display --- .github/scripts/generate-test-summary-jest.sh | 83 +++++++++++++++++++ .../scripts/generate-test-summary-surefire.sh | 82 ++++++++++++++++++ .github/workflows/run-express-tests.yml | 12 ++- .../workflows/run-java-spring-boot-tests.yml | 8 +- server/express/.gitignore | 3 + 5 files changed, 182 insertions(+), 6 deletions(-) create mode 100644 .github/scripts/generate-test-summary-jest.sh create mode 100644 .github/scripts/generate-test-summary-surefire.sh diff --git a/.github/scripts/generate-test-summary-jest.sh b/.github/scripts/generate-test-summary-jest.sh new file mode 100644 index 0000000..6bbdf35 --- /dev/null +++ b/.github/scripts/generate-test-summary-jest.sh @@ -0,0 +1,83 @@ +#!/bin/bash +set -e + +# Generate Test Summary from Jest JSON Output +# Usage: ./generate-test-summary-jest.sh + +JSON_FILE="${1:-test-results.json}" + +echo "## Test Results" >> $GITHUB_STEP_SUMMARY +echo "" >> $GITHUB_STEP_SUMMARY + +# Parse test results from Jest JSON output +if [ -f "$JSON_FILE" ]; then + # Extract test counts using jq or grep/sed + # Jest JSON structure: { "numTotalTests": N, "numPassedTests": N, "numFailedTests": N, "numPendingTests": N, ... } + + if command -v jq &> /dev/null; then + # Use jq if available (preferred) + total_tests=$(jq -r '.numTotalTests // 0' "$JSON_FILE") + passed=$(jq -r '.numPassedTests // 0' "$JSON_FILE") + failed=$(jq -r '.numFailedTests // 0' "$JSON_FILE") + skipped=$(jq -r '.numPendingTests // 0' "$JSON_FILE") + + # Extract failed test details + failed_tests_file=$(mktemp) + jq -r '.testResults[]? | select(.status == "failed") | .assertionResults[]? | select(.status == "failed") | "\(.ancestorTitles | join(" > ")) > \(.title)"' "$JSON_FILE" > "$failed_tests_file" 2>/dev/null || true + else + # Fallback to grep/sed if jq is not available + total_tests=$(grep -oP '"numTotalTests":\s*\K[0-9]+' "$JSON_FILE" | head -1) + passed=$(grep -oP '"numPassedTests":\s*\K[0-9]+' "$JSON_FILE" | head -1) + failed=$(grep -oP '"numFailedTests":\s*\K[0-9]+' "$JSON_FILE" | head -1) + skipped=$(grep -oP '"numPendingTests":\s*\K[0-9]+' "$JSON_FILE" | head -1) + + # Extract failed test names (basic extraction without jq) + failed_tests_file=$(mktemp) + grep -oP '"fullName":\s*"\K[^"]*' "$JSON_FILE" | while read -r line; do + if echo "$line" | grep -q "failed"; then + echo "$line" >> "$failed_tests_file" + fi + done 2>/dev/null || true + fi + + # Default to 0 if values are empty + total_tests=${total_tests:-0} + passed=${passed:-0} + failed=${failed:-0} + skipped=${skipped:-0} + + echo "| Status | Count |" >> $GITHUB_STEP_SUMMARY + echo "|--------|-------|" >> $GITHUB_STEP_SUMMARY + echo "| ✅ Passed | $passed |" >> $GITHUB_STEP_SUMMARY + echo "| ❌ Failed | $failed |" >> $GITHUB_STEP_SUMMARY + echo "| ⏭️ Skipped | $skipped |" >> $GITHUB_STEP_SUMMARY + echo "| **Total** | **$total_tests** |" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + + # List failed tests if any + if [ "$failed" -gt 0 ]; then + echo "### ❌ Failed Tests" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + + if [ -s "$failed_tests_file" ]; then + while IFS= read -r test; do + echo "- \`$test\`" >> $GITHUB_STEP_SUMMARY + done < "$failed_tests_file" + else + echo "_Unable to parse individual test names_" >> $GITHUB_STEP_SUMMARY + fi + + echo "" >> $GITHUB_STEP_SUMMARY + echo "❌ **Tests failed!**" >> $GITHUB_STEP_SUMMARY + rm -f "$failed_tests_file" + exit 1 + else + echo "✅ **All tests passed!**" >> $GITHUB_STEP_SUMMARY + fi + + rm -f "$failed_tests_file" +else + echo "⚠️ No test results found at: $JSON_FILE" >> $GITHUB_STEP_SUMMARY + exit 1 +fi + diff --git a/.github/scripts/generate-test-summary-surefire.sh b/.github/scripts/generate-test-summary-surefire.sh new file mode 100644 index 0000000..fee0e56 --- /dev/null +++ b/.github/scripts/generate-test-summary-surefire.sh @@ -0,0 +1,82 @@ +#!/bin/bash +set -e + +# Generate Test Summary from Maven Surefire Reports +# Usage: ./generate-test-summary-surefire.sh + +REPORTS_DIR="${1:-target/surefire-reports}" + +echo "## Test Results" >> $GITHUB_STEP_SUMMARY +echo "" >> $GITHUB_STEP_SUMMARY + +# Parse test results from Surefire reports +if [ -d "$REPORTS_DIR" ]; then + total_tests=0 + failures=0 + errors=0 + skipped=0 + failed_tests_file=$(mktemp) + + for file in "$REPORTS_DIR"/TEST-*.xml; do + if [ -f "$file" ]; then + # Extract test counts from XML + tests=$(grep -oP 'tests="\K[0-9]+' "$file" | head -1) + fails=$(grep -oP 'failures="\K[0-9]+' "$file" | head -1) + errs=$(grep -oP 'errors="\K[0-9]+' "$file" | head -1) + skip=$(grep -oP 'skipped="\K[0-9]+' "$file" | head -1) + + total_tests=$((total_tests + ${tests:-0})) + failures=$((failures + ${fails:-0})) + errors=$((errors + ${errs:-0})) + skipped=$((skipped + ${skip:-0})) + + # Extract failed test cases + if [ "${fails:-0}" -gt 0 ] || [ "${errs:-0}" -gt 0 ]; then + classname=$(basename "$file" .xml | sed 's/^TEST-//') + + # Find failed testcases (with failure or error elements) + grep -oP ']*name="[^"]*"[^>]*>.*?<(failure|error)' "$file" | \ + grep -oP 'name="\K[^"]*' | while read -r testname; do + echo "$classname.$testname" >> "$failed_tests_file" + done + fi + fi + done + + passed=$((total_tests - failures - errors - skipped)) + + echo "| Status | Count |" >> $GITHUB_STEP_SUMMARY + echo "|--------|-------|" >> $GITHUB_STEP_SUMMARY + echo "| ✅ Passed | $passed |" >> $GITHUB_STEP_SUMMARY + echo "| ❌ Failed | $((failures + errors)) |" >> $GITHUB_STEP_SUMMARY + echo "| ⏭️ Skipped | $skipped |" >> $GITHUB_STEP_SUMMARY + echo "| **Total** | **$total_tests** |" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + + # List failed tests if any + if [ $((failures + errors)) -gt 0 ]; then + echo "### ❌ Failed Tests" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + + if [ -s "$failed_tests_file" ]; then + while IFS= read -r test; do + echo "- \`$test\`" >> $GITHUB_STEP_SUMMARY + done < "$failed_tests_file" + else + echo "_Unable to parse individual test names_" >> $GITHUB_STEP_SUMMARY + fi + + echo "" >> $GITHUB_STEP_SUMMARY + echo "❌ **Tests failed!**" >> $GITHUB_STEP_SUMMARY + rm -f "$failed_tests_file" + exit 1 + else + echo "✅ **All tests passed!**" >> $GITHUB_STEP_SUMMARY + fi + + rm -f "$failed_tests_file" +else + echo "⚠️ No test results found at: $REPORTS_DIR" >> $GITHUB_STEP_SUMMARY + exit 1 +fi + diff --git a/.github/workflows/run-express-tests.yml b/.github/workflows/run-express-tests.yml index c83b23f..04df4b8 100644 --- a/.github/workflows/run-express-tests.yml +++ b/.github/workflows/run-express-tests.yml @@ -30,7 +30,7 @@ jobs: run: npm install - name: Run tests - run: npm test + run: npm test -- --json --outputFile=test-results.json || true env: MONGODB_URI: ${{ secrets.MFLIX_URI }} @@ -39,5 +39,13 @@ jobs: if: always() with: name: test-results - path: server/express/coverage/ + path: | + server/express/coverage/ + server/express/test-results.json retention-days: 30 + + - name: Generate Test Summary + if: always() + run: | + chmod +x .github/scripts/generate-test-summary-jest.sh + .github/scripts/generate-test-summary-jest.sh server/express/test-results.json diff --git a/.github/workflows/run-java-spring-boot-tests.yml b/.github/workflows/run-java-spring-boot-tests.yml index 001cfba..f587041 100644 --- a/.github/workflows/run-java-spring-boot-tests.yml +++ b/.github/workflows/run-java-spring-boot-tests.yml @@ -51,8 +51,8 @@ jobs: path: server/java-spring/target/surefire-reports/ retention-days: 30 - - name: Test Summary - uses: test-summary/action@v2 + - name: Generate Test Summary if: always() - with: - paths: server/java-spring/target/surefire-reports/TEST-*.xml + run: | + chmod +x .github/scripts/generate-test-summary-surefire.sh + .github/scripts/generate-test-summary-surefire.sh server/java-spring/target/surefire-reports diff --git a/server/express/.gitignore b/server/express/.gitignore index f9e1d4c..cdf5c6d 100644 --- a/server/express/.gitignore +++ b/server/express/.gitignore @@ -19,6 +19,9 @@ logs # Test coverage coverage/ +# Test results +test-results.json + # Optional npm cache directory .npm From 7ab845514718b47107d587df5d68fb6adb3ea7d0 Mon Sep 17 00:00:00 2001 From: dacharyc Date: Wed, 5 Nov 2025 17:17:54 -0500 Subject: [PATCH 03/12] Fix script path issue by overriding working directory in test summary step --- .github/workflows/run-express-tests.yml | 1 + .github/workflows/run-java-spring-boot-tests.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/run-express-tests.yml b/.github/workflows/run-express-tests.yml index 04df4b8..97d362f 100644 --- a/.github/workflows/run-express-tests.yml +++ b/.github/workflows/run-express-tests.yml @@ -46,6 +46,7 @@ jobs: - name: Generate Test Summary if: always() + working-directory: . run: | chmod +x .github/scripts/generate-test-summary-jest.sh .github/scripts/generate-test-summary-jest.sh server/express/test-results.json diff --git a/.github/workflows/run-java-spring-boot-tests.yml b/.github/workflows/run-java-spring-boot-tests.yml index f587041..ddbc32f 100644 --- a/.github/workflows/run-java-spring-boot-tests.yml +++ b/.github/workflows/run-java-spring-boot-tests.yml @@ -53,6 +53,7 @@ jobs: - name: Generate Test Summary if: always() + working-directory: . run: | chmod +x .github/scripts/generate-test-summary-surefire.sh .github/scripts/generate-test-summary-surefire.sh server/java-spring/target/surefire-reports From b38963e91d5ad8e05a231bc6e4faae606172183e Mon Sep 17 00:00:00 2001 From: dacharyc Date: Wed, 5 Nov 2025 17:30:14 -0500 Subject: [PATCH 04/12] Pass MONGODB_URI directly to maven when invoking it --- .github/workflows/run-java-spring-boot-tests.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run-java-spring-boot-tests.yml b/.github/workflows/run-java-spring-boot-tests.yml index ddbc32f..019c08c 100644 --- a/.github/workflows/run-java-spring-boot-tests.yml +++ b/.github/workflows/run-java-spring-boot-tests.yml @@ -32,15 +32,14 @@ jobs: run: chmod +x mvnw - name: Run unit tests - run: ./mvnw test + run: ./mvnw test -DMONGODB_URI="${MONGODB_URI}" env: MONGODB_URI: ${{ secrets.MFLIX_URI }} - name: Run integration tests - run: ./mvnw test -Dtest=MongoDBSearchIntegrationTest + run: ./mvnw test -Dtest=MongoDBSearchIntegrationTest -DMONGODB_URI="${MONGODB_URI}" -DENABLE_SEARCH_TESTS=true env: MONGODB_URI: ${{ secrets.MFLIX_URI }} - ENABLE_SEARCH_TESTS: true continue-on-error: true - name: Upload test results From 21e89a0727f7de42e025691ab45b747274d93fbb Mon Sep 17 00:00:00 2001 From: dacharyc Date: Wed, 5 Nov 2025 17:35:43 -0500 Subject: [PATCH 05/12] Handle env variables in pom.xml for Surefire Plugin --- .../workflows/run-java-spring-boot-tests.yml | 5 +++-- server/java-spring/pom.xml | 17 +++++++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/run-java-spring-boot-tests.yml b/.github/workflows/run-java-spring-boot-tests.yml index 019c08c..ddbc32f 100644 --- a/.github/workflows/run-java-spring-boot-tests.yml +++ b/.github/workflows/run-java-spring-boot-tests.yml @@ -32,14 +32,15 @@ jobs: run: chmod +x mvnw - name: Run unit tests - run: ./mvnw test -DMONGODB_URI="${MONGODB_URI}" + run: ./mvnw test env: MONGODB_URI: ${{ secrets.MFLIX_URI }} - name: Run integration tests - run: ./mvnw test -Dtest=MongoDBSearchIntegrationTest -DMONGODB_URI="${MONGODB_URI}" -DENABLE_SEARCH_TESTS=true + run: ./mvnw test -Dtest=MongoDBSearchIntegrationTest env: MONGODB_URI: ${{ secrets.MFLIX_URI }} + ENABLE_SEARCH_TESTS: true continue-on-error: true - name: Upload test results diff --git a/server/java-spring/pom.xml b/server/java-spring/pom.xml index d1a45d3..52e5363 100644 --- a/server/java-spring/pom.xml +++ b/server/java-spring/pom.xml @@ -1,23 +1,23 @@ 4.0.0 - + org.springframework.boot spring-boot-starter-parent 3.5.7 - + com.mongodb sample-app-java-mflix 1.0.0 sample-app-java-mflix Java Spring Boot backend for MongoDB sample_mflix application demonstrating CRUD operations using Spring Data MongoDB - + 21 2.8.13 @@ -80,7 +80,7 @@ - + org.springframework.boot @@ -101,7 +101,7 @@ ${langchain4j.version} - + @@ -138,6 +138,11 @@ -javaagent:${settings.localRepository}/net/bytebuddy/byte-buddy-agent/${byte-buddy.version}/byte-buddy-agent-${byte-buddy.version}.jar -Xshare:off + + + ${env.MONGODB_URI} + ${env.ENABLE_SEARCH_TESTS} + From 0d1e0b41d58982220f6331a27bc27933f3aee551 Mon Sep 17 00:00:00 2001 From: dacharyc Date: Wed, 5 Nov 2025 17:41:07 -0500 Subject: [PATCH 06/12] Try 'argLine' I guess? --- .github/workflows/run-java-spring-boot-tests.yml | 9 ++------- server/java-spring/pom.xml | 5 ----- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/.github/workflows/run-java-spring-boot-tests.yml b/.github/workflows/run-java-spring-boot-tests.yml index ddbc32f..2f15969 100644 --- a/.github/workflows/run-java-spring-boot-tests.yml +++ b/.github/workflows/run-java-spring-boot-tests.yml @@ -32,15 +32,10 @@ jobs: run: chmod +x mvnw - name: Run unit tests - run: ./mvnw test - env: - MONGODB_URI: ${{ secrets.MFLIX_URI }} + run: ./mvnw test -Dspring.data.mongodb.uri="${{ secrets.MFLIX_URI }}" - name: Run integration tests - run: ./mvnw test -Dtest=MongoDBSearchIntegrationTest - env: - MONGODB_URI: ${{ secrets.MFLIX_URI }} - ENABLE_SEARCH_TESTS: true + run: ./mvnw test -Dtest=MongoDBSearchIntegrationTest -Dspring.data.mongodb.uri="${{ secrets.MFLIX_URI }}" -DENABLE_SEARCH_TESTS=true continue-on-error: true - name: Upload test results diff --git a/server/java-spring/pom.xml b/server/java-spring/pom.xml index 52e5363..baff5c0 100644 --- a/server/java-spring/pom.xml +++ b/server/java-spring/pom.xml @@ -138,11 +138,6 @@ -javaagent:${settings.localRepository}/net/bytebuddy/byte-buddy-agent/${byte-buddy.version}/byte-buddy-agent-${byte-buddy.version}.jar -Xshare:off - - - ${env.MONGODB_URI} - ${env.ENABLE_SEARCH_TESTS} - From 851526b6cf54a011b113a14298f8c1045a872cd7 Mon Sep 17 00:00:00 2001 From: dacharyc Date: Wed, 5 Nov 2025 17:46:30 -0500 Subject: [PATCH 07/12] Maybe this? Maybe? --- .github/workflows/run-java-spring-boot-tests.yml | 4 ++-- server/java-spring/pom.xml | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run-java-spring-boot-tests.yml b/.github/workflows/run-java-spring-boot-tests.yml index 2f15969..0b10793 100644 --- a/.github/workflows/run-java-spring-boot-tests.yml +++ b/.github/workflows/run-java-spring-boot-tests.yml @@ -32,10 +32,10 @@ jobs: run: chmod +x mvnw - name: Run unit tests - run: ./mvnw test -Dspring.data.mongodb.uri="${{ secrets.MFLIX_URI }}" + run: ./mvnw test -DMONGODB_URI="${{ secrets.MFLIX_URI }}" - name: Run integration tests - run: ./mvnw test -Dtest=MongoDBSearchIntegrationTest -Dspring.data.mongodb.uri="${{ secrets.MFLIX_URI }}" -DENABLE_SEARCH_TESTS=true + run: ./mvnw test -Dtest=MongoDBSearchIntegrationTest -DMONGODB_URI="${{ secrets.MFLIX_URI }}" -DENABLE_SEARCH_TESTS=true continue-on-error: true - name: Upload test results diff --git a/server/java-spring/pom.xml b/server/java-spring/pom.xml index baff5c0..9afa58e 100644 --- a/server/java-spring/pom.xml +++ b/server/java-spring/pom.xml @@ -138,6 +138,11 @@ -javaagent:${settings.localRepository}/net/bytebuddy/byte-buddy-agent/${byte-buddy.version}/byte-buddy-agent-${byte-buddy.version}.jar -Xshare:off + + + ${MONGODB_URI} + ${ENABLE_SEARCH_TESTS} + From 113a1b9152d769d4e683638354a0cd71a0bf6b63 Mon Sep 17 00:00:00 2001 From: dacharyc Date: Wed, 5 Nov 2025 17:53:42 -0500 Subject: [PATCH 08/12] Try what works in the docs repo? --- .github/workflows/run-java-spring-boot-tests.yml | 9 +++++++-- server/java-spring/pom.xml | 10 +++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/run-java-spring-boot-tests.yml b/.github/workflows/run-java-spring-boot-tests.yml index 0b10793..ddbc32f 100644 --- a/.github/workflows/run-java-spring-boot-tests.yml +++ b/.github/workflows/run-java-spring-boot-tests.yml @@ -32,10 +32,15 @@ jobs: run: chmod +x mvnw - name: Run unit tests - run: ./mvnw test -DMONGODB_URI="${{ secrets.MFLIX_URI }}" + run: ./mvnw test + env: + MONGODB_URI: ${{ secrets.MFLIX_URI }} - name: Run integration tests - run: ./mvnw test -Dtest=MongoDBSearchIntegrationTest -DMONGODB_URI="${{ secrets.MFLIX_URI }}" -DENABLE_SEARCH_TESTS=true + run: ./mvnw test -Dtest=MongoDBSearchIntegrationTest + env: + MONGODB_URI: ${{ secrets.MFLIX_URI }} + ENABLE_SEARCH_TESTS: true continue-on-error: true - name: Upload test results diff --git a/server/java-spring/pom.xml b/server/java-spring/pom.xml index 9afa58e..dda7415 100644 --- a/server/java-spring/pom.xml +++ b/server/java-spring/pom.xml @@ -26,6 +26,10 @@ 1.12.0 1.17.8 1.0.0-beta3 + + ${env.MONGODB_URI} + + ${env.ENABLE_SEARCH_TESTS} @@ -138,10 +142,10 @@ -javaagent:${settings.localRepository}/net/bytebuddy/byte-buddy-agent/${byte-buddy.version}/byte-buddy-agent-${byte-buddy.version}.jar -Xshare:off - + - ${MONGODB_URI} - ${ENABLE_SEARCH_TESTS} + ${mongodb.uri} + ${enable.search.tests} From 1974e1e0d9a2304378eeabc052ff4d9b46683aff Mon Sep 17 00:00:00 2001 From: dacharyc Date: Wed, 5 Nov 2025 17:58:15 -0500 Subject: [PATCH 09/12] Try, try again --- .github/workflows/run-java-spring-boot-tests.yml | 16 +++++++++------- server/java-spring/pom.xml | 10 +++------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/.github/workflows/run-java-spring-boot-tests.yml b/.github/workflows/run-java-spring-boot-tests.yml index ddbc32f..11bfd2b 100644 --- a/.github/workflows/run-java-spring-boot-tests.yml +++ b/.github/workflows/run-java-spring-boot-tests.yml @@ -32,15 +32,17 @@ jobs: run: chmod +x mvnw - name: Run unit tests - run: ./mvnw test - env: - MONGODB_URI: ${{ secrets.MFLIX_URI }} + run: | + export MONGODB_URI="${{ secrets.MFLIX_URI }}" + ./mvnw test + shell: bash - name: Run integration tests - run: ./mvnw test -Dtest=MongoDBSearchIntegrationTest - env: - MONGODB_URI: ${{ secrets.MFLIX_URI }} - ENABLE_SEARCH_TESTS: true + run: | + export MONGODB_URI="${{ secrets.MFLIX_URI }}" + export ENABLE_SEARCH_TESTS=true + ./mvnw test -Dtest=MongoDBSearchIntegrationTest + shell: bash continue-on-error: true - name: Upload test results diff --git a/server/java-spring/pom.xml b/server/java-spring/pom.xml index dda7415..0edfedf 100644 --- a/server/java-spring/pom.xml +++ b/server/java-spring/pom.xml @@ -26,10 +26,6 @@ 1.12.0 1.17.8 1.0.0-beta3 - - ${env.MONGODB_URI} - - ${env.ENABLE_SEARCH_TESTS} @@ -142,10 +138,10 @@ -javaagent:${settings.localRepository}/net/bytebuddy/byte-buddy-agent/${byte-buddy.version}/byte-buddy-agent-${byte-buddy.version}.jar -Xshare:off - + - ${mongodb.uri} - ${enable.search.tests} + ${env.MONGODB_URI} + ${env.ENABLE_SEARCH_TESTS} From c612218ac2cd2c8df7d64a514cb6bae06ddce59a Mon Sep 17 00:00:00 2001 From: dacharyc Date: Wed, 5 Nov 2025 18:05:05 -0500 Subject: [PATCH 10/12] Zillionth time is the charm? --- .github/workflows/run-java-spring-boot-tests.yml | 15 ++++++--------- server/java-spring/pom.xml | 5 ----- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/.github/workflows/run-java-spring-boot-tests.yml b/.github/workflows/run-java-spring-boot-tests.yml index 11bfd2b..138ec1a 100644 --- a/.github/workflows/run-java-spring-boot-tests.yml +++ b/.github/workflows/run-java-spring-boot-tests.yml @@ -17,6 +17,10 @@ jobs: run: working-directory: server/java-spring + env: + MONGODB_URI: ${{ secrets.MFLIX_URI }} + ENABLE_SEARCH_TESTS: true + steps: - name: Checkout code uses: actions/checkout@v5 @@ -32,17 +36,10 @@ jobs: run: chmod +x mvnw - name: Run unit tests - run: | - export MONGODB_URI="${{ secrets.MFLIX_URI }}" - ./mvnw test - shell: bash + run: ./mvnw test - name: Run integration tests - run: | - export MONGODB_URI="${{ secrets.MFLIX_URI }}" - export ENABLE_SEARCH_TESTS=true - ./mvnw test -Dtest=MongoDBSearchIntegrationTest - shell: bash + run: ./mvnw test -Dtest=MongoDBSearchIntegrationTest continue-on-error: true - name: Upload test results diff --git a/server/java-spring/pom.xml b/server/java-spring/pom.xml index 0edfedf..baff5c0 100644 --- a/server/java-spring/pom.xml +++ b/server/java-spring/pom.xml @@ -138,11 +138,6 @@ -javaagent:${settings.localRepository}/net/bytebuddy/byte-buddy-agent/${byte-buddy.version}/byte-buddy-agent-${byte-buddy.version}.jar -Xshare:off - - - ${env.MONGODB_URI} - ${env.ENABLE_SEARCH_TESTS} - From 1b4af1567f62eb642f378de53231e52591c2b7be Mon Sep 17 00:00:00 2001 From: dacharyc Date: Wed, 5 Nov 2025 18:14:10 -0500 Subject: [PATCH 11/12] Add debug output to workflow --- .github/workflows/run-java-spring-boot-tests.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/run-java-spring-boot-tests.yml b/.github/workflows/run-java-spring-boot-tests.yml index 138ec1a..07a599d 100644 --- a/.github/workflows/run-java-spring-boot-tests.yml +++ b/.github/workflows/run-java-spring-boot-tests.yml @@ -35,6 +35,13 @@ jobs: - name: Make mvnw executable run: chmod +x mvnw + - name: Debug environment variables + run: | + echo "Checking environment variables..." + echo "MONGODB_URI is set: $(if [ -n "$MONGODB_URI" ]; then echo 'YES'; else echo 'NO'; fi)" + echo "ENABLE_SEARCH_TESTS is set: $(if [ -n "$ENABLE_SEARCH_TESTS" ]; then echo 'YES'; else echo 'NO'; fi)" + echo "MONGODB_URI length: ${#MONGODB_URI}" + - name: Run unit tests run: ./mvnw test From 54ccf5f4497e3651589201adbaff87c3a0124a78 Mon Sep 17 00:00:00 2001 From: dacharyc Date: Wed, 5 Nov 2025 18:30:59 -0500 Subject: [PATCH 12/12] Try using GitHub environment --- .github/workflows/run-express-tests.yml | 6 +++++- .github/workflows/run-java-spring-boot-tests.yml | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run-express-tests.yml b/.github/workflows/run-express-tests.yml index 97d362f..e13673e 100644 --- a/.github/workflows/run-express-tests.yml +++ b/.github/workflows/run-express-tests.yml @@ -1,7 +1,7 @@ name: Run Express Tests on: - pull_request: + pull_request_target: branches: - development push: @@ -12,6 +12,8 @@ jobs: test: name: Run Express Tests runs-on: ubuntu-latest + # Require manual approval for fork PRs + environment: testing defaults: run: @@ -20,6 +22,8 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v5 + with: + ref: ${{ github.event.pull_request.head.sha }} - name: Set up Node.js uses: actions/setup-node@v4 diff --git a/.github/workflows/run-java-spring-boot-tests.yml b/.github/workflows/run-java-spring-boot-tests.yml index 07a599d..8108f69 100644 --- a/.github/workflows/run-java-spring-boot-tests.yml +++ b/.github/workflows/run-java-spring-boot-tests.yml @@ -1,7 +1,7 @@ name: Run Java Spring Boot Tests on: - pull_request: + pull_request_target: branches: - development push: @@ -12,6 +12,8 @@ jobs: test: name: Run Java Spring Boot Tests runs-on: ubuntu-latest + # Require manual approval for fork PRs + environment: testing defaults: run: @@ -24,6 +26,8 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v5 + with: + ref: ${{ github.event.pull_request.head.sha }} - name: Set up JDK 21 uses: actions/setup-java@v5