aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2021-09-12 01:01:06 -0700
committerGitHub <noreply@github.com>2021-09-12 01:01:06 -0700
commit771676db9f4fb3cf525b8f40fb1d7b1dbac59405 (patch)
tree25ac56b1d229ff30dca49d1b6bfe9af459f7452f
parent8b82044c8573e8115d81e3289c8b7e3bf0016584 (diff)
downloadfrost-771676db9f4fb3cf525b8f40fb1d7b1dbac59405.tar.gz
frost-771676db9f4fb3cf525b8f40fb1d7b1dbac59405.tar.bz2
frost-771676db9f4fb3cf525b8f40fb1d7b1dbac59405.zip
Github actions (#1797)
* Add android workflow * Test without dynamic artifact name * Add back spotless ktlint version * Always decrypt secret * Ignore ci for l10n_dev [skip ci] * Rename test asset * Use github run number var * Test github context var * Add legacy build release * Test step 1 * Test next steps * Test prev version step * Partial test * Partial test * Partial test * Partial test * Partial test * Partial test * Partial test * Partial test * Partial test * Partial test * Partial test * Partial test * Partial test * Partial test * Partial test * Partial test * Partial test * Partial test * Partial test * Partial test * Partial test * Partial test * Partial test * Enable full flow * Test build * Test build * Full release v2 * Use pitched apps email * Echo release link [skip ci] * Fix should release
-rw-r--r--.github/workflows/android.yml173
-rw-r--r--files/.gitignore3
-rw-r--r--files/frost_github.tar.gpgbin0 -> 4468 bytes
-rw-r--r--files/github_actions.sh9
-rw-r--r--spotless.gradle3
5 files changed, 187 insertions, 1 deletions
diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml
new file mode 100644
index 00000000..1d2db150
--- /dev/null
+++ b/.github/workflows/android.yml
@@ -0,0 +1,173 @@
+name: Android CI
+
+on:
+ push:
+ branches:
+ - '*'
+ - '!l10n_dev'
+
+jobs:
+ build:
+
+# if: ${{ false }}
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ with:
+ fetch-depth: 100
+
+ - name: Fetch all tags
+ run: git fetch origin +refs/tags/*:refs/tags/*
+
+ - name: Set up JDK 11
+ uses: actions/setup-java@v2
+ with:
+ java-version: '11'
+ java-package: jdk
+ distribution: 'adopt'
+ cache: gradle
+
+ - name: Validate gradle wrapper
+ uses: gradle/wrapper-validation-action@v1
+
+ - name: Decrypt secret
+ run: |
+ gpg -d --passphrase "${{ secrets.FROST_TAR_SECRET }}" --batch "files/frost_github.tar.gpg" > "files/frost_github.tar"
+ tar xvf files/frost_github.tar -C files
+
+ - name: Checkout Gradle Build Cache
+ if: ${{ steps.self_hosted.outputs.FLAG != 'self-hosted' }}
+ uses: actions/cache@v2
+ with:
+ path: |
+ ~/.gradle/caches
+ ~/.gradle/wrapper
+ !~/.gradle/wrapper/dists/**/gradle*.zip
+ key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
+ restore-keys: |
+ gradle-${{ runner.os }}-
+
+ - name: Grant execute permission for gradlew
+ run: chmod +x gradlew
+
+ - name: Android Git Version
+ run: ./gradlew --quiet androidGitVersion
+
+ - name: Check and Test
+ run: ./gradlew spotlessCheck lintReleaseTest testReleaseUnitTest
+
+ - name: Assemble
+ run: ./gradlew assembleReleaseTest
+
+ - name: Upload Test APK
+ uses: actions/upload-artifact@v2.2.4
+ with:
+ name: Frost-releaseTest.apk
+ path: app/build/outputs/apk/releaseTest/Frost-releaseTest.apk
+ if-no-files-found: error
+
+ # Tests artifact upload
+ build-test:
+
+ if: ${{ false }}
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Create
+ run: |
+ mkdir apk
+ echo "apk test" > apk/Frost-releaseTest.apk
+
+ - name: Upload Test APK
+ uses: actions/upload-artifact@v2.2.4
+ with:
+ name: Frost-releaseTest.apk
+ path: apk/Frost-releaseTest.apk
+ if-no-files-found: error
+
+ release-test:
+
+ runs-on: ubuntu-latest
+
+ needs: build
+
+ env:
+ GITHUB_TOKEN: ${{ secrets.TEST_RELEASE_GITHUB_API_TOKEN }}
+ OWNER: AllanWang
+ REPO: Frost-for-Facebook-APK-Builder
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ with:
+ repository: "${{ env.OWNER }}/${{ env.REPO }}"
+ token: ${{ env.GITHUB_TOKEN }}
+
+ # Contiguous to release IDs from Travis builds
+ - name: Current Version
+ run: |
+ CURR_ID=$(( ${{ github.run_number }} + 2914 ))
+ echo "RELEASE_ID_NUMBER=${CURR_ID}" >> $GITHUB_ENV
+
+ - name: Should Release
+ run: |
+ PREV_ID=$(cat Frost.txt | grep -o -E '[0-9]'+)
+ SHOULD_RELEASE=$( if [[ ${{ env.RELEASE_ID_NUMBER }} -gt $PREV_ID ]]; then; echo true; else; echo false; fi; )
+ echo "Prev $PREV_ID Now ${{ env.RELEASE_ID_NUMBER }} Should Release $SHOULD_RELEASE"
+ echo "SHOULD_RELEASE=${SHOULD_RELEASE}" >> $GITHUB_ENV
+
+ - name: Update File
+ if: ${{ env.SHOULD_RELEASE }}
+ run: echo "Frost v${{ env.RELEASE_ID_NUMBER }}" > Frost.txt
+
+ - name: Create Commit
+ if: ${{ env.SHOULD_RELEASE }}
+ id: create_commit
+ uses: EndBug/add-and-commit@v7
+ with:
+ message: 'Github Action ${{ env.RELEASE_ID_NUMBER }} [skip ci]'
+ tag: 'v${{ env.RELEASE_ID_NUMBER }}'
+ author_name: Pitched Apps CI
+ author_email: pitchedapps@gmail.com
+ branch: master
+ push: true
+
+ # After commit
+ - name: Download APK
+ uses: actions/download-artifact@v2
+ with:
+ name: Frost-releaseTest.apk
+
+ - name: Rename APK
+ run: |
+ mv Frost-releaseTest.apk Frost-releaseTest-v${{ env.RELEASE_ID_NUMBER }}.apk
+ ls -l
+
+ - name: Create Release
+ if: ${{ env.SHOULD_RELEASE && steps.create_commit.outputs.pushed }}
+ uses: ncipollo/release-action@v1
+ with:
+ token: ${{ env.GITHUB_TOKEN }}
+ owner: ${{ env.OWNER }}
+ repo: ${{ env.REPO }}
+ artifactErrorsFailBuild: true
+ artifacts: "Frost-releaseTest-v${{ env.RELEASE_ID_NUMBER }}.apk"
+ artifactContentType: "application/zip"
+ body: |
+ Automatic Release v${{ env.RELEASE_ID_NUMBER }} for branch `${{ github.ref }}`
+ https://github.com/${{ github.repository }}/commit/${{ github.sha }}
+ tag: 'v${{ env.RELEASE_ID_NUMBER }}'
+ allowUpdates: false
+
+ - name: Echo Result
+ run: echo "Created release at https://github.com/${{ env.OWNER }}/${{ env.REPO }}/releases/tag/v${{ env.RELEASE_ID_NUMBER }}"
+
+
+
+
+
+
diff --git a/files/.gitignore b/files/.gitignore
index 812c710e..d5e6b79c 100644
--- a/files/.gitignore
+++ b/files/.gitignore
@@ -3,3 +3,6 @@ release.properties
test.keystore
test.properties
update-dev.sh
+
+frost.tar
+frost_github.tar
diff --git a/files/frost_github.tar.gpg b/files/frost_github.tar.gpg
new file mode 100644
index 00000000..81d327df
--- /dev/null
+++ b/files/frost_github.tar.gpg
Binary files differ
diff --git a/files/github_actions.sh b/files/github_actions.sh
new file mode 100644
index 00000000..9cfa4fff
--- /dev/null
+++ b/files/github_actions.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+
+# Add appropriate files for encryption
+# https://docs.github.com/en/actions/reference/encrypted-secrets#limits-for-secrets
+
+rm frost_github.tar.gpg
+tar cvf frost_github.tar release.keystore release.properties test.keystore test.properties
+gpg --symmetric --cipher-algo AES256 frost_github.tar
+rm frost_github.tar \ No newline at end of file
diff --git a/spotless.gradle b/spotless.gradle
index ea95c38f..72104ac0 100644
--- a/spotless.gradle
+++ b/spotless.gradle
@@ -3,7 +3,8 @@ apply plugin: "com.diffplug.spotless"
spotless {
kotlin {
target "**/*.kt"
- ktlint().userData(["disabled_rules": "no-wildcard-imports"])
+ // https://github.com/pinterest/ktlint/releases
+ ktlint("0.41.0").userData(["disabled_rules": "no-wildcard-imports"])
licenseHeaderFile '../spotless.license.kt'
trimTrailingWhitespace()
endWithNewline()