File tree Expand file tree Collapse file tree
src/test/java/com/xpeho/spring_boot_java_random_user Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3939 run : |
4040 mkdir -p src/test/resources
4141 echo ${{ secrets.APPLICATION_TEST_PROPERTIES }} | base64 -d > src/test/resources/application-test.properties
42+ echo "spring.sql.init.mode=never" >> src/test/resources/application-test.properties
4243 mvn clean verify sonar:sonar -Dsonar.qualitygate.wait=true
Original file line number Diff line number Diff line change 3131
3232# ## VS Code ###
3333.vscode /
34+
35+ # Test configuration generated in CI
36+ src /test /resources /application-test.properties
Original file line number Diff line number Diff line change @@ -151,6 +151,28 @@ A GitHub Actions workflow is configured in:
151151mvn clean verify sonar:sonar
152152```
153153
154+ The CI command waits for the Quality Gate result:
155+
156+ ``` bash
157+ ./mvnw clean verify sonar:sonar -Dsonar.qualitygate.wait=true
158+ ```
159+
160+ Before running tests, the workflow recreates:
161+
162+ ``` bash
163+ src/test/resources/application-test.properties
164+ ```
165+
166+ from a Base64-encoded GitHub secret.
167+
168+ ### Required GitHub Secrets
169+
170+ - ` SONAR_TOKEN `
171+ - ` SONAR_HOST_URL `
172+ - ` APPLICATION_TEST_PROPERTIES ` (Base64-encoded ` application-test.properties ` content)
173+
174+ > ` GITHUB_TOKEN ` is provided automatically by GitHub Actions.
175+
154176### Generate the JaCoCo coverage report locally
155177
156178Run:
Original file line number Diff line number Diff line change 3232 <sonar .coverage.jacoco.xmlReportPaths>${project.build.directory} /site/jacoco/jacoco.xml</sonar .coverage.jacoco.xmlReportPaths>
3333 </properties >
3434 <dependencies >
35+ <dependency >
36+ <groupId >com.h2database</groupId >
37+ <artifactId >h2</artifactId >
38+ <scope >test</scope >
39+ </dependency >
3540 <dependency >
3641 <groupId >org.springframework.boot</groupId >
3742 <artifactId >spring-boot-starter-actuator</artifactId >
Original file line number Diff line number Diff line change 22
33import org .junit .jupiter .api .Test ;
44import org .springframework .boot .test .context .SpringBootTest ;
5- import org .springframework .context .annotation . Import ;
5+ import org .springframework .test . context .ActiveProfiles ;
66
77@ SpringBootTest
8+ @ ActiveProfiles ("test" )
89class SpringBootJavaRandomUserApplicationTests {
910
1011 @ Test
You can’t perform that action at this time.
0 commit comments