1+ #
2+ # Licensed to the Apache Software Foundation (ASF) under one
3+ # or more contributor license agreements. See the NOTICE file
4+ # distributed with this work for additional information
5+ # regarding copyright ownership. The ASF licenses this file
6+ # to you under the Apache License, Version 2.0 (the
7+ # "License"); you may not use this file except in compliance
8+ # with the License. You may obtain a copy of the License at
9+ #
10+ # http://www.apache.org/licenses/LICENSE-2.0
11+ #
12+ # Unless required by applicable law or agreed to in writing,
13+ # software distributed under the License is distributed on an
14+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+ # KIND, either express or implied. See the License for the
16+ # specific language governing permissions and limitations
17+ # under the License.
18+ #
19+
20+ # This workflow keeps the GitHub Action Caches up-to-date in the repository.
21+ #
22+ # A pull request build cannot update the cache of the upstream repository. Pull
23+ # requests have a cache in the context of the fork of the upstream repository.
24+ # A pull request build will lookup cache entries from the cache of the upstream
25+ # repository in the case that a cache entry is missing in the pull request source
26+ # repository's cache.
27+ # To reduce cache misses for pull request builds, it is necessary that the
28+ # caches in the upstream repository are up-to-date.
29+ # If the cache entry already exists, the cache won't be updated. This will keep the
30+ # update job very efficient and the downloading and updating will only run if one of the pom.xml
31+ # files has been modified or the cache entry expires.
32+ #
33+
34+ name : CI - Maven Dependency Cache Update
35+ on :
36+ # trigger on every commit to given branches
37+ push :
38+ branches :
39+ - master
40+ # trigger on a schedule so that the cache will be rebuilt if it happens to expire
41+ schedule :
42+ - cron : ' 30 */12 * * *'
43+
44+ env :
45+ MAVEN_OPTS : -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3
46+
47+ jobs :
48+ update-maven-dependencies-cache :
49+ name : Update Maven dependency cache for ${{ matrix.name }}
50+ runs-on : ${{ matrix.runs-on }}
51+ timeout-minutes : 45
52+
53+ strategy :
54+ fail-fast : false
55+ matrix :
56+ include :
57+ - name : all modules
58+ runs-on : ubuntu-latest
59+ cache_name : ' m2-dependencies'
60+ mvn_arguments : ' '
61+
62+ steps :
63+ - name : checkout
64+ uses : actions/checkout@v2
65+
66+ - name : Tune Runner VM
67+ uses : ./.github/actions/tune-runner-vm
68+
69+ - name : Detect changed files
70+ if : ${{ github.event_name != 'schedule' }}
71+ id : changes
72+ uses : apache/pulsar-test-infra/paths-filter@master
73+ with :
74+ filters : |
75+ poms:
76+ - 'pom.xml'
77+ - '**/pom.xml'
78+
79+ - name : Cache local Maven repository
80+ if : ${{ github.event_name == 'schedule' || steps.changes.outputs.poms == 'true' }}
81+ id : cache
82+ uses : actions/cache@v2
83+ with :
84+ path : |
85+ ~/.m2/repository/*/*/*
86+ !~/.m2/repository/org/apache/pulsar
87+ key : ${{ runner.os }}-${{ matrix.cache_name }}-${{ hashFiles('**/pom.xml') }}
88+ # there is no restore-keys here so that the cache size doesn't keep
89+ # on growing from old entries which wouldn't never expire if the old
90+ # cache would be used as the starting point for a new cache entry
91+
92+ - name : Set up JDK 11
93+ uses : actions/setup-java@v2
94+ if : ${{ (github.event_name == 'schedule' || steps.changes.outputs.poms == 'true') && steps.cache.outputs.cache-hit != 'true' }}
95+ with :
96+ distribution : ' adopt'
97+ java-version : 11
98+
99+ - name : Download dependencies
100+ if : ${{ (github.event_name == 'schedule' || steps.changes.outputs.poms == 'true') && steps.cache.outputs.cache-hit != 'true' }}
101+ run : |
102+ # download dependencies, ignore errors
103+ mvn -B -fn -ntp ${{ matrix.mvn_arguments }} dependency:go-offline
0 commit comments