Android CI/CD #96
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: Android CI/CD | |
on: | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build project | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v3 | |
- run: | | |
echo "${{ secrets.KEYSTORE }}" > keystore.jks.asc | |
gpg -d --passphrase "${{ secrets.KEYSTORE_PASSPHRASE }}" --batch keystore.jks.asc > keystore.jks | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Gradle Wrapper Validation | |
uses: gradle/wrapper-validation-action@v1 | |
- name: Cache Gradle | |
uses: actions/cache@v3.0.2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle-. | |
- name: Configure Keystore | |
env: | |
KEYSTORE_KEY_ALIAS: ${{ secrets.KEYSTORE_KEY_ALIAS }} | |
KEYSTORE_KEY_PASSWORD: ${{ secrets.KEYSTORE_KEY_PASSWORD }} | |
KEYSTORE_STORE_PASSWORD: ${{ secrets.KEYSTORE_STORE_PASSWORD }} | |
run: | | |
echo "storeFile=keystore.jks" >> keystore.properties | |
echo "keyAlias=$KEYSTORE_KEY_ALIAS" >> keystore.properties | |
echo "storePassword=$KEYSTORE_STORE_PASSWORD" >> keystore.properties | |
echo "keyPassword=$KEYSTORE_KEY_PASSWORD" >> keystore.properties | |
- name: Build application | |
run: ./gradlew build --full-stacktrace | |
- name: Test | |
run: ./gradlew testDebugUnitTest --full-stacktrace | |
- name: Publish Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
if: always() | |
with: | |
files: "**/build/test-results/**/*.xml" |