Skip to content

add widget

add widget #539

Workflow file for this run

name: Build and Test
on:
push:
branches: [ main, beta ]
pull_request:
branches: [ main, beta ]
jobs:
build:
name: Build and Test
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1
with:
egress-policy: audit
- name: Checkout the code to specific branch
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
distribution: 'zulu'
java-version: '21'
- name: Setup Android SDK
uses: android-actions/setup-android@9fc6c4e9069bf8d3d10b2204b1fb8f6ef7065407 # v3.2.2
- name: Cache Gradle packages
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Cache SonarQube packages
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
if: ${{ github.secret_source == 'Actions' }}
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Run static analysis (Detekt)
run: ./gradlew detekt
- name: Run code formatting check (ktlint)
run: ./gradlew ktlintCheck
- name: Upload Detekt reports
if: always()
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: detekt-reports
path: |
build/reports/detekt/
app/build/reports/detekt/
- name: Upload ktlint reports
if: always()
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: ktlint-reports
path: app/build/reports/ktlint/
- name: Build and analyze
if: ${{ github.secret_source != 'Actions' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
run: |
echo "Secret source: \"${{ github.secret_source }}\""
./gradlew build jacocoTestReport
- name: Build and analyze (Sonar)
if: ${{ github.secret_source == 'Actions' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew build jacocoTestReport sonar
- name: Upload build artifacts
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: build
path: app/build/outputs
if-no-files-found: "error"
- name: Generate app bundle.
run: ./gradlew build app:bundleRelease --stacktrace