Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue152 - Fix CI so it can be required #169

Merged
merged 43 commits into from
Dec 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
ab02746
Update config.yml
isuPatches Dec 26, 2022
b55a827
Update config.yml
isuPatches Dec 26, 2022
6bb741e
Update config.yml
isuPatches Dec 26, 2022
f036857
Update config.yml
isuPatches Dec 26, 2022
23b6895
Remove debug signing
isuPatches Dec 26, 2022
79bc3cf
Testing
isuPatches Dec 26, 2022
c8fc727
Create .keep
isuPatches Dec 26, 2022
edf950f
Update config.yml
isuPatches Dec 26, 2022
5ca5b2b
Update config.yml
isuPatches Dec 26, 2022
413c54a
Update BuildVersions.kt
isuPatches Dec 26, 2022
f9e9211
Publish to maven local for CI
isuPatches Dec 26, 2022
53a1f12
GPG Key adjustments
isuPatches Dec 26, 2022
dd7d98d
Update config.yml
isuPatches Dec 26, 2022
7981f2a
Update config.yml
isuPatches Dec 26, 2022
6616114
Update config.yml
isuPatches Dec 26, 2022
c02bc69
Update config.yml
isuPatches Dec 26, 2022
fb5d796
Update config.yml
isuPatches Dec 26, 2022
309a5c1
Not signing on CI
isuPatches Dec 26, 2022
1314c16
Update config.yml
isuPatches Dec 26, 2022
e945dd1
Update config.yml
isuPatches Dec 26, 2022
6d6b7f3
Update config.yml
isuPatches Dec 26, 2022
b2e7fbf
Test
isuPatches Dec 26, 2022
8c398fa
Update config.yml
isuPatches Dec 26, 2022
e1b180c
Update config.yml
isuPatches Dec 26, 2022
8fb773d
Update config.yml
isuPatches Dec 26, 2022
48d0651
Update config.yml
isuPatches Dec 26, 2022
0c9b87a
Update config.yml
isuPatches Dec 26, 2022
fda6b95
Update config.yml
isuPatches Dec 26, 2022
6d7e8b3
Update config.yml
isuPatches Dec 26, 2022
749c48c
Update config.yml
isuPatches Dec 26, 2022
5ec3eea
Update config.yml
isuPatches Dec 26, 2022
4aa7cee
Update config.yml
isuPatches Dec 26, 2022
655da1b
Sanity check
isuPatches Dec 26, 2022
5e932ca
Testing...
isuPatches Dec 26, 2022
b274383
Update PublishingPlugin.kt
isuPatches Dec 26, 2022
89c157c
Update config.yml
isuPatches Dec 26, 2022
0ff081a
Update config.yml
isuPatches Dec 26, 2022
2dc14e7
Update config.yml
isuPatches Dec 26, 2022
8de73b4
Update config.yml
isuPatches Dec 26, 2022
a54c3c3
Update config.yml
isuPatches Dec 26, 2022
6575cab
Update config.yml
isuPatches Dec 26, 2022
1a6b7bc
TEst
isuPatches Dec 26, 2022
b1e27d5
Simplify life
isuPatches Dec 26, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 60 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,68 @@ version: 2.1
orbs:
android: circleci/android@1.0.3

commands:
write-keystore-files:
steps:
- run:
name: Write Wisefy release keystore
command: echo "$WISEFY_RELEASE_KEYSTORE" | base64 --decode > keystores/wisefy-release.jks
- run:
name: Write Wisefy sample release keystore
command: echo "$WISEFY_SAMPLE_RELEASE_KEYSTORE" | base64 --decode > keystores/wisefy-sample-release.jks
import-gpg-key:
steps:
- run:
name: Write Wisefy GPG Key
command: echo -e $GPG_KEY > wisefy-gpg-key.asc
- run:
name: Import GPG Key
command: gpg --import --no-tty --batch --yes wisefy-gpg-key.asc
publish-to-maven-local:
steps:
- run:
name: Publish wisefy:core to Maven Local
command: ./gradlew wisefy:core:publishToMavenLocal
- run:
name: Pulblish wisefy:accesspoints to Maven Local
command: ./gradlew wisefy:accesspoints:publishToMavenLocal
- run:
name: Pulblish wisefy:addnetwork to Maven Local
command: ./gradlew wisefy:addnetwork:publishToMavenLocal
- run:
name: Pulblish wisefy:networkconnection to Maven Local
command: ./gradlew wisefy:networkconnection:publishToMavenLocal
- run:
name: Pulblish wisefy:networkinfo to Maven Local
command: ./gradlew wisefy:networkinfo:publishToMavenLocal
- run:
name: Pulblish wisefy:removenetwork to Maven Local
command: ./gradlew wisefy:removenetwork:publishToMavenLocal
- run:
name: Pulblish wisefy:savednetworks to Maven Local
command: ./gradlew wisefy:savednetworks:publishToMavenLocal
- run:
name: Pulblish wisefy:signal to Maven Local
command: ./gradlew wisefy:signal:publishToMavenLocal
- run:
name: Pulblish wisefy:wifi to Maven Local
command: ./gradlew wisefy:wifi:publishToMavenLocal
- run:
name: Pulblish wisefy to Maven Local
command: ./gradlew wisefy:publishToMavenLocal
- run:
name: Pulblish wisefy:ktx to Maven Local
command: ./gradlew wisefy:ktx:publishToMavenLocal

