mirror of
https://github.com/Telecominfraproject/wlan-cloud-services.git
synced 2025-11-01 19:17:49 +00:00
TOOLS-23: sonar (#13) - run sonar on dynamically generated list of projects in the repo
* TOOLS-23: init * added dependency * test * test * test * added projects * test * maven opts Xss2m * added all projects * test * disabled PR * enabled caching, enabled tip.jfrog proxy * fix path * sequential check * test2 * test3 * test4 * test5 * test6 * test * test * trigger 500 Internal Server Error * trigger * trigger * test * added sonar.pullrequest.branch * sonar.pullrequest.key * master branch * added dispatch event * fix maven user for jfrog * newline Co-authored-by: Eugene Taranov <eugene@taranov.me>
This commit is contained in:
committed by
GitHub
parent
28980ef961
commit
89610efd84
48
.github/workflows/maven_settings_template.xml
vendored
Normal file
48
.github/workflows/maven_settings_template.xml
vendored
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
<settings>
|
||||||
|
<servers>
|
||||||
|
<server>
|
||||||
|
<id>tip-wlan-cloud-maven-repo</id>
|
||||||
|
<username>${env.MAVEN_REPO_USERNAME}</username>
|
||||||
|
<password>${env.MAVEN_REPO_PASSWORD}</password>
|
||||||
|
</server>
|
||||||
|
<server>
|
||||||
|
<id>jfrog-spring-milestones</id>
|
||||||
|
<username>${env.MAVEN_REPO_USERNAME}</username>
|
||||||
|
<password>${env.MAVEN_REPO_PASSWORD}</password>
|
||||||
|
</server>
|
||||||
|
<server>
|
||||||
|
<id>jfrog-maven-central</id>
|
||||||
|
<username>${env.MAVEN_REPO_USERNAME}</username>
|
||||||
|
<password>${env.MAVEN_REPO_PASSWORD}</password>
|
||||||
|
</server>
|
||||||
|
</servers>
|
||||||
|
<mirrors>
|
||||||
|
<mirror>
|
||||||
|
<id>jfrog-maven-central</id>
|
||||||
|
<name>Mirror Repository</name>
|
||||||
|
<url>https://tip.jfrog.io/artifactory/maven-central</url>
|
||||||
|
<mirrorOf>central</mirrorOf>
|
||||||
|
</mirror>
|
||||||
|
<mirror>
|
||||||
|
<id>jfrog-spring-milestones</id>
|
||||||
|
<url>https://tip.jfrog.io/artifactory/spring-milestones</url>
|
||||||
|
<mirrorOf>spring-milestones</mirrorOf>
|
||||||
|
</mirror>
|
||||||
|
</mirrors>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>schema-publisher</id>
|
||||||
|
<properties>
|
||||||
|
<schema-repository-user>${env.MAVEN_REPO_USERNAME}</schema-repository-user>
|
||||||
|
<schema-repository-password>${env.MAVEN_REPO_PASSWORD}</schema-repository-password>
|
||||||
|
</properties>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
|
||||||
|
<activeProfiles>
|
||||||
|
<activeProfile>schema-publisher</activeProfile>
|
||||||
|
</activeProfiles>
|
||||||
|
|
||||||
|
</settings>
|
||||||
|
|
||||||
35
.github/workflows/sonar-trigger.yml
vendored
Normal file
35
.github/workflows/sonar-trigger.yml
vendored
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
name: Trigger sonar analysis
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ master ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
sonar:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
ref: master
|
||||||
|
- name: Trigger sonar analysis
|
||||||
|
run: |
|
||||||
|
echo URL "https://api.github.com/repos/${GITHUB_REPOSITORY}/dispatches"
|
||||||
|
|
||||||
|
for project in $(find . -exec test -f {}/pom.xml \; -printf '%f\n' -prune); do
|
||||||
|
echo "Triggering sonar analysis for project ${project}"
|
||||||
|
|
||||||
|
curl -s --location --request POST "https://api.github.com/repos/${GITHUB_REPOSITORY}/dispatches" \
|
||||||
|
--header "Authorization: Bearer ${{ secrets.TOKEN }}" \
|
||||||
|
--header "Content-Type: application/json" \
|
||||||
|
--data-raw "{
|
||||||
|
\"event_type\": \"matrix-sonar\",
|
||||||
|
\"client_payload\": {
|
||||||
|
\"project\": \"${project}\"
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
53
.github/workflows/sonar.yml
vendored
Normal file
53
.github/workflows/sonar.yml
vendored
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
name: Run sonar analysis
|
||||||
|
|
||||||
|
on:
|
||||||
|
repository_dispatch:
|
||||||
|
types: [ matrix-sonar ]
|
||||||
|
|
||||||
|
env:
|
||||||
|
SONAR_URL: https://sonarcloud.io
|
||||||
|
SONAR_ORGANIZATION: telecominfraproject
|
||||||
|
MAVEN_OPTS: -Xmx3g -Xss2m # prevents java.lang.StackOverflowError
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
sonar:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
path: wlan-cloud-services
|
||||||
|
ref: master
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Checkout dependency Telecominfraproject/wlan-cloud-root
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
repository: Telecominfraproject/wlan-cloud-root
|
||||||
|
path: wlan-cloud-root
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Set up JDK 14
|
||||||
|
uses: actions/setup-java@v1
|
||||||
|
with:
|
||||||
|
java-version: 14
|
||||||
|
- name: Cache Maven packages
|
||||||
|
uses: actions/cache@v1
|
||||||
|
with:
|
||||||
|
path: ~/.m2/repository/
|
||||||
|
key: ${{ runner.os }}-m2
|
||||||
|
- name: Configure maven settings.xml
|
||||||
|
run: cp wlan-cloud-services/.github/workflows/maven_settings_template.xml /home/runner/.m2/settings.xml
|
||||||
|
- name: Maven build
|
||||||
|
working-directory: wlan-cloud-services/${{ github.event.client_payload.project }}
|
||||||
|
env:
|
||||||
|
MAVEN_REPO_USERNAME: build-pipeline
|
||||||
|
MAVEN_REPO_PASSWORD: ${{ secrets.MAVEN_REPO_PASSWORD }}
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: mvn clean install
|
||||||
|
- name: Run sonar analysis for ${{ github.event.client_payload.project }}
|
||||||
|
working-directory: wlan-cloud-services/${{ github.event.client_payload.project }}
|
||||||
|
env:
|
||||||
|
MAVEN_REPO_USERNAME: build-pipeline
|
||||||
|
MAVEN_REPO_PASSWORD: ${{ secrets.MAVEN_REPO_PASSWORD }}
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: mvn sonar:sonar -Dsonar.host.url=${{ env.SONAR_URL }} -Dsonar.login=${{ secrets.SONAR_LOGIN }} -Dsonar.organization=${{ env.SONAR_ORGANIZATION }} -Dsonar.projectKey=${{ github.event.client_payload.project }}
|
||||||
|
|
||||||
Reference in New Issue
Block a user