|
38 | 38 | uses: joschi/setup-jdk@b9cc6eabf7e7e3889766b5cee486f874c9e1bd2d
|
39 | 39 | with:
|
40 | 40 | java-version: 11
|
| 41 | + - name: Compute cache restore key |
| 42 | + # Always recompute on a push so that the maven repo doesnt grow indefinitely with old versions |
| 43 | + run: | |
| 44 | + if ${{ github.event_name == 'pull_request' }}; then echo "::set-env name=COMPUTED_RESTORE_KEY::q2maven-"; fi |
| 45 | + - name: Cache Maven Repository |
| 46 | + id: cache-maven |
| 47 | + uses: n1hility/cache@v2 |
| 48 | + with: |
| 49 | + path: ~/.m2/repository |
| 50 | + # Improves the reusability of the cache to limit key changes |
| 51 | + key: q2maven-${{ hashFiles('pom.xml') }} |
| 52 | + restore-keys: ${{ env.COMPUTED_RESTORE_KEY }} |
| 53 | + restore-only: ${{ github.event_name == 'pull_request' }} |
| 54 | + - name: Build |
| 55 | + run: | |
| 56 | + mvn -e -B -DskipTests=true -DskipDocs clean install |
| 57 | + - name: Tar Maven Repo |
| 58 | + shell: bash |
| 59 | + run: tar -czvf maven-repo.tgz -C ~ .m2/repository |
| 60 | + - name: Persist Maven Repo |
| 61 | + uses: actions/upload-artifact@v1 |
| 62 | + with: |
| 63 | + name: maven-repo |
| 64 | + path: maven-repo.tgz |
| 65 | + |
| 66 | + linux-jvm-tests: |
| 67 | + name: JDK ${{matrix.java-version}} JVM Tests |
| 68 | + timeout-minutes: 120 |
| 69 | + needs: build-jdk11 |
| 70 | + strategy: |
| 71 | + fail-fast: false |
| 72 | + matrix: |
| 73 | + java-version: [8, 11, 13] |
| 74 | + |
| 75 | + runs-on: ubuntu-latest |
| 76 | + |
| 77 | + steps: |
| 78 | + - uses: actions/checkout@v2 |
| 79 | + - name: Set up JDK ${{ matrix.java-version }} |
| 80 | + # Uses sha for added security since tags can be updated |
| 81 | + uses: joschi/setup-jdk@b9cc6eabf7e7e3889766b5cee486f874c9e1bd2d |
| 82 | + with: |
| 83 | + java-version: ${{ matrix.java-version }} |
| 84 | + - name: Download Maven Repo |
| 85 | + uses: actions/download-artifact@v1 |
| 86 | + with: |
| 87 | + name: maven-repo |
| 88 | + path: . |
| 89 | + - name: Extract Maven Repo |
| 90 | + shell: bash |
| 91 | + run: tar -xzvf maven-repo.tgz -C ~ |
| 92 | + - name: Build with Maven |
| 93 | + run: mvn install |
| 94 | + - name: Prepare failure archive (if maven failed) |
| 95 | + if: failure() |
| 96 | + shell: bash |
| 97 | + run: find . -name '*-reports' -type d | tar -czvf test-reports.tgz -T - |
| 98 | + - name: Upload failure Archive (if maven failed) |
| 99 | + uses: actions/upload-artifact@v1 |
| 100 | + if: failure() |
| 101 | + with: |
| 102 | + name: test-reports-linux-jvm${{matrix.java-version}} |
| 103 | + path: 'test-reports.tgz' |
| 104 | + |
| 105 | + code-scan: |
| 106 | + name: JDK 8 JVM Code Scan |
| 107 | + timeout-minutes: 120 |
| 108 | + needs: build-jdk11 |
| 109 | + runs-on: ubuntu-latest |
| 110 | + |
| 111 | + steps: |
| 112 | + - uses: actions/checkout@v2 |
| 113 | + - name: Set up JDK 8 |
| 114 | + # Uses sha for added security since tags can be updated |
| 115 | + uses: joschi/setup-jdk@b9cc6eabf7e7e3889766b5cee486f874c9e1bd2d |
| 116 | + with: |
| 117 | + java-version: 8 |
| 118 | + - name: Download Maven Repo |
| 119 | + uses: actions/download-artifact@v1 |
| 120 | + with: |
| 121 | + name: maven-repo |
| 122 | + path: . |
| 123 | + - name: Extract Maven Repo |
| 124 | + shell: bash |
| 125 | + run: tar -xzvf maven-repo.tgz -C ~ |
41 | 126 | - name: Build with Maven and Coverage
|
42 | 127 | if: github.event_name == 'pull_request'
|
43 | 128 | run: mvn verify -P coverage
|
|
57 | 142 | uses: actions/upload-artifact@v1
|
58 | 143 | if: failure()
|
59 | 144 | with:
|
60 |
| - name: test-reports-linux-jvm11 |
| 145 | + name: test-reports-linux-jvm-codescan |
61 | 146 | path: 'test-reports.tgz'
|
0 commit comments