Skip to content

Commit be05667

Browse files
authored
chore: Convert existing CI workflows to maven (#376)
* chore: Add initial pom.xml * chore: Convert workflows to maven * chore: Cleanup the existing workflows * chore: Fix format of ci.yaml * chore: Fix format of ci.yaml * chore: Use seperate job for java 8 * chore: Update required status checks * chore: Run java formatter * chore: Resolve checkstyle issues * chore: Empty commit * chore: Run on java 11 or lint job * chore: Change to use temurin * chore: Empty commit * chore: Update for PR comments * chore: Add clirr check in GH actions * chore: Revert build.gradle to google, inc * chore: Revert license to Inc. * chore: Revert license to Inc. * chore: Update license in files * chore: Update the rest of the files to correct license * chore: temp add in old ci workflows for status checks * chore: temp remove required status checks * chore: revert previous commit
1 parent 0f21ab6 commit be05667

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+406
-870
lines changed

sdk-platform-java/api-common-java/.github/sync-repo-settings.yaml

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,53 +5,65 @@ branchProtectionRules:
55
- pattern: main
66
isAdminEnforced: true
77
requiredStatusCheckContexts:
8-
- units
9-
- format
8+
- units (8)
9+
- units (11)
10+
- units (17)
11+
- lint
1012
- cla/google
1113
requiredApprovingReviewCount: 1
1214
requiresCodeOwnerReviews: true
1315
requiresStrictStatusChecks: true
1416
- pattern: 1.10.1-sp
1517
isAdminEnforced: true
1618
requiredStatusCheckContexts:
17-
- units
18-
- format
19+
- units (8)
20+
- units (11)
21+
- units (17)
22+
- lint
1923
- cla/google
2024
requiredApprovingReviewCount: 1
2125
requiresCodeOwnerReviews: true
2226
requiresStrictStatusChecks: true
2327
- pattern: java7
2428
isAdminEnforced: true
2529
requiredStatusCheckContexts:
26-
- units
27-
- format
30+
- units (8)
31+
- units (11)
32+
- units (17)
33+
- lint
2834
- cla/google
2935
requiredApprovingReviewCount: 1
3036
requiresCodeOwnerReviews: true
3137
requiresStrictStatusChecks: true
3238
- pattern: 2.0.x
3339
isAdminEnforced: true
3440
requiredStatusCheckContexts:
35-
- units
36-
- format
41+
- units (8)
42+
- units (11)
43+
- units (17)
44+
- lint
3745
- cla/google
3846
requiredApprovingReviewCount: 1
3947
requiresCodeOwnerReviews: true
4048
requiresStrictStatusChecks: true
4149
- pattern: 2.1.x
4250
isAdminEnforced: true
4351
requiredStatusCheckContexts:
44-
- units
45-
- format
52+
- units (8)
53+
- units (11)
54+
- units (17)
55+
- lint
4656
- cla/google
4757
requiredApprovingReviewCount: 1
4858
requiresCodeOwnerReviews: true
4959
requiresStrictStatusChecks: true
5060
- pattern: 2.2.x
5161
isAdminEnforced: true
5262
requiredStatusCheckContexts:
53-
- units
54-
- format
63+
- units (8)
64+
- units (11)
65+
- units (17)
66+
- lint
5567
- cla/google
5668
requiredApprovingReviewCount: 1
5769
requiresCodeOwnerReviews: true

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

Lines changed: 98 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,104 @@ jobs:
1212
JVM_OPTS: -Xmx3200m
1313
TERM: dumb
1414
steps:
15-
- uses: actions/checkout@v2
16-
- uses: actions/setup-java@v1
17-
with:
18-
java-version: 8
19-
- run: java -version
20-
- name: Gradle Assemble
21-
run: ./gradlew assemble
22-
- name: Gradle Test
23-
run: ./gradlew test
24-
- name: Gradle Build
25-
run: ./gradlew build publishToMavenLocal
15+
- uses: actions/checkout@v2
16+
- uses: actions/setup-java@v1
17+
with:
18+
java-version: 8
19+
- run: java -version
2620
format:
2721
runs-on: ubuntu-latest
2822
steps:
29-
- uses: actions/checkout@v2
30-
- uses: actions/setup-java@v1
31-
with:
32-
java-version: 8
33-
- name: Java Linter
34-
run: ./gradlew googleJavaFormat
23+
- uses: actions/checkout@v2
24+
- uses: actions/setup-java@v1
25+
with:
26+
java-version: 8
27+
clirr:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v3
31+
- uses: actions/setup-java@v3
32+
with:
33+
distribution: temurin
34+
java-version: 8
35+
- run: echo "JAVA8_HOME=${JAVA_HOME}" >> $GITHUB_ENV
36+
- uses: actions/setup-java@v3
37+
with:
38+
distribution: temurin
39+
java-version: 11
40+
- run: echo "JAVA11_HOME=${JAVA_HOME}" >> $GITHUB_ENV
41+
- run: .kokoro/build.sh
42+
env:
43+
JOB_TYPE: clirr
44+
units-8:
45+
name: units (8) - Maven
46+
runs-on: ubuntu-latest
47+
steps:
48+
- name: Get current week within the year
49+
id: date
50+
run: echo "::set-output name=week_of_year::$(date +'%W' --utc)"
51+
- uses: actions/checkout@v3
52+
- uses: actions/setup-java@v3
53+
with:
54+
java-version: 8
55+
distribution: temurin
56+
- run: echo "JAVA8_HOME=${JAVA_HOME}" >> $GITHUB_ENV
57+
- uses: actions/setup-java@v3
58+
with:
59+
java-version: 11
60+
distribution: temurin
61+
- run: echo "JAVA11_HOME=${JAVA_HOME}" >> $GITHUB_ENV
62+
- uses: actions/cache@v3
63+
id: mvn-cache
64+
with:
65+
path: ~/.m2/repository
66+
key: ${{ runner.os }}-maven-unified-${{ steps.date.outputs.week_of_year }}
67+
- run: .kokoro/build.sh
68+
env:
69+
JOB_TYPE: test
70+
JOB_NAME: units-8
71+
units-maven:
72+
runs-on: ubuntu-latest
73+
strategy:
74+
fail-fast: false
75+
matrix:
76+
java: [ 11, 17 ]
77+
steps:
78+
- name: Get current week within the year
79+
id: date
80+
run: echo "::set-output name=week_of_year::$(date +'%W' --utc)"
81+
- uses: actions/checkout@v3
82+
- uses: actions/setup-java@v3
83+
with:
84+
distribution: temurin
85+
java-version: ${{matrix.java}}
86+
- run: java -version
87+
- uses: actions/cache@v3
88+
id: mvn-cache
89+
with:
90+
path: ~/.m2/repository
91+
key: ${{ runner.os }}-maven-unified-${{ steps.date.outputs.week_of_year }}
92+
- run: .kokoro/build.sh
93+
env:
94+
JOB_TYPE: test
95+
JOB_NAME: units-${{matrix.java}}
96+
lint:
97+
runs-on: ubuntu-latest
98+
steps:
99+
- name: Get current week within the year
100+
id: date
101+
run: echo "::set-output name=week_of_year::$(date +'%W' --utc)"
102+
- uses: actions/checkout@v3
103+
- uses: actions/setup-java@v3
104+
with:
105+
distribution: temurin
106+
java-version: 11
107+
- run: java -version
108+
- uses: actions/cache@v3
109+
id: mvn-cache
110+
with:
111+
path: ~/.m2/repository
112+
key: ${{ runner.os }}-maven-unified-${{ steps.date.outputs.week_of_year }}
113+
- run: java -version
114+
- run: mvn -B -ntp com.coveo:fmt-maven-plugin:check
115+
- run: mvn -B -ntp checkstyle:check@checkstyle

sdk-platform-java/api-common-java/.github/workflows/downstream.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ jobs:
136136
- uses: actions/checkout@v2
137137
- uses: actions/setup-java@v3
138138
with:
139-
distribution: zulu
139+
distribution: temurin
140140
java-version: ${{matrix.java}}
141141
- run: java -version
142142
- run: sudo apt-get update -y

sdk-platform-java/api-common-java/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,5 @@ tmp_gh-pages
1919

2020
# Vim
2121
*.sw*
22+
23+
target/

sdk-platform-java/api-common-java/.kokoro/build.bat

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

sdk-platform-java/api-common-java/.kokoro/build.sh

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,54 @@
1515

1616
set -eo pipefail
1717

18-
cd github/api-common-java/
18+
## Get the directory of the build script
19+
scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}"))
20+
## cd to the parent directory, i.e. the root of the git repo
21+
cd ${scriptDir}/..
1922

