potiuk commented on a change in pull request #1043: URL: https://github.com/apache/avro/pull/1043#discussion_r546799686
########## File path: .github/workflows/test-lang-java.yml ########## @@ -0,0 +1,99 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 'Test Java' +on: + workflow_dispatch: + push: + branches: [ master ] + pull_request: + branches: [ master ] + paths: + - lang/java/** + +defaults: + run: + working-directory: lang/java + +jobs: + test: + name: Java ${{ matrix.java }} Test + runs-on: ubuntu-latest + strategy: + matrix: + java: + - '8' + - '11' + steps: + - uses: actions/checkout@v2 + + - name: Cache Local Maven Repository + uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- Review comment: The reason for using the "restore-keys" might be when you want to optimize time of cache rebuilding. Caches in GA are immutable. Once you create them, they can never change. This means that when any of your pom.xml changes (or file is added there) you have to start building the cache from the scratch. The "restore-keys" is useful in case you have some "base" cache that you want to start from if you have new files affecting "hashFiles" calucation. But for that you need at least once have the build that had no '/pom.xml. files' at all. Then the hashFiles() function would return an empty string and that would become your 'base' cache that you want to start from. In your case, this could be really useful if your cache consists of a lot of "common" files and only incremental changes when you add pom.xml files. UPDATE: actually you do not need to run a non-pom install. It turns out that restore-key is matched by prefix and in the case of yours the most recent cache will be used as a base to build the new cache. Which is precisely what you want I believe. BTW. Hello @Fokko :) ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
