Skip to content

Commit

Permalink
Merge pull request #24 from futuredapp/feature/setup-gh-actions
Browse files Browse the repository at this point in the history
Setup gh actions
  • Loading branch information
Ondřej Kalman authored Feb 20, 2020
2 parents f92aae4 + d0613c2 commit fc321af
Show file tree
Hide file tree
Showing 24 changed files with 245 additions and 34 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Check PR
on: [pull_request]

jobs:
pr:
name: PR check
runs-on: [ubuntu-latest]
env:
DANGER_GITHUB_API_TOKEN: ${{ secrets.DANGER_GITHUB_API_TOKEN }}
steps:
- uses: actions/checkout@v1
- uses: actions/setup-ruby@v1
with:
ruby-version: '2.6'
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Run LintCheck
shell: bash
run: ./gradlew detekt ktlintCheck lint assembleRelease
- name: Run unit tests
shell: bash
run: ./gradlew --continue testRelease
- name: Danger action
uses: MeilCli/danger-action@v2
continue-on-error: true
with:
plugins_file: 'Gemfile'
danger_file: 'Dangerfile'
danger_id: 'danger-pr'
35 changes: 35 additions & 0 deletions .github/workflows/push_master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Check 3.x
on:
push:
branches:
master

jobs:
master:
name: master check
runs-on: [ubuntu-latest]
env:
SLACK_CHANNEL: android
steps:
- uses: actions/checkout@v1
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Run LintCheck
shell: bash
run: ./gradlew detekt ktlintCheck assembleRelease
- name: Run unit tests
shell: bash
run: ./gradlew --continue testRelease
- name: Slack Notification
if: failure()
uses: homoluctus/slatify@master
with:
type: "failure"
job_name: '*master Check*'
username: GitHub
channel: ${{env.SLACK_CHANNEL}}
url: ${{ secrets.SLACK_WEB_HOOK }}
commit: true
token: ${{ secrets.GITHUB_TOKEN }}
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Release build

on:
release:
types: [published]

jobs:
release:
name: Release build
runs-on: [ubuntu-latest]
env:
EXCLUDE_APK_FILTER: .*unaligned.apk\|.*Test.*.apk
BITRISE_GIT_TAG: ${{github.event.release.name}}
steps:
- uses: actions/checkout@v1
- uses: actions/setup-ruby@v1
with:
ruby-version: '2.6'
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Run unit tests
shell: bash
run: ./gradlew --continue testRelease
- name: Upload to Bintray
run: ./gradlew build publish bintrayUpload --stacktrace --no-daemon -PBINTRAY_USER=${{secrets.BINTRAY_USER}} -PBINTRAY_KEY=${{secrets.BINTRAY_KEY}} -PBINTRAY_GPG_KEY=${{secrets.BINTRAY_GPG_KEY}}
16 changes: 15 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,22 @@ buildscript {
}
dependencies {
classpath(Deps.gradlePlugin)
classpath(Deps.Plugins.androidMaven)
classpath(kotlin(Deps.Kotlin.gradlePlugin, Versions.kotlin))
classpath(Deps.Plugins.bintray)
classpath(Deps.Plugins.dokka)
}

