Skip to content

Commit

Permalink
Merge pull request #11 from dead8309/dead8309
Browse files Browse the repository at this point in the history
Setup Github Actions
  • Loading branch information
dead8309 authored Mar 23, 2024
2 parents b485961 + 38ba00e commit a51839c
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 2 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Test Build

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:

jobs:
build:
name: Build Apk
runs-on: ubuntu-latest
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

- uses: actions/checkout@v3

- name: Setup Base Url
env:
BASE_URL: $
run: echo BASE_URL=\"$BASE_URL\" > ./local.properties


- name: Setup jdk-17
uses: actions/setup-java@main
with:
java-version: 17
distribution: 'adopt'
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Assemble Debug
run: ./gradlew assembleDebug

- name: Upload APK
uses: actions/upload-artifact@v3
with:
name: apk-debug
path: app/build/outputs/apk/debug/**.apk
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@
/captures
.externalNativeBuild
.cxx
local.properties
/app/src/main/java/in/iot/lab/teacherreview/core/utils/Constants.kt
local.properties
12 changes: 12 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import java.io.FileInputStream
import java.util.Properties

plugins {
alias(libs.plugins.androidApplication)
alias(libs.plugins.kotlinAndroid)
Expand All @@ -21,6 +24,7 @@ android {
vectorDrawables {
useSupportLibrary = true
}
buildConfigField("String", "BASE_URL", getBaseUrlInCIEnvironment())
}

buildTypes {
Expand All @@ -39,6 +43,7 @@ android {
}
buildFeatures {
compose = true
buildConfig = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.5.2"
Expand Down Expand Up @@ -104,4 +109,11 @@ dependencies {

// Logger
implementation("com.squareup.okhttp3:logging-interceptor:4.12.0")
}

fun getBaseUrlInCIEnvironment(): String {
val propFile = rootProject.file("./local.properties")
val properties = Properties()
properties.load(FileInputStream(propFile))
return properties.getProperty("BASE_URL")
}
21 changes: 21 additions & 0 deletions app/src/main/java/in/iot/lab/teacherreview/core/utils/Constants.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package `in`.iot.lab.teacherreview.core.utils

import `in`.iot.lab.teacherreview.BuildConfig

/**
* @property Constants is a class which provides all the ENDPOINTS related to the APP and keeps the
* BASE URL for the App backend DATA
*
* @property BASE_URL this is the Base Url of the App
* @property LOGIN_AUTHENTICATION_ENDPOINT this endpoint checks the Login Data given by the User and helps
* in logging the User inside the App. It also provides the User Data like his accessToken which is
* needed for all the other network calls inside the APP
* @property TEACHER_LIST_ENDPOINT This is the endpoint which accepts the teacher List Api Call
* @property
*/
object Constants {
const val BASE_URL = BuildConfig.BASE_URL
const val LOGIN_AUTHENTICATION_ENDPOINT = "authentication"
const val TEACHER_LIST_ENDPOINT = "faculties"
const val POST_TEACHER_REVIEW_ENDPOINT = "reviews"
}

0 comments on commit a51839c

Please sign in to comment.