Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/sonar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@ jobs:
run: |
mkdir -p src/test/resources
echo ${{ secrets.APPLICATION_TEST_PROPERTIES }} | base64 -d > src/test/resources/application-test.properties
echo "spring.sql.init.mode=never" >> src/test/resources/application-test.properties
mvn clean verify sonar:sonar -Dsonar.qualitygate.wait=true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ build/

### VS Code ###
.vscode/

# Test configuration generated in CI
src/test/resources/application-test.properties
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,28 @@ A GitHub Actions workflow is configured in:
mvn clean verify sonar:sonar
```

The CI command waits for the Quality Gate result:

```bash
./mvnw clean verify sonar:sonar -Dsonar.qualitygate.wait=true
```

Before running tests, the workflow recreates:

```bash
src/test/resources/application-test.properties
```

from a Base64-encoded GitHub secret.

### Required GitHub Secrets

- `SONAR_TOKEN`
- `SONAR_HOST_URL`
- `APPLICATION_TEST_PROPERTIES` (Base64-encoded `application-test.properties` content)

> `GITHUB_TOKEN` is provided automatically by GitHub Actions.

### Generate the JaCoCo coverage report locally

Run:
Expand Down
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
<sonar.coverage.jacoco.xmlReportPaths>${project.build.directory}/site/jacoco/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
</properties>
<dependencies>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.ActiveProfiles;

@SpringBootTest
@ActiveProfiles("test")
class SpringBootJavaRandomUserApplicationTests {

@Test
Expand Down