Skip to content

Commit d70bb0e

Browse files
committed
Build and scan workflow
1 parent 0e64c8a commit d70bb0e

File tree

3 files changed

+137
-0
lines changed

3 files changed

+137
-0
lines changed
+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# CI with maven build and scan
2+
#
3+
# version 1.0.1
4+
#
5+
# see : https://universe.fugerit.org/src/docs/conventions/workflows/build_maven_package.html
6+
7+
name: CI maven build and scan
8+
9+
on:
10+
# Trigger analysis when pushing in master or pull requests, and when creating
11+
# a pull request.
12+
push:
13+
branches:
14+
- main
15+
- develop
16+
- branch-preview
17+
pull_request:
18+
types:
19+
- opened
20+
- synchronize
21+
- reopened
22+
23+
jobs:
24+
build:
25+
name: Build
26+
runs-on: ubuntu-latest
27+
steps:
28+
29+
- uses: actions/checkout@main
30+
with:
31+
# Shallow clones should be disabled for a better relevancy of analysis
32+
fetch-depth: 0
33+
34+
- uses: graalvm/setup-graalvm@main
35+
with:
36+
java-version: '22-ea'
37+
distribution: 'graalvm'
38+
github-token: ${{ secrets.GITHUB_TOKEN }}
39+
native-image-job-reports: 'true'
40+
41+
- name: Cache Maven packages
42+
uses: actions/cache@main
43+
with:
44+
path: ~/.m2
45+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
46+
restore-keys: ${{ runner.os }}-m2
47+
- name: Cache SonarCloud packages
48+
uses: actions/cache@main
49+
with:
50+
path: ~/.sonar/cache
51+
key: ${{ runner.os }}-sonar
52+
restore-keys: ${{ runner.os }}-sonar
53+
- uses: actions/setup-node@main
54+
with:
55+
node-version: 20
56+
- name: Maven version
57+
run: mvn -v
58+
env:
59+
# Needed to get some information about the pull request, if any
60+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61+
# SonarCloud access token should be generated from https://sonarcloud.io/account/security/
62+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
63+
- name: Build and analyze
64+
run: mvn -B clean install org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Pcoverage,full,metadata,sonarfugerit,buildreact -Dsonar.projectKey=fugerit-org_${{github.event.repository.name}}
65+
env:
66+
# Needed to get some information about the pull request, if any
67+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68+
# SonarCloud access token should be generated from https://sonarcloud.io/account/security/
69+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
70+
71+
# Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
72+
- name: Update dependency graph
73+
# if DISABLE_MAVEN_DEPENDENCY_SUBMISSION is set to true, skip this step
74+
if: ${{ vars.DISABLE_MAVEN_DEPENDENCY_SUBMISSION != 'true' }}
75+
uses: advanced-security/maven-dependency-submission-action@main

CHANGELOG.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
### Added
11+
12+
- build and scan workflow
13+
- all default doc handlers
14+
- all default source types (xml, json, yaml)

pom.xml

+48
Original file line numberDiff line numberDiff line change
@@ -207,5 +207,53 @@
207207
<quarkus.native.enabled>true</quarkus.native.enabled>
208208
</properties>
209209
</profile>
210+
<!-- profiles for fugerit-org workflows -->
211+
<profile>
212+
<id>sonarfugerit</id>
213+
<properties>
214+
<!-- sonar cloud configuration -->
215+
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
216+
<sonar.organization>fugerit-org</sonar.organization>
217+
<sonar.moduleKey>${project.artifactId}</sonar.moduleKey>
218+
<!-- sonar.projectKey must be added by the project -->
219+
</properties>
220+
</profile>
221+
<profile>
222+
<id>coverage</id>
223+
<build>
224+
<plugins>
225+
<plugin>
226+
<groupId>org.apache.maven.plugins</groupId>
227+
<artifactId>maven-surefire-plugin</artifactId>
228+
<configuration>
229+
<skipTests>false</skipTests>
230+
</configuration>
231+
</plugin>
232+
<plugin>
233+
<groupId>org.jacoco</groupId>
234+
<artifactId>jacoco-maven-plugin</artifactId>
235+
<executions>
236+
<execution>
237+
<id>prepare-agent</id>
238+
<goals>
239+
<goal>prepare-agent</goal>
240+
</goals>
241+
</execution>
242+
<execution>
243+
<id>report</id>
244+
<goals>
245+
<goal>report</goal>
246+
</goals>
247+
<configuration>
248+
<formats>
249+
<format>XML</format>
250+
</formats>
251+
</configuration>
252+
</execution>
253+
</executions>
254+
</plugin>
255+
</plugins>
256+
</build>
257+
</profile>
210258
</profiles>
211259
</project>

0 commit comments

Comments
 (0)