Skip to content

Commit

Permalink
chore: Add ci script for android
Browse files Browse the repository at this point in the history
  • Loading branch information
behzodhalil committed Aug 31, 2023
1 parent 6e6348b commit 8e90b20
Show file tree
Hide file tree
Showing 2 changed files with 115 additions and 0 deletions.
98 changes: 98 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Android CI

on:
push:
branches: [ "main" ]
tags:
- 'v*'
pull_request:
branches: [ "main" ]


concurrency:
group: ${{ github.ref }}

jobs:
lint:
name: Lint
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/[email protected]
- name: Set up JDK 11
uses: actions/[email protected]
with:
distribution: adopt
java-version: 11

- name: Cache gradle, wrapper and buildSrc
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Cache konan
uses: actions/cache@v3
with:
path: |
~/.konan/cache
~/.konan/dependencies
~/.konan/kotlin-native-macos*
~/.konan/kotlin-native-mingw*
~/.konan/kotlin-native-windows*
~/.konan/kotlin-native-linux*
~/.konan/kotlin-native-prebuilt-macos*
~/.konan/kotlin-native-prebuilt-mingw*
~/.konan/kotlin-native-prebuilt-windows*
~/.konan/kotlin-native-prebuilt-linux*
key: ${{ runner.os }}-konan-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-konan-
- name: Make gradlew executable
run: chmod +x ./gradlew

- name: Spotless Apply
run: ./gradlew spotlessApply --scan
- name: Spotless
run: ./gradlew spotlessCheck
build:
name: Build
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/[email protected]
- name: Set up JDK 11
uses: actions/[email protected]
with:
distribution: adopt
java-version: 11
- uses: ./.github/workflows/gradle-caches
with:
key-prefix: gradle-build
- name: Build
run: ./gradlew build
test:
name: Unit tests
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/[email protected]
- name: Set up JDK 11
uses: actions/[email protected]
with:
distribution: adopt
java-version: 11
- uses: ./.github/workflows/gradle-caches
with:
key-prefix: gradle-test
- name: Unit tests
run: ./gradlew test
- name: Upload test results
uses: actions/[email protected]
if: failure()
with:
name: testDebugUnitTest
path: ./**/build/reports/tests/testDebugUnitTest
17 changes: 17 additions & 0 deletions .github/workflows/gradle-caches/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: 'Gradle Cache'
description: 'Cache Gradle Build Cache to improve workflow execution time'
inputs:
key-prefix:
description: 'A prefix on the key used to store/restore cache'
required: true
runs:
using: "composite"
steps:
- uses: actions/[email protected]
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-${{ inputs.key-prefix }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-${{ inputs.key-prefix }}-

0 comments on commit 8e90b20

Please sign in to comment.