Skip to content

major version bump #402

major version bump

major version bump #402

name: CI Workflow
# Run this workflow every time a new commit pushed to your repository
on: push
jobs:
unit-tests:
name: Run Unit Tests
runs-on: macos-latest
steps:
# Checks out a copy of your repository on the ubuntu-latest machine
- name: Checkout code
uses: actions/checkout@v2
# Set up Java JDK
- name: Setup JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
# Get the secrets from GitHub and add them to local.properties
# https://blog.jakelee.co.uk/accessing-android-app-secret-from-github-actions-using-gradle/
- name: Access PLATFORM_CLIENT_ID
env:
PLATFORM_CLIENT_ID: ${{ secrets.PLATFORM_CLIENT_ID }}
run: echo PLATFORM_CLIENT_ID=\"$PLATFORM_CLIENT_ID\" >> ./local.properties
- name: Access PLATFORM_REDIRECT_URI
env:
PLATFORM_REDIRECT_URI: ${{ secrets.PLATFORM_REDIRECT_URI }}
run: echo PLATFORM_REDIRECT_URI=\"$PLATFORM_REDIRECT_URI\" >> ./local.properties
# Run unit tests
- name: Run Unit Tests
run: ./gradlew testDebugUnitTest
# If tests pass, generate and upload APK
generate-apk:
name: Generate apk
runs-on: ubuntu-latest
needs: unit-tests
# Generate APK only if we are pushing to master or pushing a new release tag
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Setup JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
# Get the secrets from GitHub and add them to local.properties
- name: Access PLATFORM_CLIENT_ID
env:
PLATFORM_CLIENT_ID: ${{ secrets.PLATFORM_CLIENT_ID }}
run: echo PLATFORM_CLIENT_ID=\"$PLATFORM_CLIENT_ID\" >> ./local.properties
- name: Access PLATFORM_REDIRECT_URI
env:
PLATFORM_REDIRECT_URI: ${{ secrets.PLATFORM_REDIRECT_URI }}
run: echo PLATFORM_REDIRECT_URI=\"$PLATFORM_REDIRECT_URI\" >> ./local.properties
# Generate Signed APK
- name: Generate Release APK
run: ./gradlew assembleRelease
- name: Sign app APK
uses: r0adkll/sign-android-release@v1
# ID used to access action output
id: sign_app
with:
releaseDirectory: PennMobile/build/outputs/apk/release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
# Upload signed APK
- uses: actions/upload-artifact@v2
with:
name: release.apk
path: ${{steps.sign_app.outputs.signedReleaseFile}}
code-cov:
name: JaCoCo Code Coverage
# Set the type of machine to run on, macOS is better for running Android emulators
runs-on: macos-latest
needs: unit-tests
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Setup JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
# Get the secrets from GitHub and add them to local.properties
- name: Access PLATFORM_CLIENT_ID
env:
PLATFORM_CLIENT_ID: ${{ secrets.PLATFORM_CLIENT_ID }}
run: echo PLATFORM_CLIENT_ID=\"$PLATFORM_CLIENT_ID\" >> ./local.properties
- name: Access PLATFORM_REDIRECT_URI
env:
PLATFORM_REDIRECT_URI: ${{ secrets.PLATFORM_REDIRECT_URI }}
run: echo PLATFORM_REDIRECT_URI=\"$PLATFORM_REDIRECT_URI\" >> ./local.properties
# Run JaCoCo, generate Test Report
- name: Check Code Coverage
run: ./gradlew jacocoTestReport --stacktrace
# Upload reports to GitHub Actions
- name: Upload Reports
uses: actions/upload-artifact@v1
with:
name: reports
path: PennMobile/build/reports
# Publish to Firebase App Distribution
deploy-firebase:
needs: generate-apk
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@master
with:
name: release.apk
- name: Upload APK to Firebase App Distribution
uses: wzieba/Firebase-Distribution-Github-Action@v1
with:
appId: ${{secrets.FIREBASE_APP_ID}}
token: ${{secrets.FIREBASE_TOKEN}}
groups: tester
file: PennMobile-release-unsigned-signed.apk
# Publish to Play Store test track
deploy-play-store:
needs: generate-apk
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@master
with:
name: release.apk
- name: Publish to Play Store internal test track
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
packageName: com.pennapps.labs.pennmobile
releaseFiles: PennMobile-release-unsigned-signed.apk
track: internal
status: completed
# userFraction: 0.50