20-
# Print out Java
23+
# include common functions
24+
source ${scriptDir}/common.sh
25+
26+
function setJava() {
27+
export JAVA_HOME=$1
28+
export PATH=${JAVA_HOME}/bin:$PATH
29+
}
30+
31+
# This project requires compiling the classes in JDK 11 or higher for GraalVM
32+
# classes. Compiling this project with Java 8 or earlier would fail with "class
33+
# file has wrong version 55.0, should be 53.0" and "unrecognized --release 8
34+
# option" (set in build.gradle).
35+
if [ ! -z "${JAVA11_HOME}" ]; then
36+
setJava "${JAVA11_HOME}"
37+
fi
38+
39+
echo "Compiling using Java:"
2140
java -version
22-
echo $JOB_TYPE
41+
mvn clean install -B -Dcheckstyle.skip -Dfmt.skip
42+
43+
# We ensure the generated class files are compatible with Java 8
44+
if [ ! -z "${JAVA8_HOME}" ]; then
45+
setJava "${JAVA8_HOME}"
46+
fi
47+
48+
RETURN_CODE=0
2349

24-
./gradlew assemble
25-
./gradlew build install
50+
case ${JOB_TYPE} in
51+
test)
52+
retry_with_backoff 3 10 \
53+
mvn -B -ntp \
54+
-Dclirr.skip=true \
55+
-Denforcer.skip=true \
56+
-Dcheckstyle.skip=true \
57+
-Dflatten.skip=true \
58+
-Danimal.sniffer.skip=true \
59+
-Dmaven.wagon.http.retryHandler.count=5 \
60+
test
61+
RETURN_CODE=$?
62+
;;
63+
clirr)
64+
mvn -B -ntp -Denforcer.skip=true clirr:check
65+
RETURN_CODE=$?
66+
;;
67+
*) ;;
68+
esac

sdk-platform-java/api-common-java/.kokoro/coerce_logs.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}"))
2323
## cd to the parent directory, i.e. the root of the git repo
2424
cd ${scriptDir}/..
2525

26-
job=$(basename ${KOKORO_JOB_NAME})
26+
if [ -z "${KOKORO_JOB_NAME}" ]; then
27+
job="${JOB_NAME}"
28+
else
29+
job=$(basename ${KOKORO_JOB_NAME})
30+
fi
2731

2832
echo "coercing sponge logs..."
2933
for xml in `find . -name *-sponge_log.xml`

sdk-platform-java/api-common-java/.kokoro/continuous/common.cfg

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

sdk-platform-java/api-common-java/.kokoro/continuous/java11.cfg

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

sdk-platform-java/api-common-java/.kokoro/continuous/java7.cfg

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

0 commit comments

Comments
 (0)