17
17
# https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow
18
18
19
19
env :
20
- MAVEN_ARGS : ' --show-version --no-transfer-progress'
20
+ SHARED_MVN_ARGS : ' --show-version --no-transfer-progress'
21
21
22
22
permissions :
23
23
contents : read
@@ -39,12 +39,11 @@ jobs:
39
39
# Regex note: (?! ... ) is a negative lookahead. Succeed if the pattern is not present.
40
40
set +o pipefail && make doc 2>&1 | tee doxygen.log && ( ! grep -P 'warning:(?! .* file .?Doxyfile)' doxygen.log )
41
41
42
- # ICU4J build and unit test using Maven
43
- icu4j-mvn-build-and-test :
44
- strategy :
45
- fail-fast : false
46
- matrix :
47
- java-version : [ '8', '11', '17' ]
42
+ # Initialize the Maven artifact cache
43
+ #
44
+ # This job is created according to the cache strategy of reuse from a single job:
45
+ # https://github.com/actions/cache/blob/main/caching-strategies.md#make-cache-read-only--reuse-cache-from-centralized-job
46
+ icu4j-mvn-init-cache :
48
47
runs-on : ubuntu-latest
49
48
steps :
50
49
- name : Checkout and setup
@@ -53,83 +52,63 @@ jobs:
53
52
lfs : true
54
53
- name : Checkout lfs objects
55
54
run : git lfs pull
55
+ - name : Cache local Maven repository
56
+ uses : actions/cache@v3
57
+ with :
58
+ path : ~/.m2/repository
59
+ key : ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
56
60
- uses : actions/setup-java@v3
57
61
with :
58
62
distribution : ' temurin'
59
- java-version : ${{ matrix.java-version }}
60
- - name : ICU4J
63
+ java-version : ' 8'
64
+ # Download all of the artifacts needed for the code and build plugins, but
65
+ # exclude any needed by profiles depending on system artifacts
66
+ - name : Download all artifacts
61
67
run : |
62
68
cd icu4j;
63
- mvn install
64
- - name : List failures (if any)
65
- run : |
66
- cd icu4j && cat `find . -name surefire-reports -type d -exec grep -l -r --include="*.txt" FAILED {} \;`;
67
- if : ${{ failure() }}
68
-
69
- # ICU4J build and unit tests using Maven
69
+ mvn ${SHARED_MVN_ARGS} dependency:go-offline -P '!old_jdk_taglet'
70
+
71
+ # ICU4J build and unit test using Maven
70
72
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
71
-
72
- # Run `test` to execute unit tests and ensure it is possible for tests to run even without packaging submodule
73
- # dependencies as jar files
74
- icu4j-test-maven :
75
- name : Run unit tests with Maven for Java version
76
- runs-on : ubuntu-latest
77
- # Make this unit test target job depend on a later phase target job to prevent race condition when
78
- # trying to persist the Maven cache to the Github cache, knowing that artifacts needed for
79
- # the later phase `verify` are a superset of the artifacts needed for the earlier phase `test`.
80
- needs : icu4j-verify-maven
73
+ icu4j-mvn-build-and-test :
74
+ needs : icu4j-mvn-init-cache
81
75
strategy :
82
76
fail-fast : false
83
77
matrix :
84
78
java-version : [ '8', '11', '17' ]
85
- steps :
86
- - name : Checkout and setup
87
- uses : actions/checkout@v3
88
- with :
89
- lfs : true
90
- - name : Checkout lfs objects
91
- run : git lfs pull
92
- - uses : actions/setup-java@v3
93
- with :
94
- distribution : ' temurin'
95
- java-version : ${{ matrix.java-version }}
96
- cache : maven
97
- - name : Run Maven test
98
- run : |
99
- cd icu4j;
100
- mvn --batch-mode test
101
-
102
- # Run `verify` to ensure that `package` (creating .jar files) and `integration-test` (special setup for localespi tests) work
103
- icu4j-verify-maven :
104
- name : Run integration tests with Maven for Java version
105
79
runs-on : ubuntu-latest
106
- strategy :
107
- fail-fast : false
108
- matrix :
109
- java-version : [ '8', '11', '17' ]
110
80
steps :
111
81
- name : Checkout and setup
112
82
uses : actions/checkout@v3
113
83
with :
114
84
lfs : true
115
85
- name : Checkout lfs objects
116
86
run : git lfs pull
87
+ - name : Restore read-only cache of local Maven repository
88
+ uses : actions/cache/restore@v3
89
+ id : cache
90
+ with :
91
+ path : ~/.m2/repository
92
+ key : ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
93
+ restore-keys : |
94
+ ${{ runner.os }}-maven-
117
95
- uses : actions/setup-java@v3
118
96
with :
119
97
distribution : ' temurin'
120
98
java-version : ${{ matrix.java-version }}
121
- cache : maven
122
- # The Maven `verify` phase causes the following to happen first, and in order:
123
- # build/compile (`compile`), unit tests (`test`), Jar building (`package`),
124
- # integration tests, if any (`integration-test`)
125
- - name : Run Maven verify
99
+ - name : ICU4J
126
100
run : |
127
101
cd icu4j;
128
- mvn --batch-mode verify
102
+ mvn ${SHARED_MVN_ARGS} verify
103
+ - name : List failures (if any)
104
+ run : |
105
+ cd icu4j && cat `find . -name surefire-reports -type d -exec grep -l -r --include="*.txt" FAILED {} \;`;
106
+ if : ${{ failure() }}
129
107
130
108
# ICU4J build and unit test under lstm
131
109
lstm-icu4j-build-and-test :
132
110
if : false # TODO(ICU-22505)
111
+ needs : icu4j-mvn-init-cache
133
112
runs-on : ubuntu-latest
134
113
steps :
135
114
- name : Checkout and setup
@@ -138,6 +117,15 @@ jobs:
138
117
lfs : true
139
118
- name : Checkout lfs objects
140
119
run : git lfs pull
120
+ - name : Restore read-only cache of local Maven repository
121
+ uses : actions/cache/restore@v3
122
+ id : cache
123
+ with :
124
+ path : ~/.m2/repository
125
+ key : ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
126
+ restore-keys : |
127
+ ${{ runner.os }}-maven-
128
+ lookup-only : true
141
129
- uses : actions/setup-java@v3
142
130
with :
143
131
distribution : ' temurin'
@@ -152,7 +140,7 @@ jobs:
152
140
- name : ICU4J
153
141
run : |
154
142
cd icu4j;
155
- mvn install
143
+ mvn ${SHARED_MVN_ARGS} verify
156
144
- name : List failures (if any)
157
145
run : |
158
146
cd icu4j && cat `find . -name surefire-reports -type d -exec grep -l -r --include="*.txt" FAILED {} \;`;
@@ -161,6 +149,7 @@ jobs:
161
149
# ICU4J build and unit test under adaboost
162
150
adaboost-icu4j-build-and-test :
163
151
if : false # Temporary disable, until we disable the .jar creation from C and distribute the individual files
152
+ needs : icu4j-mvn-init-cache
164
153
runs-on : ubuntu-latest
165
154
steps :
166
155
- name : Checkout and setup
@@ -169,6 +158,15 @@ jobs:
169
158
lfs : true
170
159
- name : Checkout lfs objects
171
160
run : git lfs pull
161
+ - name : Restore read-only cache of local Maven repository
162
+ uses : actions/cache/restore@v3
163
+ id : cache
164
+ with :
165
+ path : ~/.m2/repository
166
+ key : ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
167
+ restore-keys : |
168
+ ${{ runner.os }}-maven-
169
+ lookup-only : true
172
170
- uses : actions/setup-java@v3
173
171
with :
174
172
distribution : ' temurin'
@@ -183,7 +181,7 @@ jobs:
183
181
- name : ICU4J
184
182
run : |
185
183
cd icu4j;
186
- mvn -Dcom.ibm.icu.impl.breakiter.useMLPhraseBreaking=true install
184
+ mvn ${SHARED_MVN_ARGS} -Dcom.ibm.icu.impl.breakiter.useMLPhraseBreaking=true verify
187
185
- name : List failures (if any)
188
186
run : |
189
187
cd icu4j && cat `find . -name surefire-reports -type d -exec grep -l -r --include="*.txt" FAILED {} \;`;
@@ -499,10 +497,19 @@ jobs:
499
497
500
498
# Verify icu4c release tools buildability.
501
499
icu4c-release-tools :
500
+ needs : icu4j-mvn-init-cache
502
501
runs-on : ubuntu-latest
503
502
steps :
504
503
- uses : actions/checkout@v3
505
- - run : mvn -f tools/release/java/pom.xml package dependency:analyze
504
+ - name : Restore read-only cache of local Maven repository
505
+ uses : actions/cache/restore@v3
506
+ id : cache
507
+ with :
508
+ path : ~/.m2/repository
509
+ key : ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
510
+ restore-keys : |
511
+ ${{ runner.os }}-maven-
512
+ - run : mvn ${SHARED_MVN_ARGS} -f tools/release/java/pom.xml package dependency:analyze
506
513
507
514
# Run unit tests with UCONFIG_NO_XXX variations.
508
515
uconfig-unit-tests :
0 commit comments