11name : CI Build
22
33on :
4- - push
4+ push :
5+ branches :
6+ - main
7+ pull_request :
58
69jobs :
710 build :
811 runs-on : ubuntu-latest
12+ concurrency :
13+ group : ${{ github.workflow }}-${{ github.ref }}
14+ cancel-in-progress : true
915 steps :
1016 - name : Checkout the repository
11- uses : actions/checkout@v2
17+ uses : actions/checkout@v3
1218 with :
1319 fetch-depth : 0
1420 - name : Set up JDK 11
15- uses : actions/setup-java@v1
21+ uses : actions/setup-java@v3
1622 with :
23+ distribution : ' temurin'
1724 java-version : 11
18- - name : Cache local Maven repository
19- uses : actions/cache@v2
25+ cache : ' maven'
26+ - name : Cache SonarCloud packages
27+ uses : actions/cache@v3
2028 with :
21- path : ~/.m2/repository
22- key : ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
23- restore-keys : |
24- ${{ runner.os }}-maven-
29+ path : ~/.sonar/cache
30+ key : ${{ runner.os }}-sonar
31+ restore-keys : ${{ runner.os }}-sonar
32+ - name : Enable testcontainer reuse
33+ run : echo 'testcontainers.reuse.enable=true' > "$HOME/.testcontainers.properties"
2534 - name : Run tests and build with Maven
26- run : mvn -B clean verify sonar:sonar --file pom.xml -Dsonar.organization=exasol -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONAR_TOKEN
35+ run : |
36+ mvn --batch-mode clean verify \
37+ -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
38+ -DtrimStackTrace=false
39+ - name : Publish Test Report
40+ uses : scacap/action-surefire-report@v1
41+ if : ${{ always() && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' }}
42+ with :
43+ github_token : ${{ secrets.GITHUB_TOKEN }}
44+ - name : Sonar analysis
45+ if : ${{ env.SONAR_TOKEN != null }}
46+ run : |
47+ mvn --batch-mode org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \
48+ -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
49+ -DtrimStackTrace=false \
50+ -Dsonar.organization=exasol \
51+ -Dsonar.host.url=https://sonarcloud.io \
52+ -Dsonar.login=$SONAR_TOKEN
2753 env :
28- GITHUB_OAUTH : ${{ secrets.GITHUB_TOKEN }}
2954 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
3055 SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
0 commit comments