Skip to content

Commit bb91a98

Browse files
authored
Merge pull request #192 from mfd2007/chore_change_to_maven
Chore: Migrate build process from gradle to maven
2 parents 9d45a38 + d87b512 commit bb91a98

16 files changed

+14093
-597
lines changed
Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,62 @@
1-
name: Validate and Test
1+
name: Build and Test
22
on:
3-
push:
4-
branches-ignore:
5-
- gh-pages
3+
pull_request:
4+
branches:
5+
- main
66
jobs:
7-
gradle:
7+
build:
88
runs-on: ubuntu-latest
99
permissions:
1010
checks: write
11+
contents: write
1112
pull-requests: write
1213
steps:
13-
- uses: actions/checkout@v3
14-
- uses: actions/setup-java@v3
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
- name: Set up JDK
17+
uses: actions/setup-java@v3
1518
with:
16-
java-version: '17'
19+
java-version: '21'
1720
distribution: 'adopt'
18-
- name: Setup Gradle
19-
uses: gradle/gradle-build-action@v2.4.2
20-
with:
21-
gradle-version: 8.2.1
22-
- name: Change wrapper permissions
23-
run: chmod +x ./gradlew
24-
- name: Execute Gradle build
25-
run: ./gradlew clean build jacocoTestReport
21+
cache: maven
22+
- name: Build with maven
23+
run: mvn -Pgithub-action clean verify
24+
2625
- name: Publish Unit Test Results
2726
uses: EnricoMi/publish-unit-test-result-action@v2
28-
if: always() # clause guarantees that this action always runs, even if earlier steps (e.g., the unit test step) in your workflow fail.
27+
#if: always() # clause guarantees that this action always runs, even if earlier steps (e.g., the unit test step) in your workflow fail.
2928
with:
30-
files: "build/test-results/**/*.xml"
29+
files: ${{ github.workspace }}/target/surefire-reports/**/*.xml
3130
- name: Add coverage to PR
3231
id: jacoco
3332
uses: madrapps/jacoco-report@v1.6.1 # requires at least two pushes to a PR, see https://github.com/Madrapps/jacoco-report/issues/13
3433
with:
35-
paths: ${{ github.workspace }}/build/reports/jacoco/test/jacocoTestReport.xml
34+
paths: ${{ github.workspace }}/target/jacoco-report/jacoco.xml
3635
token: ${{ secrets.GITHUB_TOKEN }}
3736
min-coverage-overall: 40
3837
min-coverage-changed-files: 60
3938
- name: Archive code coverage results
4039
uses: actions/upload-artifact@v3
4140
with:
4241
name: code-coverage-report
43-
path: build/reports/jacoco/**
44-
42+
path: target/jacoco-report/**
43+
- name: ls
44+
run: ls -al target/jacoco-report/
45+
- name: Generate JaCoCo Badge
46+
uses: cicirello/jacoco-badge-generator@v2
47+
with:
48+
jacoco-csv-file: target/jacoco-report/jacoco.csv
49+
generate-coverage-badge: true
50+
badges-directory: .github/badges
51+
- name: Commit the badge (if it changed)
52+
run: |
53+
git config user.name 'github-actions[bot]'
54+
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
55+
if [[ `git diff --exit-code .github/badges/jacoco.svg` ]]; then
56+
git add .github/badges/jacoco.svg
57+
git commit -m "Autogenerated JaCoCo coverage badge"
58+
git push
59+
fi
4560
lint-markdown:
4661
name: Lint all markdown files in project
4762
runs-on: ubuntu-latest
@@ -52,18 +67,5 @@ jobs:
5267
uses: nosborn/github-action-markdown-cli@v3.0.1
5368
with:
5469
files: '**/*.md'
55-
checkstyle:
56-
runs-on: ubuntu-latest
57-
name: Run CheckStyle
58-
steps:
59-
- name: Check out code
60-
uses: actions/checkout@v3
61-
- name: Run CheckStyle
62-
uses: nikitasavinov/checkstyle-action@master
63-
with:
64-
checkstyle_config: checkstyle.xml
65-
level: error
66-
fail_on_error: true
67-
reporter: 'github-check'
68-
github_token: ${{ secrets.GITHUB_TOKEN }}
70+
6971

.github/workflows/github-pages.yml

Lines changed: 0 additions & 50 deletions
This file was deleted.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ out/
1515

1616
### local configuration ###
1717
.env
18+
/bin/
19+
/target/

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ only required to manage documents on the server or validate against the
4242
To build the application run:
4343

4444
```shell
45-
./gradlew clean build
45+
./mvn package
4646
```
4747

48-
The resulting jar file in the `build/libs` folder can then be run with
48+
The resulting jar file in the `target` folder can then be run with
4949
`java -jar filename.jar`. To manage the process you can use Docker or an init
5050
system of your choice.
5151

@@ -115,15 +115,12 @@ The port is defined in .env - CSAF_APP_EXTERNAL_PORT, default 4180
115115

116116
### build and execute tests
117117

118-
./gradlew clean build
118+
./mvnw clean verify
119119

120-
### build and run SpotBugs
121-
122-
./gradlew clean assemble spotbugsMain
123120

124121
### start application
125122

126-
./gradlew bootRun
123+
./mvnw spring-boot:run
127124

128125
with main class: de.bsi.secvisogram.csaf_cms_backend.SecvisogramApplication
129126

@@ -139,7 +136,7 @@ http://localhost:8081/swagger-ui/index.html
139136

140137
OpenAPI specification
141138

142-
http://localhost:8081/v3/api-docs/
139+
http://localhost:8081/api-docs/
143140

144141
### access couchDB
145142

@@ -159,6 +156,13 @@ You can find our guidelines here [CONTRIBUTING.md](https://github.com/secvisogra
159156

160157
## Dependencies
161158

159+
### Check for Maven Plugin update
160+
161+
`` mvn versions:display-plugin-updates ``
162+
163+
## Check for dependency update
164+
`` mvn versions:display-dependency-updates `
165+
162166
### Spring Boot
163167

164168
#### Reference Documentation

build.gradle

Lines changed: 0 additions & 173 deletions
This file was deleted.

gradle/wrapper/gradle-wrapper.jar

-58.4 KB
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)