Merge pull request #40 from mongodb/docsp-55467 #41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Run Java Spring Boot Tests | |
| on: | |
| pull_request: | |
| branches: | |
| - development | |
| paths: | |
| - 'mflix/server/java-spring/**' | |
| push: | |
| branches: | |
| - development | |
| paths: | |
| - 'mflix/server/java-spring/**' | |
| jobs: | |
| test: | |
| name: Run Java Spring Boot Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Install Atlas CLI | |
| run: | | |
| curl https://fastdl.mongodb.org/mongocli/mongodb-atlas-cli_1.47.0_linux_x86_64.deb --output atlas-cli.deb | |
| sudo apt install ./atlas-cli.deb | |
| - name: Set up a local deployment using Atlas CLI | |
| run: | | |
| atlas deployments setup myLocalRs1 --type local --port 27017 --force | |
| - name: Install MongoDB Database Tools to load sample data | |
| run: | | |
| curl https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2204-x86_64-100.13.0.deb --output mdb-db-tools.deb | |
| sudo apt install ./mdb-db-tools.deb | |
| - name: Download sample data | |
| run: curl https://atlas-education.s3.amazonaws.com/sampledata.archive -o sampledata.archive | |
| - name: Add sample data to database | |
| run: mongorestore --archive=sampledata.archive --port=27017 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| cache: 'maven' | |
| - name: Make mvnw executable | |
| working-directory: mflix/server/java-spring | |
| run: chmod +x mvnw | |
| - name: Run unit tests | |
| working-directory: mflix/server/java-spring | |
| run: ./mvnw test | |
| env: | |
| MONGODB_URI: mongodb://localhost:27017/sample_mflix | |
| - name: Run integration tests | |
| working-directory: mflix/server/java-spring | |
| run: ./mvnw test -Dtest=MongoDBSearchIntegrationTest | |
| continue-on-error: true | |
| env: | |
| MONGODB_URI: mongodb://localhost:27017/sample_mflix | |
| ENABLE_SEARCH_TESTS: true | |
| # Note: Vector search tests will be skipped without VOYAGE_API_KEY | |
| # Run these tests locally with a valid API key | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: test-results | |
| path: mflix/server/java-spring/target/surefire-reports/ | |
| retention-days: 30 | |
| - name: Generate Test Summary | |
| if: always() | |
| run: | | |
| chmod +x .github/scripts/generate-test-summary-surefire.sh | |
| .github/scripts/generate-test-summary-surefire.sh mflix/server/java-spring/target/surefire-reports |