From bea3cd5457e331f04a9aeb5c99267f14908f5eaa Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Tue, 25 Feb 2020 15:22:05 +0530 Subject: 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 Co-authored-by: Aditya Wasan --- .github/ci-gradle.properties | 6 ++++ .github/workflows/branch_deploy.yml | 42 ++++++++++++++++++++++++++ .github/workflows/deploy_nightly_snapshots.yml | 41 ------------------------- .github/workflows/deploy_snapshot.yml | 3 ++ .github/workflows/pull_request.yml | 5 ++- 5 files changed, 55 insertions(+), 42 deletions(-) create mode 100644 .github/ci-gradle.properties create mode 100644 .github/workflows/branch_deploy.yml delete mode 100644 .github/workflows/deploy_nightly_snapshots.yml (limited to '.github') 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/branch_deploy.yml b/.github/workflows/branch_deploy.yml new file mode 100644 index 00000000..7b681ab7 --- /dev/null +++ b/.github/workflows/branch_deploy.yml @@ -0,0 +1,42 @@ +on: + push: + branches-ignore: + - master + +name: Build debug +jobs: + generate-debug-build: + runs-on: ubuntu-latest + if: "!contains(github.event.head_commit.message, '[ci skip]')" + steps: + - name: Checkout repository + uses: actions/checkout@v1 + + - name: Decrypt secrets + run: release/signing-setup.sh "$ENCRYPT_KEY" + 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 + key: gradle-${{ runner.os }}-${{ hashFiles('**/build.gradle') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/dependencies.gradle') }} + + - name: Download gradle dependencies + run: ./gradlew dependencies + + - name: Build debug app + run: ./gradlew :app:assembleDebug + + - name: Clean secrets + run: release/signing-cleanup.sh + + - name: Send APK to Telegram + run: release/deploy-telegram.sh + env: + 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_nightly_snapshots.yml b/.github/workflows/deploy_nightly_snapshots.yml deleted file mode 100644 index 57effc96..00000000 --- a/.github/workflows/deploy_nightly_snapshots.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: "Release nightly snapshots" -on: - schedule: - - cron: '0 0 * * *' - -jobs: - deploy-release-snapshot: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v1 - - - name: Decrypt secrets - run: release/signing-setup.sh "$ENCRYPT_KEY" - env: - ENCRYPT_KEY: ${{ secrets.ENCRYPT_KEY }} - - - uses: actions/cache@v1 - with: - path: ~/.gradle/caches - key: gradle-${{ runner.os }}-${{ hashFiles('**/build.gradle') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/dependencies.gradle') }} - - - name: Download gradle dependencies - run: ./gradlew dependencies - - - name: Build release app - run: ./gradlew :app:assembleRelease - env: - SNAPSHOT: "true" - - - name: Clean secrets - run: release/signing-cleanup.sh - - - name: Deploy snapshot - run: release/deploy-snapshot.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 }} 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: -- cgit v1.2.3