(General) Bump version to 1.3.0 #132
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build & Test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Gradle cache | |
uses: gradle/gradle-build-action@v2 | |
- name: set up JDK | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- name: Cache Gradle packages | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'buildSrc/src/main/kotlin/*') }} | |
- name: Build, lint and spotless | |
run: ./gradlew spotlessCheck assemble assembleAndroidTest lintDebug | |
- name: Cleanup Gradle Cache | |
run: | | |
rm -f ~/.gradle/caches/modules-2/modules-2.lock | |
rm -f ~/.gradle/caches/modules-2/gc.properties | |
test: | |
runs-on: macOS-latest | |
needs: build | |
timeout-minutes: 60 | |
strategy: | |
fail-fast: false | |
matrix: | |
api-level: [ 29 ] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: set up JDK | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- name: Cache Gradle packages | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'buildSrc/src/main/kotlin/*') }} | |
- name: Build tests | |
run: ./gradlew assembleDebugAndroidTest | |
- name: Run functional tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ matrix.api-level }} | |
sdcard-path-or-size: 50M | |
profile: Nexus 6P | |
script: ./gradlew connectedCheck --exclude-task app:connectedCheck | |
- name: Upload functional test results | |
if: always() | |
uses: actions/upload-artifact@v2 | |
with: | |
name: test-results-functional-${{ matrix.api-level }} | |
path: "**/build/outputs/*/connected/*.xml" | |
- name: Cleanup Gradle Cache | |
run: | | |
rm -f ~/.gradle/caches/modules-2/modules-2.lock | |
rm -f ~/.gradle/caches/modules-2/gc.properties | |
# | |
# apk: | |
# name: Generate and Deploy APK | |
# runs-on: ubuntu-latest | |
# needs: | |
# - test | |
# steps: | |
# - name: Checkout Code | |
# uses: actions/checkout@v2 | |
# | |
# - name: Set up JDK 11 | |
# uses: actions/setup-java@v1 | |
# with: | |
# java-version: 11 | |
# | |
# - name: Build APK | |
# run: ./gradlew assembleDebug --stacktrace | |
# | |
# - name: Generate Hash of New APK | |
# id: hash_new_apk | |
# run: | | |
# apk_hash=$(sha256sum app/sample.apk | awk '{print $1}') | |
# echo "::set-output name=hash::$apk_hash" | |
# | |
# - name: Download Hash of Previous APK | |
# id: download_hash | |
# uses: actions/download-artifact@v2 | |
# with: | |
# name: previous_apk_hash | |
# path: previous_apk_hash.txt | |
# if: always() | |
# | |
# - name: Compare Hashes | |
# id: compare_hashes | |
# run: | | |
# if [ ! -f "previous_apk_hash.txt" ]; then | |
# echo "No previous APK hash found. Continuing..." | |
# elif [ "$(cat previous_apk_hash.txt)" = "${{ steps.hash_new_apk.outputs.hash }}" ]; then | |
# echo "APK has not changed. Exiting." | |
# exit 0 | |
# fi | |
# echo "${{ steps.hash_new_apk.outputs.hash }}" > previous_apk_hash.txt | |
# | |
# - name: Rename and Move APK | |
# run: | | |
# mv app/build/outputs/apk/debug/app-debug.apk app/sample.apk | |
# | |
# - name: Upload APK | |
# uses: actions/upload-artifact@v2 | |
# with: | |
# name: sample.apk | |
# path: app/sample.apk | |
# | |
# - name: Create Pull Request | |
# uses: peter-evans/create-pull-request@v3 | |
# with: | |
# token: ${{ secrets.GITHUB_TOKEN }} | |
# commit-message: "(General) Update sample APK" | |
# title: "(General) Update sample APK" | |
# branch: "apk-update" | |
# body: | | |
# This pull request updates the sample APK. | |
# | |
# ``` | |
# Version code: ${{ steps.version.outputs.version_code }} | |
# Version name: ${{ steps.version.outputs.version_name }} | |
# ``` | |
# | |
# - name: Clean up artifacts | |
# if: ${{ always() }} | |
# run: | | |
# rm -f previous_apk_hash.txt | |
# echo "Deleted previous_apk_hash.txt" | |
# echo "Deleting sample APK..." | |
# curl -X DELETE -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "${{ github.api_url }}/repos/${{ github.repository }}/actions/artifacts/sample.apk" |