Fix/use h2 for sonarqube #21
Workflow file for this run
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
| on: | |
| push: | |
| branches: | |
| - '**' | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| name: Sonar | |
| jobs: | |
| sonarqube: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
| - name: Set up JDK 25 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: "temurin" | |
| java-version: 25 | |
| overwrite-settings: false | |
| - name: Cache SonarQube packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.sonar/cache | |
| key: ${{ runner.os }}-sonar | |
| restore-keys: ${{ runner.os }}-sonar | |
| - name: Cache Maven packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: ${{ runner.os }}-maven | |
| - name: Build and analyze | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} | |
| run: | | |
| mkdir -p src/test/resources | |
| if [ -n "${{ secrets.APPLICATION_TEST_PROPERTIES }}" ]; then | |
| if printf '%s' "${{ secrets.APPLICATION_TEST_PROPERTIES }}" | base64 --decode > src/test/resources/application-test.properties 2>/dev/null; then | |
| echo "Loaded APPLICATION_TEST_PROPERTIES as base64" | |
| else | |
| printf '%s\n' "${{ secrets.APPLICATION_TEST_PROPERTIES }}" > src/test/resources/application-test.properties | |
| echo "Loaded APPLICATION_TEST_PROPERTIES as raw text" | |
| fi | |
| else | |
| : > src/test/resources/application-test.properties | |
| fi | |
| { | |
| echo "spring.datasource.url=jdbc:h2:mem:testdb;MODE=PostgreSQL;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE" | |
| echo "spring.datasource.driver-class-name=org.h2.Driver" | |
| echo "spring.datasource.username=sa" | |
| echo "spring.datasource.password=" | |
| echo "spring.sql.init.mode=never" | |
| } >> src/test/resources/application-test.properties | |
| ./mvnw clean verify sonar:sonar -Dsonar.qualitygate.wait=true |