name: Code analysis
on:
  push:
    branches:
      - develop
      - master
  pull_request:
    branches:
      - '*'

jobs:
  checkout:
    name: Code analysis
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v1
      - name: Detekt
        run: ./gradlew detektAll
      - name: ktlint
        run: ./gradlew ktlintAll
      - name: CPD
        run: ./gradlew cpdAll

name: Code analysis
on:
  push:
    branches:
      - develop
      - master
  pull_request:
    branches:
      - '*'

jobs:
  checkout:
    name: Code analysis
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v1

      - name: Save Gradle Caches
        uses: actions/cache@v2
        with:
          path: ~/.gradle/caches/
          key: gradle-caches-${{ runner.os }}-${{ matrix.os }}-${{ matrix.jdk }}
          restore-keys: |
            gradle-caches-${{ runner.os }}-${{ matrix.os }}-${{ matrix.jdk }}

      - name: Detekt
        run: ./gradlew detektAll
      - name: ktlint
        run: ./gradlew ktlintAll
      - name: CPD
        run: ./gradlew cpdAll

      - name: Stop Gradle
        run: ./gradlew --stop

Save Gradle caches in Github Actions flow.
Save Gradle caches in Github Actions flow.
