-
Notifications
You must be signed in to change notification settings - Fork 29
125 lines (103 loc) · 4.1 KB
/
build.yml
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: Build
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
# For maven project
build:
strategy:
max-parallel: 1
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
java: [ 17 ]
runs-on: ${{ matrix.os }}
name: Maven Build with Java ${{ matrix.java }} on ${{ matrix.os }}
steps:
- name: "Checkout"
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Java ${{ matrix.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: "Cache Local Maven Repository"
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: "CheckStyle"
run: mvn validate --errors
- name: "Compile and Install"
run: mvn clean install -DskipTests --errors
- name: "Unit Tests"
run: mvn test --errors --fail-at-end
- name: "Integration Tests"
run: mvn failsafe:integration-test --errors --fail-at-end
# The following is only executed on Ubuntu on Java 17
- name: "JaCoCo Coverage Report"
if: matrix.os == 'ubuntu-latest' && matrix.java == 17 && github.repository == 'castor-software/depclean'
run: mvn jacoco:report
- name: "Codecov"
if: matrix.os == 'ubuntu-latest' && matrix.java == 17 && github.repository == 'castor-software/depclean'
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./depclean-maven-plugin/target/site/jacoco/jacoco.xml,./depclean-core/target/site/jacoco/jacoco.xml
flags: unittests
- name: "Cache SonarCloud"
if: matrix.os == 'ubuntu-latest' && matrix.java == 17 && github.repository == 'castor-software/depclean'
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: "SonarCloud"
if: matrix.os == 'ubuntu-latest' && matrix.java == 17 && github.repository == 'castor-software/depclean'
run: mvn sonar:sonar -Dsonar.projectKey=castor-software_depclean -Dsonar.organization=castor-software -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=${{ secrets.SONAR_TOKEN }} -Dsonar.java.source=17 -Dsonar.java.target=17
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# --------------------------------------------------------------------------------------------------------------------
# For Gradle module
gradle:
name: Gradle build with Java 17 on ubuntu-latest
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4.2.1
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1.1.0
- name: Java 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'adopt-hotspot'
- name: Cache Gradle packages
uses: actions/cache@v3.3.3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2-
# solving issues with current working directory
# working-directory: ~/depclean-gradle-plugin
# with:
# files: ./depclean-gradle-plugin
# path: ~/depclean-gradle-plugin
- name: Build with maven (Getting missing dependencies)
run: mvn clean install -q
- name: Build with Gradle
run: |
# home is not the repoistory root but `/home/runner`, so chdir to repository root and then use relative paths to current repository root
# getting correct directory now
# getting executable permission error on the binary
chmod +x ./depclean-gradle-plugin/gradlew
./depclean-gradle-plugin/gradlew build -p ./depclean-gradle-plugin/ -x test