jobs:
static-analysis:
build-and-test:
executor:
name: android/android-machine
steps:
- checkout
- write-keystore-files
- import-gpg-key
- publish-to-maven-local
- run:
name: Run lint
command: ./gradlew lintDebug
Expand All @@ -21,21 +77,14 @@ jobs:
- run:
name: Run CPD
command: ./gradlew cpdCheck

build:
executor:
name: android/android-machine
steps:
- checkout
- run:
name: Assemble debug build
name: Assemble debug build
command: ./gradlew assembleDebug
- run:
name: Assemble release build
command: ./gradlew assembleRelease

workflows:
ci:
wisefy-ci-cd:
jobs:
- static-analysis
- build
- build-and-test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
/.idea/libraries/*
/.idea/codestyles/*
keystore.properties
*.jks
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ A Wifi configuration and util library built in Kotlin for Android.

[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-WiseFy-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/6011) [![Android Weekly](https://img.shields.io/badge/Android%20Weekly-%23230-blue.svg)](http://androidweekly.net/issues/issue-230)

[![CircleCI](https://dl.circleci.com/status-badge/img/gh/isuPatches/android-wisefy/tree/develop.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/isuPatches/android-wisefy/tree/develop)

- [Installation](#installation)
- [KTX Artifact](#ktx-artifact)
- [5.0 Rewrite](#50-rewrite)
Expand Down
29 changes: 8 additions & 21 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import com.isupatches.android.wisefy.build.Versions
import com.isupatches.android.wisefy.build.compose
import com.isupatches.android.wisefy.build.dagger
import com.isupatches.android.wisefy.build.navigation
import java.util.*

plugins {
id("com.android.application")
Expand All @@ -13,12 +12,6 @@ plugins {
id("dagger.hilt.android.plugin")
}

val keystoreProperties: Properties = Properties()
val keystoreFile: File = rootProject.file("keystore.properties")
if (keystoreFile.exists()) {
keystoreFile.inputStream().use { keystoreProperties.load(it) }
}

android {
namespace = "com.isupatches.android.wisefy.sample"
testNamespace = "com.isupatches.android.wisefy.sample.test"
Expand All @@ -39,37 +32,31 @@ android {
}

signingConfigs {
getByName("debug") {
storeFile = file(keystoreProperties.getProperty("app.debug.keystore_location"))
keyAlias = keystoreProperties.getProperty("app.debug.key_alias")
storePassword = System.getenv("APP_DEBUG_PASSWORD") ?: keystoreProperties.getProperty("app.debug.password")
keyPassword = System.getenv("APP_DEBUG_PASSWORD") ?: keystoreProperties.getProperty("app.debug.password")
}

create("release") {
storeFile = file(keystoreProperties.getProperty("app.release.keystore_location"))
keyAlias = keystoreProperties.getProperty("app.release.key_alias")
storePassword = keystoreProperties.getProperty("app.release.password")
keyPassword = keystoreProperties.getProperty("app.release.password")
storeFile = File("$rootDir/keystores/wisefy-sample-release.jks")
keyAlias = System.getenv("WISEFY_SAMPLE_RELEASE_KEY_ALIAS")
storePassword = System.getenv("WISEFY_SAMPLE_RELEASE_PASSWORD")
keyPassword = System.getenv("WISEFY_SAMPLE_RELEASE_PASSWORD")
}
}

buildTypes {
debug {
applicationIdSuffix = ".debug"
isTestCoverageEnabled = true
enableUnitTestCoverage = true
enableAndroidTestCoverage = true
isMinifyEnabled = false
isShrinkResources = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"$rootDir/proguard/r8-app-debug.pro"
)
testProguardFile(file("$rootDir/proguard/r8-app-test.pro"))
signingConfig = signingConfigs.getByName("debug")
}

release {
isTestCoverageEnabled = false
enableUnitTestCoverage = false
enableAndroidTestCoverage = false
isMinifyEnabled = false
isShrinkResources = false
proguardFiles(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
package com.isupatches.android.wisefy.build

object BuildVersions {
const val BUILD_TOOLS: String = "33.0.0-rc4"
const val BUILD_TOOLS: String = "33.0.1"

const val COMPILE_SDK: Int = 33
const val TARGET_SDK: Int = 33
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ import com.isupatches.android.wisefy.build.Dependencies
import com.isupatches.android.wisefy.build.DependencyConstants.IMPLEMENTATION
import com.isupatches.android.wisefy.build.Versions
import java.io.File
import java.io.FileInputStream
import java.util.Locale
import java.util.Properties
import org.gradle.api.JavaVersion
import org.gradle.api.Plugin
import org.gradle.api.Project
Expand All @@ -44,12 +42,6 @@ class BaseGradleModulePlugin : Plugin<Project> {

target.configure<LibraryExtension> {

val keystorePropertiesFile = target.file("../keystore.properties")
val keystoreProperties = Properties()
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(FileInputStream(keystorePropertiesFile))
}

compileSdk = BuildVersions.COMPILE_SDK
buildToolsVersion = BuildVersions.BUILD_TOOLS

Expand All @@ -63,18 +55,11 @@ class BaseGradleModulePlugin : Plugin<Project> {
}

signingConfigs {
create("debug${target.name.capitalize(Locale.ROOT)}") {
storeFile = File(System.getenv("WISEFY_DEBUG_KEYSTORE_LOCATION") ?: keystoreProperties["wisefy.debug.keystore_location"].toString())
storePassword = System.getenv("WISEFY_DEBUG_PASSWORD") ?: keystoreProperties["wisefy.debug.password"].toString()
keyPassword = System.getenv("WISEFY_DEBUG_PASSWORD") ?: keystoreProperties["wisefy.debug.password"].toString()
keyAlias = System.getenv("WISEFY_DEBUG_KEY_ALIAS") ?: keystoreProperties["wisefy.debug.key_alias"].toString()
}

create("release${target.name.capitalize(Locale.ROOT)}") {
storeFile = File(System.getenv("WISEFY_RELEASE_KEYSTORE_LOCATION") ?: keystoreProperties["wisefy.release.keystore_location"].toString())
storePassword = System.getenv("WISEFY_RELEASE_PASSWORD") ?: keystoreProperties["wisefy.release.password"].toString()
keyPassword = System.getenv("WISEFY_RELEASE_PASSWORD") ?: keystoreProperties["wisefy.release.password"].toString()
keyAlias = System.getenv("WISEFY_RELEASE_KEY_ALIAS") ?: keystoreProperties["wisefy.release.key_alias"].toString()
storeFile = File("${target.rootDir}/keystores/wisefy-release.jks")
keyAlias = System.getenv("WISEFY_RELEASE_KEY_ALIAS")
storePassword = System.getenv("WISEFY_RELEASE_PASSWORD")
keyPassword = System.getenv("WISEFY_RELEASE_PASSWORD")
}
}

Expand All @@ -90,7 +75,6 @@ class BaseGradleModulePlugin : Plugin<Project> {
)
testProguardFile("${target.rootDir}/proguard/r8-lib-test.pro")
consumerProguardFile("${target.rootDir}/proguard/r8-lib-consumer.pro")
signingConfig = signingConfigs.getByName("debug${target.name.capitalize(Locale.ROOT)}")
}

release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package com.isupatches.android.wisefy.build.plugins

import com.android.build.gradle.LibraryExtension
import com.isupatches.android.wisefy.build.PublishingConstants
import java.io.File
import java.net.URI
import java.util.Properties
Expand Down Expand Up @@ -74,7 +75,9 @@ class PublishingPlugin : Plugin<Project> {
publishing {
singleVariant("debug") {
withSourcesJar()
withJavadocJar()
if (System.getenv("GENERATE_DOCS_FOR_DEBUG_PUBLICATIONS") != null) {
withJavadocJar()
}
}

singleVariant("release") {
Expand All @@ -88,7 +91,7 @@ class PublishingPlugin : Plugin<Project> {
configure<PublishingExtension> {
publications {
create<MavenPublication>("debug") {
groupId = com.isupatches.android.wisefy.build.PublishingConstants.GROUP_ID
groupId = PublishingConstants.GROUP_ID
artifactId = project.name
version = project.version.toString()

Expand Down Expand Up @@ -120,7 +123,7 @@ class PublishingPlugin : Plugin<Project> {
}

create<MavenPublication>("release") {
groupId = com.isupatches.android.wisefy.build.PublishingConstants.GROUP_ID
groupId = PublishingConstants.GROUP_ID
artifactId = project.name
version = project.version.toString()

Expand Down
Empty file added keystores/.keep
Empty file.