michaelcarrano/detective-droid

View on GitHub
.github/workflows/build.yml

Summary

Maintainability
Test Coverage
name: Build

on:
  workflow_dispatch:
  push:
    branches:
      - main
  pull_request:

concurrency:
  group: build-${{ github.ref }}
  cancel-in-progress: true

jobs:
  build:
    runs-on: ubuntu-latest
    timeout-minutes: 15

    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Validate Gradle Wrapper
        uses: gradle/wrapper-validation-action@v1

      - name: Set up JDK 17
        uses: actions/setup-java@v3
        with:
          distribution: 'zulu'
          java-version: 17

      - name: Setup Gradle
        uses: gradle/gradle-build-action@v2
        with:
          # Only write to the cache for builds on the 'main' branch
          cache-read-only: ${{ github.ref != 'refs/heads/main' }}
          gradle-home-cache-cleanup: true

      - name: Check spotless
        run: ./gradlew spotlessCheck --no-configuration-cache

      - name: Check lint
        run: ./gradlew :app:lintRelease

      - name: Build all build type and flavor permutations
        run: ./gradlew assemble

      - name: Run local tests
        run: ./gradlew test