Skip to content

Commit

Permalink
Feature/1 create ci pipeline (#6)
Browse files Browse the repository at this point in the history
* Small changes to better test activateFetched;
Added circle ci support

* Fix config.yml

* Update build CI job

* Trying to fix CI issue

* Trying to fix CI issue - part 2

* Trying to fix CI issue - part 3

* Trying to fix CI issue - part 4

* Trying to fix CI issue - part 5

* Trying to fix CI issue - part 6

* Trying to fix CI issue - part 7

* Update artifacts paths

* Update LogLevel back to NONE
  • Loading branch information
ruimendesM authored Sep 15, 2022
1 parent 6413cbc commit 2c80c8e
Show file tree
Hide file tree
Showing 10 changed files with 122 additions and 30 deletions.
81 changes: 81 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
version: 2.1
orbs:
android: circleci/android@2.1.2

#######################
# Commands section
# For code reuse.
#######################
commands:
run-gradle-cmd:
description: "Running gradle command with environment options"
parameters:
desc:
type: string
default: "Running gradle command"
cmd:
type: string
steps:
- run:
name: << parameters.desc >>
command: >
./gradlew -PdisablePreDex -PciBuild=true
<< parameters.cmd >>
no_output_timeout: 30m
environment:
JVM_OPTS: -Xmx4096m
GRADLE_OPTS: >
-Xmx1536m -XX:+HeapDumpOnOutOfMemoryError
-Dorg.gradle.configureondemand=true
-Dkotlin.compiler.execution.strategy=in-process
-Dkotlin.incremental=false
references:
## Workspace

attach_debug_workspace: &attach_build_workspace
attach_workspace:
at: ~/workspace

persist_debug_workspace: &persist_build_workspace
persist_to_workspace:
root: ~/workspace
paths:
- firely-lib/build
- firely-plugin/build

## Docker images
android_config: &android_config
working_directory: ~/workspace
docker:
- image: circleci/android:api-30


jobs:
## Builds release version
build:
environment:
<<: *android_config
steps:
- checkout
- run-gradle-cmd:
desc: Publish Plugin to MavenLocal
cmd: "firely-plugin::publishToMavenLocal"
- run-gradle-cmd:
desc: Build Release
cmd: "clean assembleRelease"
- *persist_build_workspace
- store_artifacts:
path: firely-lib/build/outputs
destination: reports
- store_artifacts:
path: firely-plugin/build/outputs
- store_artifacts:
path: firely-sample/build/outputs


workflows:
workflow:
jobs:
- build

2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

buildscript {
ext.kotlin_version = '1.6.21'
ext.gradle_version = '7.2.1'
ext.gradle_version = '7.2.2'
ext.buildtools_version = '33.0.0'
ext.corektx_version = '1.7.0'
ext.compilesdk_version = 32
Expand Down
14 changes: 7 additions & 7 deletions firely-lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ android {
targetCompatibility 1.8
sourceCompatibility 1.8
}

publishing {
singleVariant("release") {
withSourcesJar()
}
}
}

dependencies {
Expand All @@ -69,10 +75,4 @@ publishing {
}
}

publishing {
repositories {
maven {
url "../localOutput"
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ class InternalFirely(context: Context, private val config: IFirelyConfig) {
}

override fun onActivityPaused(activity: Activity) {
if (debugMode) {
activateFetched()
}
}

override fun onActivityStopped(activity: Activity) {
Expand Down
8 changes: 0 additions & 8 deletions firely-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,3 @@ publishing {
}
}

publishing {
repositories {
maven {
url "../localOutput"
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ package com.busbud.android.firely.sample

import android.os.Bundle
import android.view.View
import android.widget.Button
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.Toolbar
Expand All @@ -40,8 +41,19 @@ class MainActivity : AppCompatActivity() {
val toolbar = findViewById<Toolbar>(R.id.toolbar)
setSupportActionBar(toolbar)

val view = findViewById<View>(R.id.text_view) as TextView
view.visibility = if (featureFlag.get()) View.VISIBLE else View.INVISIBLE
view.text = textXp.get()
fetchDataAndUpdateTextView()

findViewById<Button>(R.id.button).apply {
setOnClickListener {
fetchDataAndUpdateTextView()
}
}
}

private fun fetchDataAndUpdateTextView() {
findViewById<TextView>(R.id.text_view).apply {
visibility = if (featureFlag.get()) View.VISIBLE else View.INVISIBLE
text = textXp.get()
}
}
}
22 changes: 14 additions & 8 deletions firely-sample/src/main/res/layout/content_main.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2017 Busbud
~
~ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
Expand All @@ -19,17 +18,18 @@
~ THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-->

<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/content_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:gravity="center"
android:orientation="vertical"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.busbud.android.firely.sample.MainActivity"
tools:showIn="@layout/activity_main">
Expand All @@ -39,6 +39,12 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/app_name"/>
android:text="@string/app_name" />

<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/refresh" />

</FrameLayout>
</LinearLayout>
1 change: 1 addition & 0 deletions firely-sample/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@
<resources>
<string name="app_name">firely</string>
<string name="title_activity_main">MainActivity</string>
<string name="refresh">Refresh</string>
</resources>
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536m
android.disableAutomaticComponentCreation=true

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
Expand Down
2 changes: 2 additions & 0 deletions jitpack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
jdk:
- openjdk11

0 comments on commit 2c80c8e

Please sign in to comment.