-
Notifications
You must be signed in to change notification settings - Fork 99
235 lines (202 loc) · 7.11 KB
/
Copy pathci.yml
File metadata and controls
235 lines (202 loc) · 7.11 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
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
name: CI
on:
push:
branches:
- master
- '[0-9]+.[0-9]+.x' # Patch branches like 1.16.x, 1.15.x
pull_request:
branches:
- master
- '[0-9]+.[0-9]+.x'
schedule:
# Nightly build on master (same as Jenkins: H H(17-19) * * *)
- cron: '0 18 * * *'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
MAVEN_OPTS: '-Xmx8G -Xms1G -XX:+ClassUnloadingWithConcurrentMark -Djava.security.egd=file:/dev/./urandom'
MAVEN_CLI_OPTS: '-B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn'
jobs:
# Incremental build for PRs
incremental-build:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 180
steps:
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
df -h
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history needed for incremental build
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Configure Maven settings
run: mkdir -p ~/.m2 && cp .github/maven-settings.xml ~/.m2/settings.xml
- name: Quick install (skip tests)
run: mvn install $MAVEN_CLI_OPTS -DskipStatic=true -DskipTests=true
- name: Incremental build
run: |
mvn clean install $MAVEN_CLI_OPTS \
-P !itests \
-Dgib.enabled=true \
-Dgib.referenceBranch=refs/remotes/origin/${{ github.base_ref }}
# Full build for master/patch branches
full-build:
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 180
steps:
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
df -h
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Configure Maven settings
run: mkdir -p ~/.m2 && cp .github/maven-settings.xml ~/.m2/settings.xml
- name: Full build (excluding itests)
run: mvn clean install $MAVEN_CLI_OPTS -P !itests
- name: Build itest dependencies
run: |
mvn install $MAVEN_CLI_OPTS \
-pl distribution/test/itests/test-itests-common,distribution/test/itests/test-itests-dependencies-app \
-am \
-DskipTests=true
- name: Run Alliance integration tests
run: |
unset JAVA_TOOL_OPTIONS
mvn install $MAVEN_CLI_OPTS \
-pl distribution/test/itests/test-itests-alliance \
-nsu
# Alliance integration tests (for PRs)
integration-tests:
needs: incremental-build
if: github.event_name == 'pull_request' && needs.incremental-build.result == 'success'
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
df -h
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Configure Maven settings
run: mkdir -p ~/.m2 && cp .github/maven-settings.xml ~/.m2/settings.xml
- name: Quick install (skip tests)
run: mvn install $MAVEN_CLI_OPTS -DskipStatic=true -DskipTests=true
- name: Run Alliance integration tests
run: |
unset JAVA_TOOL_OPTIONS
mvn install $MAVEN_CLI_OPTS \
-pl distribution/test/itests/test-itests-alliance \
-nsu
# OWASP Dependency Check
dependency-check:
needs: [incremental-build, full-build]
if: always() && (needs.incremental-build.result == 'success' || needs.full-build.result == 'success')
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Configure Maven settings
run: mkdir -p ~/.m2 && cp .github/maven-settings.xml ~/.m2/settings.xml
- name: OWASP Dependency Check
run: |
if [ "${{ github.event_name }}" != "pull_request" ]; then
# Full scan with distribution for non-PR builds
mvn org.commonjava.maven.plugins:directory-maven-plugin:highest-basedir@directories \
dependency-check:aggregate $MAVEN_CLI_OPTS \
-q -pl '!distribution/docs' \
-P '!itests,owasp-dist'
else
# Incremental scan for PRs
mvn org.commonjava.maven.plugins:directory-maven-plugin:highest-basedir@directories \
dependency-check:aggregate $MAVEN_CLI_OPTS \
-q -pl '!distribution/docs' \
-P '!itests'
fi
- name: Upload dependency check report
uses: actions/upload-artifact@v4
if: always()
with:
name: dependency-check-report
path: target/dependency-check-report.html
retention-days: 30
# Deploy artifacts (master and patch branches only, in production)
deploy:
needs: [full-build, dependency-check]
if: |
always() &&
github.event_name != 'pull_request' &&
(github.ref == 'refs/heads/master' || contains(github.ref, '.x')) &&
needs.full-build.result == 'success' &&
needs.dependency-check.result == 'success'
runs-on: ubuntu-latest
environment: production
steps:
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
df -h
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Configure Maven settings
run: mkdir -p ~/.m2 && cp .github/maven-settings.xml ~/.m2/settings.xml
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Deploy
env:
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
run: |
mvn deploy $MAVEN_CLI_OPTS \
-DskipStatic=true \
-DskipTests=true \
-DretryFailedDeploymentCount=10 \
-Dreleases.repository.url=https://repo.codice.org/repository/maven-releases/ \
-Dsnapshots.repository.url=https://repo.codice.org/repository/maven-snapshots/