@@ -66,21 +66,41 @@ jobs:
66
66
67
67
- name : Checkout repository
68
68
uses : actions/checkout@v3
69
-
70
69
- name : Check out ${{ github.event.inputs.commit_sha }} commit
71
70
if : github.event.inputs.commit_sha != ''
72
71
run : |
73
72
git config --global --add safe.directory ${GITHUB_WORKSPACE}
74
73
git fetch
75
74
git checkout ${{ github.event.inputs.commit_sha }}
75
+
76
76
- name : Run monitoring
77
77
run : |
78
78
echo Find your Prometheus metrics using label {instance=\"${GITHUB_RUN_ID}-${HOSTNAME}\"}
79
79
chmod +x ./scripts/project/monitoring.sh
80
80
./scripts/project/monitoring.sh ${{ secrets.PUSHGATEWAY_HOSTNAME }} ${{ secrets.PUSHGATEWAY_USER }} ${{ secrets.PUSHGATEWAY_PASSWORD }}
81
+
82
+ # cache will use the key you provided and contains the files you specify in path.
83
+ #
84
+ # When key matches an existing cache, it's called a cache hit, and the action
85
+ # restores the cached files to the path directory.
86
+ # When key doesn't match an existing cache, it's called a cache miss, and a new
87
+ # cache is automatically created if the job completes successfully.
88
+ #
89
+ # The cache action first searches for cache hits for key and restore-keys in the
90
+ # branch containing the workflow run. If there are no hits in the current branch,
91
+ # the cache action searches for key and restore-keys in the parent branch and
92
+ # upstream branches.
93
+ - uses : actions/cache@v3
94
+ with :
95
+ path : /root/.gradle/caches
96
+ # key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle', '*.gradle.kts', './*.gradle', './*.gradle.kts') }}
97
+ # hashFiles returns a single hash for the set of files that matches the path pattern
98
+ key : ${{ runner.os }}-gradle-framework-${{ hashFiles('./*.gradle*', './utbot-framework*/*.gradle*') }}
99
+ restore-keys : ${{ runner.os }}-gradle-framework
81
100
- name : Run tests
82
101
run : |
83
- gradle --no-daemon :utbot-framework-test:test ${{ matrix.project.TESTS_TO_RUN }}
102
+ gradle --build-cache --no-daemon :utbot-framework-test:test ${{ matrix.project.TESTS_TO_RUN }}
103
+
84
104
- name : Upload logs
85
105
if : ${{ always() }}
86
106
uses : actions/upload-artifact@v3
@@ -117,47 +137,54 @@ jobs:
117
137
runs-on : ubuntu-20.04
118
138
container : unittestbot/java-env:java11-zulu-jdk-gradle7.4.2-kotlinc1.7.0
119
139
steps :
120
- - name : Print environment variables
121
- run : printenv
122
-
123
- - name : Checkout repository
124
- uses : actions/checkout@v3
125
-
126
- - name : Check out ${{ github.event.inputs.commit_sha }} commit
127
- if : github.event.inputs.commit_sha != ''
128
- run : |
129
- git config --global --add safe.directory ${GITHUB_WORKSPACE}
130
- git fetch
131
- git checkout ${{ github.event.inputs.commit_sha }}
132
-
133
- - name : Run monitoring
134
- run : |
135
- echo Find your Prometheus metrics using label {instance=\"${GITHUB_RUN_ID}-${HOSTNAME}\"}
136
- chmod +x ./scripts/project/monitoring.sh
137
- ./scripts/project/monitoring.sh ${{ secrets.PUSHGATEWAY_HOSTNAME }} ${{ secrets.PUSHGATEWAY_USER }} ${{ secrets.PUSHGATEWAY_PASSWORD }}
138
- - name : Build project ${{ matrix.projects.first }}
139
- id : first-project
140
- run : |
141
- cd ${{ matrix.projects.first }}
142
- gradle build --no-daemon
143
- - name : Build project ${{ matrix.projects.second }}
144
- if : ${{ steps.first-project.outcome != 'cancelled' && steps.first-project.outcome != 'skipped' }}
145
- run : |
146
- cd ${{ matrix.projects.second }}
147
- gradle build --no-daemon
148
- - name : Upload test report if tests have failed
149
- if : ${{ failure() }}
150
- uses : actions/upload-artifact@v3
151
- with :
152
- name : test_report ${{ matrix.projects.first }}
153
- path : ${{ matrix.projects.first }}/build/reports/tests/test/*
154
-
155
- - name : Upload test report if tests have failed
156
- if : ${{ failure() }}
157
- uses : actions/upload-artifact@v3
158
- with :
159
- name : test_report ${{ matrix.projects.second }}
160
- path : ${{ matrix.projects.second }}/build/reports/tests/test/*
140
+ - name : Print environment variables
141
+ run : printenv
142
+
143
+ - name : Checkout repository
144
+ uses : actions/checkout@v3
145
+ - name : Check out ${{ github.event.inputs.commit_sha }} commit
146
+ if : github.event.inputs.commit_sha != ''
147
+ run : |
148
+ git config --global --add safe.directory ${GITHUB_WORKSPACE}
149
+ git fetch
150
+ git checkout ${{ github.event.inputs.commit_sha }}
151
+
152
+ - name : Run monitoring
153
+ run : |
154
+ echo Find your Prometheus metrics using label {instance=\"${GITHUB_RUN_ID}-${HOSTNAME}\"}
155
+ chmod +x ./scripts/project/monitoring.sh
156
+ ./scripts/project/monitoring.sh ${{ secrets.PUSHGATEWAY_HOSTNAME }} ${{ secrets.PUSHGATEWAY_USER }} ${{ secrets.PUSHGATEWAY_PASSWORD }}
157
+
158
+ - uses : actions/cache@v3
159
+ with :
160
+ path : /root/.gradle/caches
161
+ key : ${{ runner.os }}-gradle-combined-${{ hashFiles('./*.gradle*', './*/.gradle*') }}
162
+ restore-keys : ${{ runner.os }}-gradle-combined-
163
+ - name : Build project ${{ matrix.projects.first }}
164
+ id : first-project
165
+ run : |
166
+ cd ${{ matrix.projects.first }}
167
+ gradle build --build-cache --no-daemon
168
+
169
+ - name : Build project ${{ matrix.projects.second }}
170
+ if : ${{ steps.first-project.outcome != 'cancelled' && steps.first-project.outcome != 'skipped' }}
171
+ run : |
172
+ cd ${{ matrix.projects.second }}
173
+ gradle build --build-cache --no-daemon
174
+
175
+ - name : Upload test report if tests have failed
176
+ if : ${{ failure() }}
177
+ uses : actions/upload-artifact@v3
178
+ with :
179
+ name : test_report ${{ matrix.projects.first }}
180
+ path : ${{ matrix.projects.first }}/build/reports/tests/test/*
181
+
182
+ - name : Upload test report if tests have failed
183
+ if : ${{ failure() }}
184
+ uses : actions/upload-artifact@v3
185
+ with :
186
+ name : test_report ${{ matrix.projects.second }}
187
+ path : ${{ matrix.projects.second }}/build/reports/tests/test/*
161
188
162
189
163
190
single-project :
@@ -180,7 +207,6 @@ jobs:
180
207
181
208
- name : Checkout repository
182
209
uses : actions/checkout@v3
183
-
184
210
- name : Check out ${{ github.event.inputs.commit_sha }} commit
185
211
if : github.event.inputs.commit_sha != ''
186
212
run : |
@@ -193,10 +219,17 @@ jobs:
193
219
echo Find your Prometheus metrics using label {instance=\"${GITHUB_RUN_ID}-${HOSTNAME}\"}
194
220
chmod +x ./scripts/project/monitoring.sh
195
221
./scripts/project/monitoring.sh ${{ secrets.PUSHGATEWAY_HOSTNAME }} ${{ secrets.PUSHGATEWAY_USER }} ${{ secrets.PUSHGATEWAY_PASSWORD }}
222
+
223
+ - uses : actions/cache@v3
224
+ with :
225
+ path : /root/.gradle/caches
226
+ key : ${{ runner.os }}-gradle-${{ matrix.project }}-${{ hashFiles('./*.gradle*', format('{0}{1}{2}', './', matrix.project, '/*.gradle*')) }}
227
+ restore-keys : ${{ runner.os }}-gradle-${{ matrix.project }}-
196
228
- name : Run tests
197
229
run : |
198
230
cd ${{ matrix.project }}
199
- gradle build --no-daemon
231
+ gradle build --build-cache --no-daemon
232
+
200
233
- name : Upload test report if tests have failed
201
234
if : ${{ failure() }}
202
235
uses : actions/upload-artifact@v3
0 commit comments