[GitHub] Use cache for Maven in tests.yml
@@ -8,17 +8,34 @@ jobs:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v1
+ - name: Checkout
+ uses: actions/checkout@v1
+
- name: Set up JDK 1.11
uses: actions/setup-java@v1
with:
java-version: 1.11
- - name: Download Maven 3.6.3
- run: wget https://archive.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
- - name: Extact archive
- run: tar xzvf apache-maven-3.6.3-bin.tar.gz
- - run: echo "::set-env name=M2_HOME::`pwd`/apache-maven-3.6.3"
- - run: echo "::add-path::$M2_HOME/bin"
- - run: mvn -v
- - name: Run Maven with virtual display
- run: xvfb-run mvn clean verify
+
+ - name: Cache Maven
+ id: cache-maven
+ uses: actions/cache@v1
+ with:
+ path: apache-maven-3.6.3
+ key: maven-3.6.3
+
+ - name: Download Maven if not cached
+ if: steps.cache-maven.outputs.cache-hit != 'true'
+ run: |
+ wget https://archive.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
+ tar xzvf apache-maven-3.6.3-bin.tar.gz
+
+ - name: Set M2_HOME Env variable
+ run: echo "::set-env name=M2_HOME::`pwd`/apache-maven-3.6.3"
+
+ - name: Add M2_HOME to Path
+ run: echo "::add-path::$M2_HOME/bin"
+
+ - name: Run Maven with a virtual display
+ run: |
+ mvn -v
+ xvfb-run mvn clean verify
