forked from mongodb/docs-sample-apps
-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (57 loc) · 1.84 KB
/
run-java-spring-boot-tests.yml
File metadata and controls
69 lines (57 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Run Java Spring Boot Tests
on:
pull_request_target:
branches:
- development
push:
branches:
- development
jobs:
test:
name: Run Java Spring Boot Tests
runs-on: ubuntu-latest
# Require manual approval for fork PRs
environment: testing
defaults:
run:
working-directory: server/java-spring
env:
MONGODB_URI: ${{ secrets.MFLIX_URI }}
ENABLE_SEARCH_TESTS: true
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
with:
java-version: '21'
distribution: 'temurin'
cache: 'maven'
- 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
- name: Run integration tests
run: ./mvnw test -Dtest=MongoDBSearchIntegrationTest
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: 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