aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarsh Shandilya <msfjarvis@gmail.com>2020-02-25 15:22:05 +0530
committerGitHub <noreply@github.com>2020-02-25 15:22:05 +0530
commitbea3cd5457e331f04a9aeb5c99267f14908f5eaa (patch)
treece86f35a1d5de1fc0e1d81f7945d47af256a59ac
parent97ee48dd2527762b299c2460478afd9d22824a0d (diff)
CI workflow improvements (#642)
* github: Only run debug tasks in PRs * github: Remove nightly deploys * github: Setup automatic debug branch deployment * Tweak Gradle config in CI Signed-off-by: Harsh Shandilya <me@msfjarvis.dev> Co-authored-by: Aditya Wasan <adityawasan55@gmail.com>
-rw-r--r--.github/ci-gradle.properties6
-rw-r--r--.github/workflows/branch_deploy.yml (renamed from .github/workflows/deploy_nightly_snapshots.yml)31
-rw-r--r--.github/workflows/deploy_snapshot.yml3
-rw-r--r--.github/workflows/pull_request.yml5
-rwxr-xr-xrelease/deploy-telegram.sh13
5 files changed, 42 insertions, 16 deletions
diff --git a/.github/ci-gradle.properties b/.github/ci-gradle.properties
new file mode 100644
index 00000000..05300282
--- /dev/null
+++ b/.github/ci-gradle.properties
@@ -0,0 +1,6 @@
+org.gradle.daemon=true
+org.gradle.configureondemand=true
+android.enableBuildCache=true
+org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
+org.gradle.caching=true
+org.gradle.parallel=true
diff --git a/.github/workflows/deploy_nightly_snapshots.yml b/.github/workflows/branch_deploy.yml
index 57effc96..7b681ab7 100644
--- a/.github/workflows/deploy_nightly_snapshots.yml
+++ b/.github/workflows/branch_deploy.yml
@@ -1,11 +1,13 @@
-name: "Release nightly snapshots"
on:
- schedule:
- - cron: '0 0 * * *'
+ push:
+ branches-ignore:
+ - master
+name: Build debug
jobs:
- deploy-release-snapshot:
+ generate-debug-build:
runs-on: ubuntu-latest
+ if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- name: Checkout repository
uses: actions/checkout@v1
@@ -15,6 +17,9 @@ jobs:
env:
ENCRYPT_KEY: ${{ secrets.ENCRYPT_KEY }}
+ - name: Copy CI gradle.properties
+ run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
+
- uses: actions/cache@v1
with:
path: ~/.gradle/caches
@@ -23,19 +28,15 @@ jobs:
- name: Download gradle dependencies
run: ./gradlew dependencies
- - name: Build release app
- run: ./gradlew :app:assembleRelease
- env:
- SNAPSHOT: "true"
+ - name: Build debug app
+ run: ./gradlew :app:assembleDebug
- name: Clean secrets
run: release/signing-cleanup.sh
- - name: Deploy snapshot
- run: release/deploy-snapshot.sh
+ - name: Send APK to Telegram
+ run: release/deploy-telegram.sh
env:
- ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
- SSH_USERNAME: ${{ secrets.SSH_USERNAME }}
- SERVER_ADDRESS: ${{ secrets.SERVER_ADDRESS }}
- SERVER_DESTINATION: ${{ secrets.SERVER_DESTINATION }}
- SSH_PORT: ${{ secrets.SSH_PORT }}
+ TG_TO: ${{ secrets.TELEGRAM_TO }}
+ TG_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
+ TG_FILE: ./app/build/outputs/apk/debug/app-debug.apk
diff --git a/.github/workflows/deploy_snapshot.yml b/.github/workflows/deploy_snapshot.yml
index 4c5bda07..e1f6abb7 100644
--- a/.github/workflows/deploy_snapshot.yml
+++ b/.github/workflows/deploy_snapshot.yml
@@ -17,6 +17,9 @@ jobs:
env:
ENCRYPT_KEY: ${{ secrets.ENCRYPT_KEY }}
+ - name: Copy CI gradle.properties
+ run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
+
- uses: actions/cache@v1
with:
path: ~/.gradle/caches
diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml
index 283699b9..9d4d1f07 100644
--- a/.github/workflows/pull_request.yml
+++ b/.github/workflows/pull_request.yml
@@ -8,12 +8,15 @@ jobs:
- uses: actions/checkout@master
+ - name: Copy CI gradle.properties
+ run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
+
- uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: gradle-${{ runner.os }}-${{ hashFiles('**/build.gradle') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/dependencies.gradle') }}
- - run: ./gradlew spotlessCheck build test lintDebug -Dpre-dex=false
+ - run: ./gradlew spotlessCheck assembleDebug testDebug lintDebug -Dpre-dex=false
- uses: actions/upload-artifact@master
with:
diff --git a/release/deploy-telegram.sh b/release/deploy-telegram.sh
new file mode 100755
index 00000000..79ae9458
--- /dev/null
+++ b/release/deploy-telegram.sh
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+
+function send_to_tg() {
+ local FILE
+ local CHAT_ID
+ local CAPTION
+ FILE="${1}"
+ CHAT_ID="${2}"
+ CAPTION="${3}"
+ curl -F chat_id="${CHAT_ID}" -F document="@${FILE}" -F caption="${CAPTION}" -F parse_mode="Markdown" "https://api.telegram.org/bot${TG_TOKEN:?}/sendDocument" >/dev/null 2>&1
+}
+
+send_to_tg "${TG_FILE:?}" "${TG_TO:?}" "aps-${GITHUB_RUN_NUMBER}-debug"