name: Verify Pull request is publishable on: pull_request: branches: - develop env: GITHUB_USERNAME: "fknives" GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} jobs: run-code-analysis: runs-on: ubuntu-latest permissions: contents: read steps: - name: Checkout repository uses: actions/checkout@v2 - name: Setup Java uses: actions/setup-java@v2 with: distribution: 'adopt' java-version: '11' - name: Run clean run: ./gradlew clean - name: Run detekt run: ./gradlew detekt - name: Upload Detekt Results uses: actions/upload-artifact@v2 if: always() with: name: Detekt Results path: ./build/reports/detekt/detekt.html retention-days: 1 - name: Run ktlint run: ./gradlew ktlintCheck - name: Upload ktLint Results uses: actions/upload-artifact@v2 if: always() with: name: ktLint Results path: | ./**/build/reports/ktlint/**/*ktlint*Check.txt ./**/**/build/reports/ktlint/**/*ktlint*Check.txt retention-days: 1 - name: Run Lint run: ./gradlew lint - name: Upload Lint Results uses: actions/upload-artifact@v2 if: always() with: name: Lint Results path: | ./**/build/reports/*lint-results*.html ./**/**/build/reports/*lint-results*.html retention-days: 1 run-tests: runs-on: ubuntu-latest permissions: contents: read steps: - name: Checkout repository uses: actions/checkout@v2 - name: Setup Java uses: actions/setup-java@v2 with: distribution: 'adopt' java-version: '11' - name: Run Unit Tests run: ./gradlew jvmTests - name: Upload Test Results uses: actions/upload-artifact@v2 if: always() with: name: JVM Test Results path: ./**/build/reports/tests/**/*.html retention-days: 1 run-tests-on-emulator: runs-on: macos-latest strategy: matrix: api-level: [ 21, 30 ] fail-fast: false steps: - name: checkout uses: actions/checkout@v3 - name: Setup Java uses: actions/setup-java@v2 with: distribution: 'adopt' java-version: '11' - name: Gradle cache uses: gradle/gradle-build-action@v2 - name: AVD cache uses: actions/cache@v3 id: avd-cache with: path: | ~/.android/avd/* ~/.android/adb* key: avd-${{ matrix.api-level }} - name: create AVD and generate snapshot for caching if: steps.avd-cache.outputs.cache-hit != 'true' uses: reactivecircus/android-emulator-runner@v2 with: arch: 'x86_64' api-level: ${{ matrix.api-level }} force-avd-creation: false emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none disable-animations: false script: echo "Generated AVD snapshot for caching." - name: Run Android Tests uses: reactivecircus/android-emulator-runner@v2 with: arch: 'x86_64' api-level: ${{ matrix.api-level }} force-avd-creation: false emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none disable-animations: true script: ./gradlew connectedDebugAndroidTest - name: Upload Test Results uses: actions/upload-artifact@v2 if: always() with: name: Emulator-Test-Results-${{ matrix.api-level }} path: ./**/build/reports/androidTests/**/*.html retention-days: 1 - name: Upload Test Screenshots uses: actions/upload-artifact@v2 if: always() with: name: Emulator-Test-Results-${{ matrix.api-level }} path: ./**/build/testscreenshots/* retention-days: 1 - name: Upload Logcat Logs uses: actions/upload-artifact@v2 if: always() with: name: Emulator-Logcat-Logs-${{ matrix.api-level }} path: ./**/build/logcat.txt retention-days: 1