diff --git a/.github/workflows/sonar.yaml b/.github/workflows/sonar.yaml
new file mode 100644
index 0000000000..a082932244
--- /dev/null
+++ b/.github/workflows/sonar.yaml
@@ -0,0 +1,36 @@
+name: Sonar
+on:
+ push:
+ branches:
+ - master
+ pull_request:
+ types: [opened, synchronize, reopened]
+jobs:
+ build:
+ name: Sonar
+ runs-on: ubuntu-20.04
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
+ - name: Set up JDK 11
+ uses: actions/setup-java@v1
+ with:
+ java-version: 11
+ - name: Cache SonarCloud packages
+ uses: actions/cache@v1
+ with:
+ path: ~/.sonar/cache
+ key: ${{ runner.os }}-sonar
+ restore-keys: ${{ runner.os }}-sonar
+ - name: Cache Maven packages
+ uses: actions/cache@v1
+ with:
+ path: ~/.m2
+ key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
+ restore-keys: ${{ runner.os }}-m2
+ - name: Build and analyze
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
+ SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+ run: mvn -B clean verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Psonar -Pintegration
diff --git a/pom.xml b/pom.xml
index 7bc7e0d984..71d16436f1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1478,5 +1478,47 @@
true
+
+ sonar
+
+ false
+
+
+
+
+ org.jacoco
+ jacoco-maven-plugin
+ 0.8.6
+
+
+ default-prepare-agent
+
+ prepare-agent
+
+
+
+ default-report
+
+ report
+
+
+
+ default-check
+
+ check
+
+
+
+
+
+
+
+
+
+
+ https://sonarcloud.io
+ eclipse
+
+
diff --git a/tests/legacy-e2e/pom.xml b/tests/legacy-e2e/pom.xml
index cc525d82cb..84e7065060 100644
--- a/tests/legacy-e2e/pom.xml
+++ b/tests/legacy-e2e/pom.xml
@@ -33,6 +33,7 @@
20.0
1.2.17
6.8.21
+ true