From 2827a08cf46a4c3e3ec3eee060630f152eba91d0 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Sat, 21 Sep 2024 15:23:32 +0200 Subject: [PATCH 1/9] first version --- .github/workflows/main.yml | 72 ++++++++++++++++++++------------------ 1 file changed, 38 insertions(+), 34 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 268f715..4a78d46 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,43 +1,47 @@ -name: Build macOS App +name: Build on: push: branches: - main + - ci-cd + pull_request: + branches: + - main jobs: build: - runs-on: macos-14 + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-latest, windows-latest] steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Set up Xcode - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: '15.1' - - - name: Build the project - run: xcodebuild -project AndroidTools/AndroidTools.xcodeproj -scheme AndroidTools -sdk macosx CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO - - - name: Archive the project - run: xcodebuild -project AndroidTools/AndroidTools.xcodeproj -scheme AndroidTools -sdk macosx -configuration Release archive -archivePath ${{github.workspace}}/build/AndroidTools.xcarchive CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO - - - name: Export the archive - run: | - xcodebuild -exportArchive \ - -archivePath ${{github.workspace}}/build/AndroidTools.xcarchive \ - -exportPath ${{github.workspace}}/build \ - -exportOptionsPlist AndroidTools/ExportOptions.plist \ - CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO - - - name: List files - run: ls -l ${{github.workspace}}/build/ - - - name: Upload Artifacts - uses: actions/upload-artifact@v2 - with: - name: AndroidTools - path: | - ${{github.workspace}}/build/*.pkg - ${{github.workspace}}/build/*.app + - name: Checkout source code + uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: '17' + + - name: Set up Gradle (Windows uniquement) + if: matrix.os == 'windows-latest' + uses: gradle/gradle-build-action@v2 + + - name: Build the app + run: ./gradlew packageReleaseDistZip + + - name: Upload build artifacts (macOS) + if: matrix.os == 'macos-latest' + uses: actions/upload-artifact@v3 + with: + name: macos-build + path: build/compose/binaries/main/release/ + + - name: Upload build artifacts (Windows) + if: matrix.os == 'windows-latest' + uses: actions/upload-artifact@v3 + with: + name: windows-build + path: build/compose/binaries/main/release/ From 587543ba44383c67257dca18f000d113d95c3338 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Sat, 21 Sep 2024 15:51:43 +0200 Subject: [PATCH 2/9] Change script --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4a78d46..3b09c1f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,12 +25,12 @@ jobs: distribution: 'zulu' java-version: '17' - - name: Set up Gradle (Windows uniquement) + - name: Set up Gradle (Windows) if: matrix.os == 'windows-latest' uses: gradle/gradle-build-action@v2 - name: Build the app - run: ./gradlew packageReleaseDistZip + run: ./gradlew createDistributable - name: Upload build artifacts (macOS) if: matrix.os == 'macos-latest' From afe929f60d94eb93b39e15ceea4aa651722e16cc Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Sat, 21 Sep 2024 16:00:00 +0200 Subject: [PATCH 3/9] Change artifact path --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3b09c1f..c93885a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -37,11 +37,11 @@ jobs: uses: actions/upload-artifact@v3 with: name: macos-build - path: build/compose/binaries/main/release/ + path: /Users/runner/work/AndroidTools/AndroidTools/composeApp/build/compose/binaries/main/dmg - name: Upload build artifacts (Windows) if: matrix.os == 'windows-latest' uses: actions/upload-artifact@v3 with: name: windows-build - path: build/compose/binaries/main/release/ + path: /Users/runner/work/AndroidTools/AndroidTools/composeApp/build/compose/binaries/main/app From 12a427dfaeeae498e590e0b781885983ca72e095 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Sat, 21 Sep 2024 16:40:12 +0200 Subject: [PATCH 4/9] a --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c93885a..b0bba1a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -37,11 +37,11 @@ jobs: uses: actions/upload-artifact@v3 with: name: macos-build - path: /Users/runner/work/AndroidTools/AndroidTools/composeApp/build/compose/binaries/main/dmg + path: /Users/runner/work/AndroidTools/AndroidTools/composeApp/build/ - name: Upload build artifacts (Windows) if: matrix.os == 'windows-latest' uses: actions/upload-artifact@v3 with: name: windows-build - path: /Users/runner/work/AndroidTools/AndroidTools/composeApp/build/compose/binaries/main/app + path: /Users/runner/work/AndroidTools/AndroidTools/composeApp/build/ From 31b9e5ff932eb5d7b2d83524e351c3e87a949e6e Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Sat, 21 Sep 2024 16:47:03 +0200 Subject: [PATCH 5/9] b --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b0bba1a..804a0fd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -37,7 +37,7 @@ jobs: uses: actions/upload-artifact@v3 with: name: macos-build - path: /Users/runner/work/AndroidTools/AndroidTools/composeApp/build/ + path: /Users/runner/work/AndroidTools/AndroidTools/composeApp/build/compose/binaries/main/app - name: Upload build artifacts (Windows) if: matrix.os == 'windows-latest' From c873ab16d6ef46d3f1add868ac2dd463084adbf4 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Sat, 21 Sep 2024 16:56:32 +0200 Subject: [PATCH 6/9] d --- .github/workflows/main.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 804a0fd..8170195 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -29,15 +29,20 @@ jobs: if: matrix.os == 'windows-latest' uses: gradle/gradle-build-action@v2 - - name: Build the app - run: ./gradlew createDistributable + - name: Build the app (macOS) + if: matrix.os == 'macos-latest' + run: ./gradlew packageDmg + + - name: Build the app (Windows) + if: matrix.os == 'windows-latest' + run: ./gradlew packageMsi - name: Upload build artifacts (macOS) if: matrix.os == 'macos-latest' uses: actions/upload-artifact@v3 with: name: macos-build - path: /Users/runner/work/AndroidTools/AndroidTools/composeApp/build/compose/binaries/main/app + path: /Users/runner/work/AndroidTools/AndroidTools/composeApp/build/compose/binaries/main/dmg - name: Upload build artifacts (Windows) if: matrix.os == 'windows-latest' From ace01803f8ce84b8b6b1e0879ceb4a357513baa3 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Sat, 21 Sep 2024 17:21:07 +0200 Subject: [PATCH 7/9] Update main.yml --- .github/workflows/main.yml | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8170195..3082ecf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,10 +11,7 @@ on: jobs: build: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [macos-latest, windows-latest] + runs-on: macos-13 steps: - name: Checkout source code uses: actions/checkout@v3 @@ -25,28 +22,11 @@ jobs: distribution: 'zulu' java-version: '17' - - name: Set up Gradle (Windows) - if: matrix.os == 'windows-latest' - uses: gradle/gradle-build-action@v2 - - - name: Build the app (macOS) - if: matrix.os == 'macos-latest' + - name: Build the app run: ./gradlew packageDmg - - name: Build the app (Windows) - if: matrix.os == 'windows-latest' - run: ./gradlew packageMsi - - - name: Upload build artifacts (macOS) - if: matrix.os == 'macos-latest' + - name: Upload build artifacts uses: actions/upload-artifact@v3 with: name: macos-build path: /Users/runner/work/AndroidTools/AndroidTools/composeApp/build/compose/binaries/main/dmg - - - name: Upload build artifacts (Windows) - if: matrix.os == 'windows-latest' - uses: actions/upload-artifact@v3 - with: - name: windows-build - path: /Users/runner/work/AndroidTools/AndroidTools/composeApp/build/ From 7f4c53cf31bcf0e688c088e2ed43c12f635bbdf8 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Sat, 21 Sep 2024 17:32:12 +0200 Subject: [PATCH 8/9] Use klogging in toml --- composeApp/build.gradle.kts | 2 +- gradle/libs.versions.toml | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/composeApp/build.gradle.kts b/composeApp/build.gradle.kts index 9a02e56..9dce736 100644 --- a/composeApp/build.gradle.kts +++ b/composeApp/build.gradle.kts @@ -36,7 +36,7 @@ kotlin { implementation(libs.kotlinx.datetime) - implementation("io.klogging:klogging-jvm:0.7.2") + implementation(libs.klogging) } // https://gist.github.com/OysterD3?page=3 // https://betterprogramming.pub/how-to-create-an-auto-updater-for-desktop-application-jetpack-compose-d118db26d65f diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d8be858..d16de51 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -12,6 +12,8 @@ koin = "3.4.3" datetime = "0.6.1" +klogging = "0.7.2" + [libraries] kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" } kotlin-test-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" } @@ -29,6 +31,10 @@ koin-core = { module = "io.insert-koin:koin-core", version.ref = "koin" } kotlinx-datetime = { group = "org.jetbrains.kotlinx", name = "kotlinx-datetime", version.ref = "datetime" } +klogging = { module = "io.klogging:klogging-jvm", version.ref = "klogging" } + + + [plugins] jetbrainsCompose = { id = "org.jetbrains.compose", version.ref = "compose-plugin" } compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } From 86b45912bde45e263f5623562ef5739fd9c6a486 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Sat, 21 Sep 2024 17:33:50 +0200 Subject: [PATCH 9/9] Clean up --- .github/workflows/main.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3082ecf..41dda87 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,10 +4,6 @@ on: push: branches: - main - - ci-cd - pull_request: - branches: - - main jobs: build: