11name : Run Java Spring Boot Tests
22
33on :
4- pull_request_target :
4+ pull_request :
55 branches :
66 - development
77 paths :
@@ -16,22 +16,30 @@ jobs:
1616 test :
1717 name : Run Java Spring Boot Tests
1818 runs-on : ubuntu-latest
19- # Require manual approval for fork PRs
20- environment : testing
21-
22- defaults :
23- run :
24- working-directory : mflix/server/java-spring
25-
26- env :
27- MONGODB_URI : ${{ secrets.MFLIX_URI }}
28- ENABLE_SEARCH_TESTS : true
2919
3020 steps :
3121 - name : Checkout code
3222 uses : actions/checkout@v5
33- with :
34- ref : ${{ github.event.pull_request.head.sha }}
23+
24+ - name : Install Atlas CLI
25+ run : |
26+ curl https://fastdl.mongodb.org/mongocli/mongodb-atlas-cli_1.47.0_linux_x86_64.deb --output atlas-cli.deb
27+ sudo apt install ./atlas-cli.deb
28+
29+ - name : Set up a local deployment using Atlas CLI
30+ run : |
31+ atlas deployments setup myLocalRs1 --type local --port 27017 --force
32+
33+ - name : Install MongoDB Database Tools to load sample data
34+ run : |
35+ curl https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2204-x86_64-100.13.0.deb --output mdb-db-tools.deb
36+ sudo apt install ./mdb-db-tools.deb
37+
38+ - name : Download sample data
39+ run : curl https://atlas-education.s3.amazonaws.com/sampledata.archive -o sampledata.archive
40+
41+ - name : Add sample data to database
42+ run : mongorestore --archive=sampledata.archive --port=27017
3543
3644 - name : Set up JDK 21
3745 uses : actions/setup-java@v5
@@ -41,14 +49,24 @@ jobs:
4149 cache : ' maven'
4250
4351 - name : Make mvnw executable
52+ working-directory : mflix/server/java-spring
4453 run : chmod +x mvnw
4554
4655 - name : Run unit tests
56+ working-directory : mflix/server/java-spring
4757 run : ./mvnw test
58+ env :
59+ MONGODB_URI : mongodb://localhost:27017/sample_mflix
4860
4961 - name : Run integration tests
62+ working-directory : mflix/server/java-spring
5063 run : ./mvnw test -Dtest=MongoDBSearchIntegrationTest
5164 continue-on-error : true
65+ env :
66+ MONGODB_URI : mongodb://localhost:27017/sample_mflix
67+ ENABLE_SEARCH_TESTS : true
68+ # Note: Vector search tests will be skipped without VOYAGE_API_KEY
69+ # Run these tests locally with a valid API key
5270
5371 - name : Upload test results
5472 uses : actions/upload-artifact@v4
6078
6179 - name : Generate Test Summary
6280 if : always()
63- working-directory : .
6481 run : |
6582 chmod +x .github/scripts/generate-test-summary-surefire.sh
6683 .github/scripts/generate-test-summary-surefire.sh mflix/server/java-spring/target/surefire-reports
0 commit comments