Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
69 changes: 69 additions & 0 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Android CI - Develop

on:
push:
branches: [ "develop" ]

jobs:
ui-tests:
name: Run android tests and build staging
runs-on: ubuntu-latest
timeout-minutes: 60

steps:

- name: Checking out branch
uses: actions/checkout@v4

- name: set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle

- name: Setup Android SDK
uses: android-actions/setup-android@v3

# Hardware accelerated Android virtualization on Actions Linux larger hosted runners
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm

# Significantly reduce emulator startup time by setting up AVD snapshot caching
- name: Gradle cache
uses: gradle/actions/setup-gradle@v3

- name: AVD cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-30

- name: Create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: ReactiveCircus/android-emulator-runner@v2.33.0
with:
api-level: 30
target: google_atd
arch: x86
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD snapshot for caching."

- name: Run Android tests
uses: ReactiveCircus/android-emulator-runner@v2.33.0
with:
api-level: 30
target: google_atd
arch: x86
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: ./gradlew :print-engine:connectedAndroidTest
29 changes: 29 additions & 0 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Android CI - PR checks

on:
pull_request

jobs:
basic-tests:
name: Run code analysis and unit tests
runs-on: ubuntu-latest

steps:
- name: Checking out branch
uses: actions/checkout@v4

- name: set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle

- name: Setup Android SDK
uses: android-actions/setup-android@v3

- name: Run Spotless Code Analysis
run: ./gradlew spotlessCheck

- name: Run Unit tests
run: ./gradlew testDebug
53 changes: 53 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Publish to Maven Central

on:
push:
branches: [ "master" ]

jobs:
publish:
name: Build and publish to Maven Central
runs-on: macos-latest
timeout-minutes: 60

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'

- name: Install GPG
env:
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
run: |
brew install gpg
echo "$SIGNING_KEY" | gpg --dearmor > ${HOME}/secring.gpg

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Add Gradle Properties
env:
MAVEN_CENTRAL_USER_NAME: ${{ secrets.MAVEN_CENTRAL_USER_NAME }}
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
run: |
echo "mavenCentralUsername=${MAVEN_CENTRAL_USER_NAME}" >> gradle.properties
echo "mavenCentralPassword=${MAVEN_CENTRAL_PASSWORD}" >> gradle.properties
echo "signing.keyId=${SIGNING_KEY_ID}" >> gradle.properties
echo "signing.password=${SIGNING_KEY_PASSWORD}" >> gradle.properties
echo "signing.secretKeyRingFile=${HOME}/secring.gpg" >> gradle.properties

- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable

- name: Publish To Maven Central
run: |
./gradlew publishAndReleaseToMavenCentral --no-configuration-cache
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ out/
# Uncomment the following line in case you need and you don't have the release build type files in your app
# release/

# Kotlin folder
.kotlin

# Gradle files
.gradle/
build/
Expand Down
31 changes: 27 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,30 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.kotlinAndroid) apply false
alias(libs.plugins.androidLibrary) apply false
alias(libs.plugins.detekt) apply false
alias(libs.plugins.androidApplication).apply(false)
alias(libs.plugins.androidLibrary).apply(false)
alias(libs.plugins.kotlinAndroid).apply(false)
alias(libs.plugins.kotlinMultiplatform).apply(false)
alias(libs.plugins.compose.compiler).apply(false)
alias(libs.plugins.compose).apply(false)
alias(libs.plugins.spotless).apply(false)
}
subprojects {
apply(plugin = "com.diffplug.spotless")
configure<com.diffplug.gradle.spotless.SpotlessExtension> {
kotlin {
target("**/*.kt")
targetExclude("${layout.buildDirectory}/**/*.kt")

ktlint()
.editorConfigOverride(mapOf(
"ktlint_function_naming_ignore_when_annotated_with" to "Composable"
))

}

kotlinGradle {
target("*.gradle.kts")
ktlint()
}
}
}
5 changes: 2 additions & 3 deletions buildSrc/src/main/kotlin/Configs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import org.gradle.api.JavaVersion

object Configs {
const val APPLICATION_ID = "de.tillhub.printengine"
const val COMPILE_SDK = 34
const val MIN_SDK = 23
const val VERSION_CODE = "2.3.0"
const val COMPILE_SDK = 36
const val MIN_SDK = 24
val JAVA_VERSION = JavaVersion.VERSION_17
val JVM_TARGET = JAVA_VERSION.toString()
}
36 changes: 11 additions & 25 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,29 +1,15 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 -XX:+UseParallelGC
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Kotlin code style for this project: "official" or "obsolete":
#Kotlin
kotlin.code.style=official
kotlin.daemon.jvmargs=-Xmx3072M
kotlin.mpp.androidSourceSetLayoutVersion=2

# Enable configuration on demand
# https://docs.gradle.org/current/userguide/multi_project_configuration_and_execution.html#sec:configuration_on_demand
org.gradle.configureondemand=true
#Gradle
org.gradle.jvmargs=-Xmx4096M -Dfile.encoding=UTF-8
org.gradle.configuration-cache=true
org.gradle.caching=true

# Enable parallel execution
org.gradle.parallel=true
#Android
android.nonTransitiveRClass=true
android.useAndroidX=true

# Enable build caching
org.gradle.caching=true
#Maven Publish params goes here
Loading