name: Continuous Integration
on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        java-version: [ 8, 11, 16 ]
    steps:
    - uses: actions/checkout@v2
    - name: Set up JDK ${{ matrix.java-version }}
      uses: actions/setup-java@v2
      with:
        java-version: ${{ matrix.java-version }}
    - name: Cache Maven Packages
      uses: actions/cache@v2
      with:
        path: ~/.m2
        key: ${{ runner.os }}-m2-{{ hashFiles('**/pom.xml') }}
        restore-keys:
        - ${{ runner.os }}-m2
        - m2
    - name: Cache PMD
      uses: actions/cache@v2
      with:
        path: |
          fernet-java8/target/pmd
          fernet-aws-secrets-manager-rotator/target/pmd
          fernet-jersey-auth/target/pmd
    - run: ./mvnw clean install

name: Continuous Integration
on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        java-version: [ 8, 11, 16 ]
    steps:
    - uses: actions/checkout@v2
    - name: Set up JDK ${{ matrix.java-version }}
      uses: actions/setup-java@v2
      with:
        java-version: ${{ matrix.java-version }}
    - name: Cache Maven Packages
      uses: actions/cache@v2
      with:
        path: ~/.m2
        key: ${{ runner.os }}-${{ matrix.java-version }}-${{ hashFiles('**/pom.xml') }}-m2
        restore-keys: |
          ${{ runner.os }}-${{ matrix.java-version }}-m2
          ${{ runner.os }}-m2
          m2
    - name: Cache PMD
      uses: actions/cache@v2
      with:
        path: |
          fernet-java8/target/pmd
          fernet-aws-secrets-manager-rotator/target/pmd
          fernet-jersey-auth/target/pmd
        key: ${{ runner.os }}-${{ matrix.java-version }}-${{ hashFiles('**/pom.xml') }}-pmd
        restore-keys: |
          ${{ runner.os }}-${{ matrix.java-version }}-pmd
          ${{ runner.os }}-pmd
          pmd
    - run: ./mvnw clean install

Fix cache syntax for Maven cache
Fix cache syntax for Maven cache

This also adds cache keys and fallbacks for the PMD cache.
