-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (68 loc) · 1.89 KB
/
build.yml
File metadata and controls
79 lines (68 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Build and Test
on:
push:
branches: [ master ]
pull_request:
branches: [ master, develop ]
workflow_dispatch:
jobs:
build:
name: Build and Test
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write # For CodeQL
pull-requests: write # For PR comments
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for better analysis
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
cache: 'gradle'
- name: Grant execute permission for Gradle wrapper
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew clean build --stacktrace --no-daemon
env:
NO_NEXUS: true
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@v2
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.organization=opendevstack
-Dsonar.host.url=https://sonarcloud.io
- name: Publish artifact (JAR)
uses: actions/upload-artifact@v4
with:
name: app-jar
path: build/libs/*.jar
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results
path: |
**/build/test-results/test/
**/build/reports/jacoco/test/jacocoTestReport.xml
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: |
**/build/libs/*.jar
retention-days: 7
- name: Upload JAR artifacts
uses: actions/upload-artifact@v4
with:
name: jar-artifacts
path: |
docker/*.jar
**/build/libs/*.jar
retention-days: 30