Skip to content

Commit 15faaaa

Browse files
authored
ci: Add Maven quick-build profile to skip maven lifecycle plugins (#12188)
Adding a maven profile that makes it easier to build modules faster locally. Added benefit is to make it easier to run faster builds in the CI.
1 parent c2147fc commit 15faaaa

File tree

11 files changed

+59
-71
lines changed

11 files changed

+59
-71
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,9 @@ jobs:
187187
run: |
188188
mvn test \
189189
-B -ntp \
190+
-Pquick-build \
190191
-Dorg.slf4j.simpleLogger.showDateTime=true \
191192
-Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss:SSS \
192-
-Dclirr.skip=true \
193-
-Denforcer.skip=true \
194-
-Dcheckstyle.skip=true \
195-
-Dflatten.skip=true \
196-
-Danimal.sniffer.skip=true \
197193
-Dmaven.wagon.http.retryHandler.count=5 \
198194
--also-make \
199195
-T 1C

.github/workflows/sdk-platform-java-ci.yaml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ jobs:
4141
# The `envVarTest` profile runs tests that require an environment variable
4242
- name: Env Var Tests
4343
run: |
44-
mvn test --batch-mode --no-transfer-progress -Dcheckstyle.skip \
45-
-Dfmt.skip -DenableTestCoverage -PenvVarTest
44+
mvn test --batch-mode --no-transfer-progress -Pquick-build \
45+
-DenableTestCoverage -PenvVarTest
4646
# Set the Env Var for this step only
4747
env:
4848
GOOGLE_CLOUD_UNIVERSE_DOMAIN: random.com
@@ -191,8 +191,7 @@ jobs:
191191
export PATH=${JAVA_HOME}/bin:$PATH
192192
# Maven surefire plugin lets us to specify the JVM when running tests via
193193
# the "jvm" system property.
194-
mvn verify --batch-mode --no-transfer-progress -Dcheckstyle.skip \
195-
-Dfmt.skip \
194+
mvn verify --batch-mode --no-transfer-progress -Pquick-build \
196195
-Djvm="${JAVA8_HOME}/bin/java"
197196
working-directory: sdk-platform-java
198197
# The `envVarTest` profile runs tests that require an environment variable
@@ -205,8 +204,8 @@ jobs:
205204
# Maven surefire plugin lets us to specify the JVM when running tests via
206205
# the "jvm" system property.
207206
export GOOGLE_CLOUD_UNIVERSE_DOMAIN=random.com
208-
mvn test --batch-mode --no-transfer-progress -Dcheckstyle.skip \
209-
-Dfmt.skip -DenableTestCoverage -Dsurefire.failIfNoSpecifiedTests=false \
207+
mvn test --batch-mode --no-transfer-progress -Pquick-build \
208+
-DenableTestCoverage -Dsurefire.failIfNoSpecifiedTests=false \
210209
-PenvVarTest
211210
# Set the Env Var for this step only
212211
env:

.github/workflows/sdk-platform-java-nightly.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
BUILD_SUBDIR: sdk-platform-java
3131
JOB_TYPE: install
3232
- name: Install
33-
run: mvn install --errors --batch-mode --no-transfer-progress -Dcheckstyle.skip -Dfmt.skip
33+
run: mvn install --errors --batch-mode --no-transfer-progress -Pquick-build
3434
working-directory: sdk-platform-java
3535
- name: Create issue if previous step fails
3636
if: ${{ failure() }}

.github/workflows/sdk-platform-java-shared_dependencies.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
- run: java -version
3838
- name: Install maven modules
3939
run: |
40-
mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip
40+
mvn install -B -ntp -DskipTests -Pquick-build
4141
- name: Check the BOM content satisfies the upper-bound-check test case
42-
run: mvn -B -V -ntp verify -Dcheckstyle.skip
42+
run: mvn -B -V -ntp verify -Pquick-build
4343
working-directory: sdk-plaform-java/java-shared-dependencies/upper-bound-check

.github/workflows/sdk-platform-java-sonar.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
7373
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
7474
run: |
75-
mvn -B verify -Dcheckstyle.skip \
75+
mvn -B verify -Pquick-build \
7676
-DenableFullTestCoverage \
7777
-Penable-integration-tests \
7878
org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \
@@ -84,7 +84,7 @@ jobs:
8484
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
8585
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
8686
run: |
87-
mvn -B clean verify -Dcheckstyle.skip \
87+
mvn -B clean verify -Pquick-build \
8888
-DskipUnitTests \
8989
-Penable-integration-tests \
9090
-DenableShowcaseTestCoverage \

.github/workflows/unmanaged_dependency_check.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
java-version: 11
1313
- name: Install modules
1414
shell: bash
15-
run: mvn install -B -ntp -T 1C -DskipTests -Dclirr.skip -Dcheckstyle.skip -Denforcer.skip
15+
run: mvn install -B -ntp -T 1C -DskipTests -Pquick-build
1616
- name: Unmanaged dependency check
1717
uses: ./sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check
1818
with:

.kokoro/build.sh

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,9 @@ case ${JOB_TYPE} in
5252
retry_with_backoff 3 10 \
5353
mvn install \
5454
-B -ntp \
55+
-Pquick-build \
5556
-Dorg.slf4j.simpleLogger.showDateTime=true \
5657
-Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss:SSS \
57-
-Dclirr.skip=true \
58-
-Denforcer.skip=true \
59-
-Dcheckstyle.skip=true \
60-
-Dflatten.skip=true \
61-
-Danimal.sniffer.skip=true \
6258
-Dmaven.wagon.http.retryHandler.count=5 \
6359
--also-make \
6460
${SUREFIRE_JVM_OPT} "${EXTRA_PROFILE_OPTS[@]}"
@@ -80,13 +76,9 @@ case ${JOB_TYPE} in
8076
install_modules "sdk-platform-java"
8177
mvn install \
8278
-B -ntp \
79+
-Pquick-build \
8380
-Dorg.slf4j.simpleLogger.showDateTime=true \
8481
-Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss:SSS \
85-
-Dclirr.skip=true \
86-
-Denforcer.skip=true \
87-
-Dcheckstyle.skip=true \
88-
-Dflatten.skip=true \
89-
-Danimal.sniffer.skip=true \
9082
-Dmaven.wagon.http.retryHandler.count=5 \
9183
-DskipTests=true \
9284
--also-make \
@@ -143,19 +135,13 @@ case ${JOB_TYPE} in
143135

144136
echo "SUREFIRE_JVM_OPT: ${SUREFIRE_JVM_OPT}"
145137
echo "INTEGRATION_TEST_ARGS: ${INTEGRATION_TEST_ARGS}"
146-
mvn verify -Penable-integration-tests \
138+
mvn verify -Penable-integration-tests -Pquick-build \
147139
--also-make \
148140
${INTEGRATION_TEST_ARGS} \
149141
-B -ntp -fae \
150142
-DtrimStackTrace=false \
151-
-Dclirr.skip=true \
152-
-Denforcer.skip=true \
153143
-Dorg.slf4j.simpleLogger.showDateTime=true \
154144
-Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss:SSS \
155-
-Dcheckstyle.skip=true \
156-
-Dflatten.skip=true \
157-
-Danimal.sniffer.skip=true \
158-
-Djacoco.skip=true \
159145
-DskipUnitTests=true \
160146
-Dmaven.wagon.http.retryHandler.count=5 \
161147
${SUREFIRE_JVM_OPT}
@@ -202,18 +188,13 @@ case ${JOB_TYPE} in
202188
echo "Running in subdir: ${BUILD_SUBDIR}"
203189
pushd "${BUILD_SUBDIR}"
204190
echo "INTEGRATION_TEST_ARGS: ${INTEGRATION_TEST_ARGS}"
205-
mvn test -Pnative \
191+
mvn test -Pnative -Pquick-build \
206192
--also-make \
207193
${INTEGRATION_TEST_ARGS} \
208194
-B -ntp -fae \
209195
-DtrimStackTrace=false \
210-
-Dclirr.skip=true \
211-
-Denforcer.skip=true \
212196
-Dorg.slf4j.simpleLogger.showDateTime=true \
213-
-Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss:SSS \
214-
-Dcheckstyle.skip=true \
215-
-Dflatten.skip=true \
216-
-Danimal.sniffer.skip=true
197+
-Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss:SSS
217198

218199
RETURN_CODE=$?
219200
popd

.kokoro/common.sh

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -303,20 +303,14 @@ function run_integration_tests() {
303303
parse_all_submodules "$1"
304304
printf "Running integration tests for submodules:\n%s\n" "$all_submodules"
305305

306-
mvn verify -Penable-integration-tests --projects "$all_submodules" \
306+
mvn verify -Penable-integration-tests -Pquick-build --projects "$all_submodules" \
307307
${INTEGRATION_TEST_ARGS} \
308308
-B -ntp -fae \
309309
--also-make \
310310
-PbulkTests \
311311
-DtrimStackTrace=false \
312-
-Dclirr.skip=true \
313-
-Denforcer.skip=true \
314312
-Dorg.slf4j.simpleLogger.showDateTime=true \
315313
-Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss:SSS \
316-
-Dcheckstyle.skip=true \
317-
-Dflatten.skip=true \
318-
-Danimal.sniffer.skip=true \
319-
-Djacoco.skip=true \
320314
-DskipUnitTests=true \
321315
-Dmaven.wagon.http.retryHandler.count=5 \
322316
-T 1C
@@ -330,17 +324,12 @@ function run_graalvm_tests() {
330324
parse_all_submodules "$1"
331325
printf "Running GraalVM ITs for submodules:\n%s\n" "$all_submodules"
332326

333-
mvn test -Pnative --projects "$all_submodules" \
327+
mvn test -Pnative -Pquick-build --projects "$all_submodules" \
334328
${INTEGRATION_TEST_ARGS} \
335329
-B -ntp -fae \
336330
-DtrimStackTrace=false \
337-
-Dclirr.skip=true \
338-
-Denforcer.skip=true \
339331
-Dorg.slf4j.simpleLogger.showDateTime=true \
340-
-Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss:SSS \
341-
-Dcheckstyle.skip=true \
342-
-Dflatten.skip=true \
343-
-Danimal.sniffer.skip=true
332+
-Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss:SSS
344333

345334
RETURN_CODE=$?
346335
printf "Finished GraalVM ITs for modules:\n%s\n" "$1"
@@ -405,16 +394,11 @@ function install_modules() {
405394
if [ -z "$1" ]; then
406395
mvn install \
407396
-B -ntp \
397+
-Pquick-build \
408398
-DtrimStackTrace=false \
409-
-Dclirr.skip=true \
410-
-Denforcer.skip=true \
411399
-Dorg.slf4j.simpleLogger.showDateTime=true \
412400
-Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss:SSS \
413-
-Dcheckstyle.skip=true \
414-
-Dflatten.skip=true \
415-
-Danimal.sniffer.skip=true \
416401
-DskipTests=true \
417-
-Djacoco.skip=true \
418402
-T 1C
419403
else
420404
printf "Installing modules:\n%s\n" "$1"
@@ -472,16 +456,11 @@ function install_modules() {
472456
# Correctly builds dependencies without building dependents.
473457
mvn install --projects "$all_submodules,$always_install_deps" --also-make \
474458
-B -ntp \
459+
-Pquick-build \
475460
-DtrimStackTrace=false \
476-
-Dclirr.skip=true \
477-
-Denforcer.skip=true \
478461
-Dorg.slf4j.simpleLogger.showDateTime=true \
479462
-Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss:SSS \
480-
-Dcheckstyle.skip=true \
481-
-Dflatten.skip=true \
482-
-Danimal.sniffer.skip=true \
483463
-DskipTests=true \
484-
-Djacoco.skip=true \
485464
-T 1C
486465
fi
487466
}

.kokoro/dependencies.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,9 @@ fi
6060
# this should run maven enforcer
6161
retry_with_backoff 3 10 \
6262
mvn install -B -V -ntp \
63-
-DskipTests=true \
64-
-Dmaven.javadoc.skip=true \
65-
-Dclirr.skip=true
63+
-Pquick-build -DskipTests=true -Dmaven.javadoc.skip=true -Denforcer.skip=false
6664

67-
mvn -B dependency:analyze -DfailOnWarning=true -Dcheckstyle.skip=true
65+
mvn -B dependency:analyze -Pquick-build -DfailOnWarning=true -Dmdep.analyze.skip=false
6866

6967
if [[ -n "${BUILD_SUBDIR}" ]]
7068
then

google-cloud-pom-parent/pom.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,22 @@
5858
</licenses>
5959

6060
<profiles>
61+
<profile>
62+
<!-- skips all plugins that would have been activated by the Maven lifecycle -->
63+
<id>quick-build</id>
64+
<properties>
65+
<checkstyle.skip>true</checkstyle.skip>
66+
<enforcer.skip>true</enforcer.skip>
67+
<jacoco.skip>true</jacoco.skip>
68+
<clirr.skip>true</clirr.skip>
69+
<spotbugs.skip>true</spotbugs.skip>
70+
<pmd.skip>true</pmd.skip>
71+
<animal.sniffer.skip>true</animal.sniffer.skip>
72+
<fmt.skip>true</fmt.skip>
73+
<flatten.skip>true</flatten.skip>
74+
<mdep.analyze.skip>true</mdep.analyze.skip>
75+
</properties>
76+
</profile>
6177
<profile>
6278
<!-- Only run checkstyle plugin on Java 11+ (checkstyle artifact only supports Java 11+) -->
6379
<id>checkstyle-tests</id>
@@ -78,6 +94,7 @@
7894
</goals>
7995
<configuration>
8096
<headerLocation>${checkstyle.header.file}</headerLocation>
97+
<skip>${checkstyle.skip}</skip>
8198
</configuration>
8299
</execution>
83100
</executions>

0 commit comments

Comments
 (0)