fix:(spotlessApplyによる修正) #34
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 | |
| on: | |
| push: | |
| branches: [ "main", "master" ] | |
| pull_request: | |
| branches: [ "main", "master" ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| # cache: gradle <-- setup-gradle に任せるため、ここでは削除 | |
| # ★ Added: Gradle公式アクション(高度なキャッシュ管理と最適化) | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v3 | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x ./gradlew | |
| # 1. Spotless (コードスタイル) | |
| - name: Check Spotless | |
| run: ./gradlew spotlessCheck --stacktrace | |
| # 2. Lint (静的解析) | |
| - name: Run Lint | |
| run: ./gradlew :app:lintDebug --stacktrace | |
| - name: Upload Lint Reports | |
| if: always() # 失敗してもレポートは残す | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: lint-report | |
| path: app/build/reports/lint/ | |
| # 3. Unit Test (単体テスト) | |
| - name: Run Unit Tests | |
| run: ./gradlew :app:testDebugUnitTest --stacktrace | |
| - name: Upload Test Reports | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-report | |
| # ★ Changed: XMLだけでなく、人間が見やすいHTMLレポートのパスを指定 | |
| path: app/build/reports/tests/testDebugUnitTest/ | |
| # 4. Assemble (ビルド検証) | |
| # ★ Added: Lint/Testが通ってもビルドがコケる場合があるため、APK生成もチェックする | |
| - name: Build Debug APK | |
| run: ./gradlew :app:assembleDebug |