Skip to content

Commit

Permalink
cicd
Browse files Browse the repository at this point in the history
  • Loading branch information
dzakdzaks committed Feb 26, 2023
1 parent 57085c0 commit f491526
Show file tree
Hide file tree
Showing 11 changed files with 77 additions and 32 deletions.
65 changes: 48 additions & 17 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,57 @@
name: Android CI
# Workflow name
name: Release App

# When it will be triggered
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
branches:
- main

# Where it will run
jobs:
build:

runs-on: ubuntu-latest
- name: Fetch Sources
uses: actions/checkout@v2
with:
# Number of commits to fetch. 0 indicates all history for all branches and tags.
fetch-depth: 0

- name: Setup JDK
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'

- name: Setup Android SDK
uses: android-actions/setup-android@v2
# Cache Gradle dependencies and Gradle Wrapper
- name: Setup Gradle Cache
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }}

steps:
- uses: actions/checkout@v3
- name: set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: gradle
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Generate App Version Name
run: echo "VERSION_NAME=$(git describe --tags | sed 's/\(.*\)-/\1./' | sed 's/\(.*\)-/\1+/')" >> $GITHUB_ENV

- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
- name: Bump Version
uses: chkfung/[email protected]
with:
gradlePath: app/build.gradle.kts
versionCode: ${{ github.run_number }}
versionName: ${{ env.VERSION_NAME }}
- name: Run Linters and Test
run: ./gradlew check
- name: Upload Reports
uses: actions/upload-artifact@v2
with:
name: Test-Reports
path: app/build/reports
if: always()
- name: Build Release AAB
run: ./gradlew app:bundleRelease
21 changes: 18 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ plugins {
}

android {
namespace 'com.example.nikparser'
namespace 'com.dzakdzaks.nikparser'
compileSdk 33

defaultConfig {
applicationId "com.example.nikparser"
applicationId "com.dzakdzaks.nikparserapp"
minSdk 21
targetSdk 33
versionCode 1
Expand All @@ -19,12 +19,27 @@ android {
vectorDrawables {
useSupportLibrary true
}
multiDexEnabled true
}

Properties properties = new Properties()
properties.load(project.rootProject.file("local.properties").newDataInputStream())

signingConfigs {
release {
storeFile file(properties.getProperty("KEYSTORE_FILE").toString())
storePassword properties.getProperty("KEYSTORE_PASSWORD").toString()
keyAlias properties.getProperty("SIGNING_KEY_ALIAS").toString()
keyPassword properties.getProperty("SIGNING_KEY_PASSWORD").toString()
}
}

buildTypes {
release {
minifyEnabled false
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
compileOptions {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.nikparser
package com.dzakdzaks.nikparserapp

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
android:theme="@style/Theme.NIKParser"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:name="com.dzakdzaks.nikparserapp.MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.NIKParser">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.nikparser
package com.dzakdzaks.nikparserapp

import android.os.Bundle
import androidx.activity.ComponentActivity
Expand Down Expand Up @@ -30,7 +30,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.dzakdzaks.nikparser.NIKParserImpl
import com.dzakdzaks.nikparser.model.NIKParserResponse
import com.example.nikparser.ui.theme.NIKParserTheme
import com.dzakdzaks.nikparserapp.ui.theme.NIKParserTheme
import com.squareup.moshi.Moshi

class MainActivity : ComponentActivity() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.nikparser.ui.theme
package com.dzakdzaks.nikparserapp.ui.theme

import androidx.compose.ui.graphics.Color

Expand All @@ -8,4 +8,4 @@ val Pink80 = Color(0xFFEFB8C8)

val Purple40 = Color(0xFF6650a4)
val PurpleGrey40 = Color(0xFF625b71)
val Pink40 = Color(0xFF7D5260)
val Pink40 = Color(0xFF7D5260)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.nikparser.ui.theme
package com.dzakdzaks.nikparserapp.ui.theme

import android.app.Activity
import android.os.Build
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.nikparser.ui.theme
package com.dzakdzaks.nikparserapp.ui.theme

import androidx.compose.material3.Typography
import androidx.compose.ui.text.TextStyle
Expand Down Expand Up @@ -31,4 +31,4 @@ val Typography = Typography(
letterSpacing = 0.5.sp
)
*/
)
)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.nikparser
package com.dzakdzaks.nikparserapp

import org.junit.Test

Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ kotlin.code.style=official
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
android.disableAutomaticComponentCreation=true
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.dzakdzaks.nikparser.util

import android.content.Context
import android.util.Log
import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.Moshi
import com.squareup.moshi.Types
Expand Down

0 comments on commit f491526

Please sign in to comment.