Skip to content

⚡ background data refresh #153

⚡ background data refresh

⚡ background data refresh #153

Workflow file for this run

name: Build
on:
push:
branches: [ main ] # Build on merge or push on main branch
pull_request:
types: [ opened, synchronize, reopened, ready_for_review ] # Check on Pull Request interactions
jobs:
build-and-test:
name: ⚙️ Build, Lint and Test
runs-on: macos-latest
if: ${{ !github.event.pull_request.draft }}
timeout-minutes: 30
steps:
- name: ❌ Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.11.0
with:
access_token: ${{ github.token }}
- name: 🛎️ Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: 🏭 Set up our JDK environment
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '17'
- name: 🏭 Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
# Decode Google services configuration file from secrets
- name: 🔐 Decode google-services.json
env:
FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }}
run: echo $FIREBASE_CONFIG > app/google-services.json
- name: 🏭 Setup Gradle
uses: gradle/gradle-build-action@v2
- name: 🔨 Build
run: ./gradlew assembleDebug --scan
# Run emulator
- name: 🧪 Run integration test on emulator
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
script: ./gradlew rootCoverageReport --stacktrace
# Generate jacoco report
- name: 🔍 Inspect code with SonarQube
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew sonarqube --info
- name: 📜 Upload build reports
uses: actions/upload-artifact@v3
with:
name: build-reports
path: build/reports/
retention-days: 7
if-no-files-found: warn
- name: 📋 Test report
uses: dorny/test-reporter@v1
if: success() || failure() # run this step even if previous step failed
with:
name: 🧪 Tests results
path: '**/TEST-*.xml'
reporter: java-junit
static-analysis:
name: Execute analyse on code
continue-on-error: true
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.draft }}
timeout-minutes: 30
steps:
- name: ❌ Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.11.0
with:
access_token: ${{ github.token }}
- name: 🛎️ Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: 🏭 Set up our JDK environment
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '17'
# Decode Google services configuration file from secrets
- name: 🔐 Decode google-services.json
env:
FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }}
run: echo $FIREBASE_CONFIG > app/google-services.json
- name: 🏭 Setup Gradle
uses: gradle/gradle-build-action@v2
# Check the code with detekt, you can remove this job if you don't use detekt
- name: 👀 Run detekt Linter
run: ./gradlew detekt
# Check the code with Android linter (need assemble)
- name: 👀 Run Android Linter
run: ./gradlew lint
# Check the code with Spotless (ktlint included)
- name: 👀 Run Spotless
run: ./gradlew spotlessCheck
generate-release-apk:
name: Try generate Releasable
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.draft }}
environment: Release
timeout-minutes: 30
needs:
- build-and-test
steps:
- name: ❌ Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.11.0
with:
access_token: ${{ github.token }}
- name: 🛎️ Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: 🏭 Set up our JDK environment
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '17'
# Decode Google services configuration file from secrets
- name: 🔐 Decode google-services.json
env:
FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }}
run: echo $FIREBASE_CONFIG > app/google-services.json
- name: 🔐 Decode Keystore
env:
ENCODED_STRING: ${{ secrets.KEYSTORE }}
run: |
TMP_KEYSTORE_FILE_PATH="${RUNNER_TEMP}"/keystore
mkdir "${TMP_KEYSTORE_FILE_PATH}"
echo $ENCODED_STRING | base64 -di > "${TMP_KEYSTORE_FILE_PATH}"/keystore_file.jks
- name: 🏭 Setup Gradle
uses: gradle/gradle-build-action@v2
- name: 🔨️ Build Release
run: ./gradlew app:assembleRelease
env:
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
# Upload unsigned release APK
- name: 📦 Upload apks
uses: actions/upload-artifact@v3
with:
name: apk
path: |
**/release/*.apk
**/release/*.aab
retention-days: 5