Add CI report creation #21
Workflow file for this run
This file contains hidden or 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 | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: "temurin" | |
| java-version: "17" | |
| - name: Cache Gradle | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/*.gradle.kts', '**/gradle-wrapper.properties') }} | |
| restore-keys: | | |
| ${{ runner.os }}-gradle- | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x ./gradlew | |
| - name: Run unit tests | |
| run: ./gradlew testDebugUnitTest | |
| - name: Run Android Lint | |
| run: ./gradlew lintDebug | |
| - name: Upload Lint Report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: lint-report | |
| path: app/build/reports/lint-results-debug.html | |
| - name: Run Detekt | |
| run: ./gradlew detekt || true | |
| - name: Setup reviewdog | |
| uses: reviewdog/action-setup@v1 | |
| - name: Reviewdog (Detekt SARIF) | |
| if: github.event_name == 'pull_request' | |
| env: | |
| REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| reviewdog \ | |
| -f=sarif \ | |
| -name="detekt" \ | |
| -reporter=github-pr-review \ | |
| -filter-mode=diff_context \ | |
| -fail-level=any \ | |
| < app/build/reports/detekt/detekt.sarif | |
| - name: Detekt PR Comment | |
| if: failure() && github.event_name == 'pull_request' | |
| uses: marocchino/sticky-pull-request-comment@v2 | |
| with: | |
| header: detekt-report | |
| path: app/build/reports/detekt/detekt.txt | |
| - name: Lint PR Comment | |
| if: failure() && github.event_name == 'pull_request' | |
| uses: marocchino/sticky-pull-request-comment@v2 | |
| with: | |
| header: lint-report | |
| path: app/build/reports/lint-results-debug.txt | |
| - name: Build Debug APK | |
| run: ./gradlew assembleDebug |