extra.apply {
set("bintrayRepo", ProjectSettings.Publish.bintrayRepo)
set("publishedGroupId", ProjectSettings.group)
set("siteUrl", ProjectSettings.Publish.siteUrl)
set("gitUrl", ProjectSettings.Publish.gitUrl)
set("developerId", ProjectSettings.Publish.developerId)
set("developerName", ProjectSettings.Publish.developerName)
set("developerEmail", ProjectSettings.Publish.developerEmail)
set("licenseName", ProjectSettings.Publish.licenseName)
set("licenseUrl", ProjectSettings.Publish.licenseUrl)
set("allLicenses", ProjectSettings.Publish.allLicenses)
}
}

Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/Deps.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ object Deps {
object Plugins {
const val detekt = "io.gitlab.arturbosch.detekt"
const val ktlint = "org.jlleitschuh.gradle.ktlint"
const val androidMaven = "com.github.dcendents:android-maven-gradle-plugin:${Versions.androidMaven}"
const val bintray = "com.jfrog.bintray.gradle:gradle-bintray-plugin:${Versions.bintray}"
const val dokka = "org.jetbrains.dokka:dokka-android-gradle-plugin:${Versions.dokka}"
}

object Kotlin {
const val gradlePlugin = "gradle-plugin"
const val stdlib = "stdlib-jdk7"
const val reflect = "reflect"
}

object AndroidX {
Expand Down
25 changes: 25 additions & 0 deletions buildSrc/src/main/kotlin/ProjectSettings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,29 @@ object ProjectSettings {
const val applicationId = "com.thefuntasty.hauler"
const val targetSdk = 29
const val minSdk = 21
const val group = "com.thefuntasty.hauler"
val version = System.getenv("BITRISE_GIT_TAG")?:"0.0.1-TEST"

object Core {
const val artifact = "core"
const val description = "Library containing custom layout which enables to easily create swipe to dismiss Activity"
}

object Databinding {
const val artifact = "databinding"
const val description = "Databinding extensions for core library"
}


object Publish {
const val bintrayRepo = "hauler"
const val siteUrl = "https://github.com/futuredapp/hauler"
const val gitUrl = "https://github.com/futuredapp/hauler.git"
const val developerId = "TheFuntasty"
const val developerName = "TheFuntasty"
const val developerEmail = "[email protected]"
const val licenseName = "MIT Licence"
const val licenseUrl = "https://github.com/futuredapp/hauler/blob/master/LICENSE"
val allLicenses = listOf("MIT")
}
}
2 changes: 2 additions & 0 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ object Versions {
const val ktlint = "8.2.0"
const val ktlintExtension = "0.34.2"
const val androidMaven = "1.4.1"
const val bintray = "1.8.4"
const val dokka = "0.9.18"

// kotlin
const val kotlin = "1.3.50"
Expand Down
File renamed without changes.
23 changes: 8 additions & 15 deletions library/build.gradle.kts → core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import org.jetbrains.kotlin.config.KotlinCompilerVersion
plugins {
id("com.android.library")
id("kotlin-android")
id("com.github.dcendents.android-maven")
}

group = "com.github.thefuntasty"
group = ProjectSettings.group
version = ProjectSettings.version

android {
compileSdkVersion(ProjectSettings.targetSdk)
Expand All @@ -19,10 +19,6 @@ android {
sourceSets {
getByName("main").java.srcDir("src/main/kotlin")
}

dataBinding {
isEnabled = true
}
}

dependencies {
Expand All @@ -32,13 +28,10 @@ dependencies {
implementation(Deps.AndroidX.ktx)
}

tasks {
val sourcesJar by creating(type = Jar::class) {
from(android.sourceSets.getByName("main").java.srcDirs)
classifier = "sources"
}

artifacts {
add("archives", sourcesJar)
}
project.apply {
extensions.add("artifact", ProjectSettings.Core.artifact)
extensions.add("libraryName", ProjectSettings.Core.artifact)
extensions.add("libraryDescription", ProjectSettings.Core.description)
}

apply("../publish.script.gradle")
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class LockableNestedScrollView @JvmOverloads constructor(
isScrollable = isScrollEnabled
}

@Suppress("ClickableViewAccessibility")
override fun onTouchEvent(ev: MotionEvent): Boolean = when (ev.action) {
MotionEvent.ACTION_DOWN ->
isScrollable && super.onTouchEvent(ev)
Expand Down
File renamed without changes.
22 changes: 10 additions & 12 deletions databinding/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ plugins {
id("com.android.library")
id("kotlin-android")
id("kotlin-kapt")
id("com.github.dcendents.android-maven")
}

group = "com.github.thefuntasty"
group = ProjectSettings.group
version = ProjectSettings.version

android {
compileSdkVersion(ProjectSettings.targetSdk)
Expand All @@ -27,19 +27,17 @@ android {
}

dependencies {
implementation(project(":library"))
implementation(project(":core"))

implementation(kotlin(Deps.Kotlin.stdlib, KotlinCompilerVersion.VERSION))
implementation(Deps.AndroidX.appcompat)
}

tasks {
val sourcesJar by creating(type = Jar::class) {
from(android.sourceSets.getByName("main").java.srcDirs)
classifier = "sources"
}

artifacts {
add("archives", sourcesJar)
}
project.apply {
extensions.add("artifact", ProjectSettings.Databinding.artifact)
extensions.add("libraryName", ProjectSettings.Databinding.artifact)
extensions.add("libraryDescription", ProjectSettings.Databinding.description)
}

apply("../publish.script.gradle")

85 changes: 85 additions & 0 deletions publish.script.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
apply plugin: 'maven-publish'
apply plugin: "org.jetbrains.dokka-android"
apply plugin: "com.jfrog.bintray"

project.ext {
mavDevelopers = ["$developerName":"$developerName"]
mavSiteUrl = siteUrl
mavGitUrl = gitUrl
mavProjectName = "$libraryName"
mavLibraryLicenses = ["${allLicenses[0]}":"${licenseUrl}"]
mavLibraryDescription = "$libraryDescription"
}

publishing {
publications {
JcenterPublication(MavenPublication) {
pom.packaging = "aar"
pom.withXml {
def dependenciesNode = asNode().getAt('dependencies')[0] ?: asNode().appendNode('dependencies')
// Iterate over the compile dependencies (we don't want the test ones), adding a <dependency> node for each
configurations.implementation.allDependencies.each {
// Ensure dependencies such as fileTree are not included.
if (it.name != 'unspecified') {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
}

task sourcesJar(type: Jar) {
archiveClassifier = 'sources'
from android.sourceSets.main.java.srcDirs
}

dokka {
outputFormat = 'javadoc'
outputDirectory = "$buildDir/dokka"
}

task kotlinDocJar(type: Jar, dependsOn:dokka){
archiveClassifier = "javadoc"
from("$buildDir/dokka")
}


artifacts {
archives kotlinDocJar
archives sourcesJar
}

bintray {

user = project.findProperty("BINTRAY_USER")
key = project.findProperty("BINTRAY_KEY")

configurations = ['archives']
publications = ['JcenterPublication']

pkg {
repo = bintrayRepo
name = libraryName
desc = libraryDescription
websiteUrl = siteUrl
vcsUrl = gitUrl
licenses = allLicenses
dryRun = false
publish = true
override = false
publicDownloadNumbers = true
version {
gpg {
sign = true
passphrase = project.findProperty("BINTRAY_GPG_KEY")
}
name = ProjectSettings.version
vcsTag = ProjectSettings.version
desc = libraryDescription
}
}
}
2 changes: 1 addition & 1 deletion sample/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ android {
}

dependencies {
implementation(project(":library"))
implementation(project(":core"))
implementation(project(":databinding"))

// Kotlin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import android.annotation.SuppressLint
import android.content.Context
import android.util.AttributeSet
import android.view.MotionEvent
import android.widget.TextView
import androidx.appcompat.widget.AppCompatTextView
import com.thefuntasty.hauler.LockableNestedScrollView

class IgnoredAreaView @kotlin.jvm.JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : TextView(context, attrs, defStyleAttr) {
) : AppCompatTextView(context, attrs, defStyleAttr) {

private var parentScrollView: LockableNestedScrollView? = null

Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
rootProject.buildFileName = "build.gradle.kts"

include(":library", ":databinding", ":sample")
include(":core", ":databinding", ":sample")

0 comments on commit fc321af

Please sign in to comment.