From f03aea73768dbe7a9f63d3e9d894fc54b6bb2183 Mon Sep 17 00:00:00 2001 From: norangebit Date: Wed, 8 Jan 2020 20:44:22 +0100 Subject: [PATCH 1/7] add clean pipeline --- .drone.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/.drone.yml b/.drone.yml index 5db0a51..e437168 100644 --- a/.drone.yml +++ b/.drone.yml @@ -35,3 +35,39 @@ volumes: - name: android host: path: /home/drone/Android/Sdk + +trigger: + branch: + exclude: + - master + +--- +kind: pipeline +type: docker +name: clean + +steps: +- name: build + image: nextcloudci/android:android-49 + commands: + - ./gradlew build + +- name: notify + image: appleboy/drone-telegram + settings: + token: + from_secret: telegram_token + to: + from_secret: telegram_user + format: markdown + message: | + Build [#{{build.number}}]({{build.link}}) from commit [{{truncate commit.sha 10}}]({{commit.link}}) on {{commit.branch}} **failed**. + {{uppercasefirst commit.author}} please fix me! + when: + status: + - failure + +trigger: + branch: + include: + - master From 48211c129b4977733593b1268b3df6724665fc66 Mon Sep 17 00:00:00 2001 From: norangebit Date: Sun, 12 Jan 2020 17:30:06 +0100 Subject: [PATCH 2/7] add release step --- .drone.yml | 41 +++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/.drone.yml b/.drone.yml index e437168..ff473b6 100644 --- a/.drone.yml +++ b/.drone.yml @@ -37,20 +37,42 @@ volumes: path: /home/drone/Android/Sdk trigger: - branch: + event: exclude: - - master + - tag --- kind: pipeline type: docker -name: clean +name: release steps: - name: build image: nextcloudci/android:android-49 + volumes: + - name: tmp + path: /drone/src/out commands: - - ./gradlew build + - ./gradlew :wrapper:build + - mv /drone/src/wrapper/build/libs/*.jar /drone/src/out/ + - mv /drone/src/app/build/outputs/apk/release/*.apk + +- name: gitea release + image: plugins/gitea-release + volumes: + - name: tmp + path: /drone/src/out + settings: + api_key: + from_secret: gitea_release + base_url: https://git.norangeb.it + title: wedroid + files: + - /drone/src/out/*.jar + - /drone/src/out/*.apk + checksum: + - md5 + - sha256 - name: notify image: appleboy/drone-telegram @@ -61,13 +83,16 @@ steps: from_secret: telegram_user format: markdown message: | - Build [#{{build.number}}]({{build.link}}) from commit [{{truncate commit.sha 10}}]({{commit.link}}) on {{commit.branch}} **failed**. + Build [#{{build.number}}]({{build.link}}) from commit [{{truncate commit.sha 10}}]({{commit.link}}) with tag {{build.tag}} **failed**. {{uppercasefirst commit.author}} please fix me! when: status: - failure +volumes: +- name: tmp + temp: {} + trigger: - branch: - include: - - master + event: + - tag From 17c14923ff030cd4468c7c0c67a19b16f73d51ab Mon Sep 17 00:00:00 2001 From: norangebit Date: Sun, 12 Jan 2020 18:04:55 +0100 Subject: [PATCH 3/7] fix build command --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index ff473b6..fdd21f5 100644 --- a/.drone.yml +++ b/.drone.yml @@ -53,7 +53,7 @@ steps: - name: tmp path: /drone/src/out commands: - - ./gradlew :wrapper:build + - ./gradlew build - mv /drone/src/wrapper/build/libs/*.jar /drone/src/out/ - mv /drone/src/app/build/outputs/apk/release/*.apk From 1294c1c45acdca0d5dec682bf22ef507bcd7ef15 Mon Sep 17 00:00:00 2001 From: norangebit Date: Sun, 12 Jan 2020 18:14:44 +0100 Subject: [PATCH 4/7] add move destination --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index fdd21f5..2631e78 100644 --- a/.drone.yml +++ b/.drone.yml @@ -55,7 +55,7 @@ steps: commands: - ./gradlew build - mv /drone/src/wrapper/build/libs/*.jar /drone/src/out/ - - mv /drone/src/app/build/outputs/apk/release/*.apk + - mv /drone/src/app/build/outputs/apk/release/*.apk /drone/src/out/ - name: gitea release image: plugins/gitea-release From 92b6bc642a795ea31e7c868e641c5ec22b3314d3 Mon Sep 17 00:00:00 2001 From: norangebit Date: Sun, 12 Jan 2020 19:30:18 +0100 Subject: [PATCH 5/7] add fat jar --- wrapper/build.gradle.kts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/wrapper/build.gradle.kts b/wrapper/build.gradle.kts index 94cb0da..e449cbd 100644 --- a/wrapper/build.gradle.kts +++ b/wrapper/build.gradle.kts @@ -14,3 +14,18 @@ dependencies { // use JUnit test framework testImplementation("junit:junit:4.12") } + +tasks { + jar { + from( + configurations.compileClasspath + .map { config -> + config.map { if (it.isDirectory) it else zipTree(it) } + } + ) + + manifest { + attributes("Implementation-Title" to "wedroid-wrapper") + } + } +} From 7bc707a44315cf3c01c1fc26b04d18d9c4525964 Mon Sep 17 00:00:00 2001 From: norangebit Date: Sun, 12 Jan 2020 19:55:45 +0100 Subject: [PATCH 6/7] add fatJar task --- .drone.yml | 1 + wrapper/build.gradle.kts | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index 2631e78..01d8840 100644 --- a/.drone.yml +++ b/.drone.yml @@ -54,6 +54,7 @@ steps: path: /drone/src/out commands: - ./gradlew build + - ./gradlew :wrapper:fatJar - mv /drone/src/wrapper/build/libs/*.jar /drone/src/out/ - mv /drone/src/app/build/outputs/apk/release/*.apk /drone/src/out/ diff --git a/wrapper/build.gradle.kts b/wrapper/build.gradle.kts index e449cbd..64a9c29 100644 --- a/wrapper/build.gradle.kts +++ b/wrapper/build.gradle.kts @@ -15,8 +15,10 @@ dependencies { testImplementation("junit:junit:4.12") } -tasks { - jar { +tasks{ + register("fatJar") { + archiveClassifier.set("fat") + from( configurations.compileClasspath .map { config -> From 1461e1a179d97127b818bd7c2bd50fd257120861 Mon Sep 17 00:00:00 2001 From: norangebit Date: Sun, 12 Jan 2020 21:05:51 +0100 Subject: [PATCH 7/7] edit notefication and add chaching --- .drone.yml | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/.drone.yml b/.drone.yml index 01d8840..60548c8 100644 --- a/.drone.yml +++ b/.drone.yml @@ -50,6 +50,10 @@ steps: - name: build image: nextcloudci/android:android-49 volumes: + - name: gradle + path: /root/.gradle + - name: android + path: /opt/android-sdk-linux - name: tmp path: /drone/src/out commands: @@ -84,15 +88,22 @@ steps: from_secret: telegram_user format: markdown message: | - Build [#{{build.number}}]({{build.link}}) from commit [{{truncate commit.sha 10}}]({{commit.link}}) with tag {{build.tag}} **failed**. - {{uppercasefirst commit.author}} please fix me! - when: - status: - - failure + {{#success build.status}} + Release-{{build.tag}} successfully released. + {{else}} + Build [#{{build.number}}]({{build.link}}) from commit [{{truncate commit.sha 10}}]({{commit.link}}) with tag {{build.tag}} **failed**. + {{uppercasefirst commit.author}} please fix me! + {{/success}} volumes: - name: tmp temp: {} +- name: gradle + host: + path: /home/drone/.gradle +- name: android + host: + path: /home/drone/Android/Sdk trigger: event: