Skip to content

Commit

Permalink
Init Conveyor
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-Fabi committed Nov 22, 2023
1 parent d8c4640 commit 95d4677
Show file tree
Hide file tree
Showing 20 changed files with 261 additions and 74 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/conveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Conveyor Deploy
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'

jobs:
deploy:
runs-on: linux
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Test
run: ./gradlew test --stacktrace
env:
env: CI
GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx3g"

- name: Build
run: ./gradlew jar -PversionString="${{ github.ref_name }}" # TODO use "proguardReleaseJars" as this also uses Pro-Guard (but there needs to be more configuration [ProGuard, gradle and conveyor])
env:
GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx3g"

- name: Extract secrets
run: |
echo "${{ secrets.KEYS_TAR_ASC }}" > .keys.tar.gz.asc
gpg -d --passphrase "${{ secrets.KEYS_PASSPHRASE }}" --batch .keys.tar.gz.asc > .keys.tar.gz
tar xzf .keys.tar.gz
cd ..
- name: Run Conveyor
uses: hydraulic-software/conveyor/actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
APPLE_ISSUER_ID: ${{ secrets.APPLE_ISSUER_ID }}
APPLE_KEY_ID: ${{ secrets.APPLE_KEY_ID }}
with:
command: make copied-site
extra_flags: -f ci.conveyor.conf
signing_key: ${{ secrets.SIGNING_KEY }}
agree_to_license: 1

- name: Create latest
run: |
cd build/compose/binaries/main/${{ matrix.pkg }}/
cp ./* ./WaiterRobot-Desktop-latest.${{ matrix.pkg}}
- name: Move to release server
uses: garygrossgarten/github-action-scp@release
with:
local: build/compose/binaries/main/${{ matrix.pkg }}
remote: /var/www/datepoll-share/WaiterRobot/Desktop-Releases/${{ matrix.pkg}}
host: ${{ secrets.RELEASES_SSH_HOST }}
port: ${{ secrets.RELEASES_SSH_PORT }}
username: ${{ secrets.RELEASES_SSH_USER }}
privateKey: ${{ secrets.RELEASES_SSH_PRIVATE_KEY }}
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -232,5 +232,6 @@ gradle-app.setting

# End of https://www.toptal.com/developers/gitignore/api/macos,intellij,kotlin,gradle,windows,linux

# Application generated files
/WaiterRobot/config/mediatorConfig.json
#Conveyor
output
.keys
1 change: 0 additions & 1 deletion .idea/runConfigurations/App.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions .idea/runConfigurations/Conveyor_run.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .idea/runConfigurations/runDistributable.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# WaiterRobot-Mediator

## Run

To run the development version you have to supply the app version. This can be done in two ways:
## Install App
Download the latest Version [here](https://datepollsystems.github.io/waiterrobot-ios/download.html).

- supply as system property / vm-option `-Djpackage.app-version="99.0.0"`
- run the distributable and supply as gradle property: `./gradlew runDistributable -PversionString=99.0.0`
## Run

> Use `99.0.0` as version so that the backend knows that all features are available or supply a specific version if you
> have checked out an old release or want to test with a "real" version string.
To run with a specific version you can supply the app version as system properties / vm-options
`-Dapp.version="99.99.99"`

The pre-configured IntelliJ run configurations already include this config.
> Use `99.99.99` as version so that the backend knows that all features are available or supply a specific
> version if you have checked out an old release or want to test with a "real" version string.
## Create Release

Releases are created by CI and are published to GitHub releases. There are executables for Windows, Mac and Linux
created. To create a new release just push a tag in the form of `vmajor.minor.patch` (e.g. `v1.0.0`) to GitHub. This
will start the CI. After a few minutes the artifacts can be downloaded
from [Releases](https://github.com/DatepollSystems/waiterrobot-desktop/releases).
from [Releases](https://github.com/DatepollSystems/waiterrobot-desktop/releases) or
[Download](https://datepollsystems.github.io/waiterrobot-ios/download.html).

## Recommendations

Expand Down
41 changes: 19 additions & 22 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import io.gitlab.arturbosch.detekt.Detekt
import io.gitlab.arturbosch.detekt.report.ReportMergeTask
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
Expand All @@ -9,18 +8,24 @@ plugins {
kotlin("plugin.serialization") version kotlinVersion
id("org.jetbrains.compose") version "1.4.3"
id("io.gitlab.arturbosch.detekt") version "1.23.1"
id("dev.hydraulic.conveyor") version "1.6"
}

group = "org.datepollsystems.waiterrobot.mediator"
version = "1.0.0"
version = (project.findProperty("versionString") as? String)?.removePrefix("v") ?: "99.99.99"

repositories {
google()
mavenCentral()
}

dependencies {
implementation(compose.desktop.currentOs)
linuxAmd64(compose.desktop.linux_x64)
linuxAarch64(compose.desktop.linux_arm64)
macAmd64(compose.desktop.macos_x64)
macAarch64(compose.desktop.macos_arm64)
windowsAmd64(compose.desktop.windows_x64)

implementation(compose.materialIconsExtended)

val ktorVersion = "2.3.2"
Expand Down Expand Up @@ -60,30 +65,14 @@ tasks.withType<KotlinCompile> {
}

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}

compose.desktop {
application {
mainClass = "org.datepollsystems.waiterrobot.mediator.App"
nativeDistributions {
targetFormats(TargetFormat.Dmg, TargetFormat.Exe, TargetFormat.Deb) // TODO add more?
packageName = "WaiterRobot Desktop"
packageVersion = (project.findProperty("versionString") as? String)?.removePrefix("v")

macOS {
iconFile.set(project.file("icon.icns"))
}
windows {
iconFile.set(project.file("icon.ico"))
}
linux {
iconFile.set(project.file("icon.png"))
}

includeAllModules = true // TODO figure out which modules are really needed -> reduces app size
}
}
}

Expand Down Expand Up @@ -113,3 +102,11 @@ tasks.withType<Detekt>().configureEach {
detektReportMergeSarif {
input.from(tasks.withType<Detekt>().map { it.sarifReportFile })
}

// Work around temporary Compose bugs.
configurations.all {
attributes {
// https://github.com/JetBrains/compose-jb/issues/1404#issuecomment-1146894731
attribute(Attribute.of("ui", String::class.java), "awt")
}
}
25 changes: 25 additions & 0 deletions ci.conveyor.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
include required("conveyor.conf")

app {

site {
github {
oauth-token = ${env.GITHUB_TOKEN}
pages-branch = gh-pages
}
}

#signing-key = ${env.SIGNING_KEY}

#mac.certificate = .keys/apple.cer

# We probably need to use a self-signed one here (certificates for windows cost around 400 - 500€ per year)
# Another option would be to distribute through the Microsoft-AppStore (~20€ a year)
#windows.certificate = .keys/windows.cer

#mac.notarization {
# issuer-id = ${env.APPLE_ISSUER_ID}
# key-id = ${env.APPLE_KEY_ID}
# private-key = .keys/api_key.p8
#}
}
27 changes: 27 additions & 0 deletions conveyor.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// This is a hashbang include. You can run the command after the #! to see what
// configuration is being extracted from the Gradle build using the Conveyor plugin.
include "#!./gradlew -q printConveyorConfig"

// This enables native library extraction, which improves app startup time and robustness.
// It's optional but a good idea to have it. You can remove this if you get tired of specifying
// system properties for Java libraries with native components.
//
// See https://hydraulic.dev/blog/11-in-jar-signing.html for more.
include required("https://raw.githubusercontent.com/hydraulic-software/conveyor/master/configs/jvm/extract-native-libraries.conf")

// Config file documentation: https://conveyor.hydraulic.dev/latest/configs
app {
rdns-name = "org.datepollsystems.waiterrobot.mediator"
display-name = kellner.team
vendor = DatePollSystems
contact-email = "[email protected]"

icons = icon.svg // TODO add and change loading of it in App.kt
windows.inputs += TASK/rendered-icons/windows
linux.inputs += TASK/rendered-icons/linux

vcs-url = github.com/DatepollSystems/waiterrobot-desktop
license = GPL-3.0
}

conveyor.compatibility-level = 12
Binary file removed icon.icns
Binary file not shown.
Binary file removed icon.ico
Binary file not shown.
Binary file removed icon.png
Binary file not shown.
52 changes: 52 additions & 0 deletions icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ data class AppVersion(val major: Int, val minor: Int, val patch: Int) {
return AppVersion(major, minor, patch)
}

fun fromVersionStringOrNull(version: String): AppVersion? =
runCatching { fromVersionString(version) }.getOrNull()
fun fromVersionStringOrNull(version: String?): AppVersion? =
version?.runCatching { fromVersionString(version) }?.getOrNull()

val current: AppVersion = fromVersionString(System.getProperty("jpackage.app-version"))
val current: AppVersion = fromVersionStringOrNull(System.getProperty("app.version"))
?: AppVersion(99, 99, 99)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ data class MediatorConfiguration(
companion object {
// TODO fix this location is not valid in prod
private fun getFile(): File {
val rootPath = System.getProperty("user.dir")
val rootPath = System.getProperty("user.dir") // TODO maybe replace with app.dir (see https://conveyor.hydraulic.dev/12.1/configs/jvm/#appjvmsystem-properties)
return File(rootPath, "WaiterRobot/config/mediatorConfig.json")
}

Expand Down

This file was deleted.

Loading

0 comments on commit 95d4677

Please sign in to comment.