Skip to content

Commit 51fbd81

Browse files
authored
Merge pull request #34 from adela-domokosova/sonarqube-implementation
Sonar workflow implementation
2 parents d09bade + 979ce95 commit 51fbd81

File tree

4 files changed

+65
-27
lines changed

4 files changed

+65
-27
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Build project
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
java: [11, 17]
16+
name: "Java ${{ matrix.java }} build"
17+
steps:
18+
- name: Checkout project
19+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
20+
- name: Set up Java
21+
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
22+
with:
23+
distribution: "temurin"
24+
java-version: "${{ matrix.java }}"
25+
cache: "maven"
26+
- name: Verify build
27+
run: mvn -B verify
28+
sonar:
29+
needs: build
30+
if: github.base_ref == 'main' && github.event_name == 'pull_request'
31+
name: Prepare analysis context
32+
uses: WrenSecurity/.github/.github/workflows/sonar-pull-prepare.yml@main
33+
with:
34+
pull_request: ${{ toJSON(github.event.pull_request) }}

.github/workflows/build.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Trigger Sonar analysis
2+
3+
on:
4+
workflow_run:
5+
workflows:
6+
- Build project
7+
types:
8+
- completed
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
prepare:
15+
if: github.event.workflow_run.conclusion == 'success'
16+
uses: WrenSecurity/.github/.github/workflows/sonar-prepare.yml@main
17+
name: Prepare analysis context
18+
with:
19+
workflow_run: ${{ toJSON(github.event.workflow_run) }}
20+
trigger:
21+
needs: prepare
22+
if: needs.prepare.outputs.sonar_allowed
23+
name: Trigger Sonar analysis
24+
uses: WrenSecurity/.github/.github/workflows/sonar-maven.yml@main
25+
with:
26+
java_version: 17
27+
project_key: 'WrenSecurity_wrenicf-java-framework'
28+
pull_request: ${{ needs.prepare.outputs.pull_request }}
29+
secrets:
30+
sonar_token: ${{ secrets.SONAR_TOKEN }}

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<parent>
2222
<groupId>org.wrensecurity</groupId>
2323
<artifactId>wrensec-parent</artifactId>
24-
<version>4.0.2</version>
24+
<version>4.2.0</version>
2525
</parent>
2626

2727
<groupId>org.wrensecurity.wrenicf</groupId>

0 commit comments

Comments
 (0)