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: 0 additions & 69 deletions .github/workflows/develop.yml

This file was deleted.

52 changes: 52 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Android CI - Master

on:
push:
branches: [ "master" ]

Comment on lines +3 to +6
jobs:
ci-checks:
name: Run code checks and android tests
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

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

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

- name: Run Unit tests
run: ./gradlew testDebug

- name: Run Android tests
uses: ReactiveCircus/android-emulator-runner@v2.33.0
with:
api-level: 30
target: google_atd
arch: x86
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
38 changes: 19 additions & 19 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
name: Android CI - PR checks

on:
pull_request
pull_request:

jobs:
basic-tests:
name: Run code analysis and unit tests
runs-on: ubuntu-latest
pr-checks:
name: Run full PR check
runs-on: ubuntu-latest

steps:
- name: Checking out branch
uses: actions/checkout@v4
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: 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: Setup Android SDK
uses: android-actions/setup-android@v3

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

- name: Run Unit tests
run: ./gradlew testDebug
- name: Run Unit tests
run: ./gradlew testDebug
14 changes: 12 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: Publish to Maven Central

on:
push:
branches: [ "master" ]
tags:
- '[0-9]+.[0-9]+.[0-9]+'

jobs:
publish:
Expand All @@ -14,6 +15,15 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

# The published version comes from libs.versions.toml, not the tag - keep them in sync
- name: Verify tag matches library version
run: |
VERSION=$(grep -m1 '^print-engine = ' gradle/libs.versions.toml | cut -d'"' -f2)
if [ "${GITHUB_REF_NAME}" != "${VERSION}" ]; then
echo "Tag ${GITHUB_REF_NAME} does not match libs.versions.toml version ${VERSION}"
exit 1
fi
Comment on lines +21 to +25

- name: Setup Java
uses: actions/setup-java@v4
with:
Expand Down Expand Up @@ -50,4 +60,4 @@ jobs:

- name: Publish To Maven Central
run: |
./gradlew publishAndReleaseToMavenCentral --no-configuration-cache
./gradlew publishAndReleaseToMavenCentral --no-configuration-cache
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ dependencyResolutionManagement {
// build.gradle.kts
dependencies {
// Core library (required)
implementation("io.github.tillhub:print-engine-core:3.0.5")
implementation("io.github.tillhub:print-engine-core:3.1.0")

// Built-in printer plugins (Android only)
implementation("io.github.tillhub:print-engine-pax:3.0.5")
implementation("io.github.tillhub:print-engine-sunmi:3.0.5")
implementation("io.github.tillhub:print-engine-verifone:3.0.5")
implementation("io.github.tillhub:print-engine-pax:3.1.0")
implementation("io.github.tillhub:print-engine-sunmi:3.1.0")
implementation("io.github.tillhub:print-engine-verifone:3.1.0")

// External printer plugins (Android & iOS)
implementation("io.github.tillhub:print-engine-star:3.0.5")
implementation("io.github.tillhub:print-engine-epson:3.0.5")
implementation("io.github.tillhub:print-engine-star:3.1.0")
implementation("io.github.tillhub:print-engine-epson:3.1.0")
}
```

Expand Down Expand Up @@ -255,7 +255,7 @@ Supports Android and iOS.
#### Installation

```kotlin
implementation("io.github.tillhub:print-engine-star:3.0.5")
implementation("io.github.tillhub:print-engine-star:3.1.0")
```

#### Setup & Usage
Expand Down Expand Up @@ -350,7 +350,7 @@ Supports Android and iOS.
#### Installation

```kotlin
implementation("io.github.tillhub:print-engine-epson:3.0.5")
implementation("io.github.tillhub:print-engine-epson:3.1.0")
```

#### Setup & Usage
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
print-engine = "3.0.5"
print-engine = "3.1.0"

# Build tools
kotlin = "2.2.0"
Expand Down
10 changes: 0 additions & 10 deletions print-engine/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,6 @@ mavenPublishing {
name.set("Đorđe Hrnjez")
email.set("dorde.hrnjez@unzer.com")
}
developer {
id.set("SloInfinity")
name.set("Martin Sirok")
email.set("m.sirok.ext@unzer.com")
}
developer {
id.set("shekar-allam")
name.set("Chandrashekar Allam")
email.set("chandrashekar.allam@unzer.com")
}
}

// Specify SCM information
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,22 @@ import android.graphics.Bitmap
import android.util.Base64
import androidx.compose.ui.graphics.ImageBitmap
import androidx.compose.ui.graphics.asAndroidBitmap
import androidx.compose.ui.graphics.asImageBitmap
import androidx.core.graphics.createBitmap
import java.io.ByteArrayOutputStream

actual fun ImageBitmap.encodeToBase64(): String = ByteArrayOutputStream().let { stream ->
this.asAndroidBitmap().compress(Bitmap.CompressFormat.PNG, PNG_QUALITY, stream)
val b = stream.toByteArray()
Base64.encodeToString(b, Base64.DEFAULT)
Base64.encodeToString(b, Base64.NO_WRAP)
}

internal actual fun argbToImageBitmap(
pixels: IntArray,
width: Int,
height: Int,
): ImageBitmap = createBitmap(width, height).apply {
setPixels(pixels, 0, width, 0, 0, width, height)
}.asImageBitmap()

private const val PNG_QUALITY = 100
Loading
Loading