[REFACTOR] BaseViewModel 걷어내고 Orbit MVI 자체 기능 사용하기 #220
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: Orbit CI | |
| on: | |
| pull_request: | |
| branches: [develop] | |
| paths: | |
| - 'app/**' | |
| - 'build.gradle' | |
| - '**/*.kt' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Gradle Cache | |
| - name: Cache Gradle packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('gradle.properties', '**/*.gradle*', '**/gradle-wrapper.properties') }} | |
| restore-keys: | | |
| ${{ runner.os }}-gradle- | |
| # Checkout Code | |
| - name: Checkout the code | |
| uses: actions/checkout@v4 | |
| # Setup JDK | |
| - name: Setup JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'corretto' | |
| java-version: '17' | |
| # Setup Android SDK | |
| - name: Setup Android SDK | |
| uses: android-actions/setup-android@v3 | |
| # Grant Execute Permission | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| # Decode google-services.json for debug | |
| - name: Decode google-services.json (debug) | |
| env: | |
| FIREBASE_SECRET: ${{ secrets.FIREBASE_SECRET_DEBUG }} | |
| run: | | |
| mkdir -p app/src/dev | |
| echo $FIREBASE_SECRET | base64 --decode > app/src/dev/google-services.json | |
| # Decode google-services.json for release | |
| - name: Decode google-services.json (release) | |
| env: | |
| FIREBASE_SECRET: ${{ secrets.FIREBASE_SECRET_RELEASE }} | |
| run: echo $FIREBASE_SECRET | base64 --decode > app/google-services.json | |
| # Add Local Properties | |
| - name: Add Local Properties | |
| env: | |
| BASE_URL: ${{ secrets.BASE_URL }} | |
| AMPLITUDE_API_KEY: ${{ secrets.AMPLITUDE_API_KEY }} | |
| ADMOB_APP_ID_DEBUG: ${{ secrets.ADMOB_APP_ID_DEBUG }} | |
| ADMOB_APP_ID_RELEASE: ${{ secrets.ADMOB_APP_ID_RELEASE }} | |
| ADMOB_AD_UNIT_ID_DEBUG: ${{ secrets.ADMOB_AD_UNIT_ID_DEBUG }} | |
| ADMOB_AD_UNIT_ID_RELEASE: ${{ secrets.ADMOB_AD_UNIT_ID_RELEASE }} | |
| run: | | |
| echo -e "baseUrl=$BASE_URL" > local.properties | |
| echo -e "amplitudeApiKey=$AMPLITUDE_API_KEY" >> local.properties | |
| echo -e "admobAppIdDebug=$ADMOB_APP_ID_DEBUG" >> local.properties | |
| echo -e "admobAppIdRelease=$ADMOB_APP_ID_RELEASE" >> local.properties | |
| echo -e "admobAdUnitIdDebug=$ADMOB_AD_UNIT_ID_DEBUG" >> local.properties | |
| echo -e "admobAdUnitIdRelease=$ADMOB_AD_UNIT_ID_RELEASE" >> local.properties | |
| # Debug Local Properties Check | |
| - name: Debug Local Properties | |
| run: cat local.properties | |
| # Run Lint and Build | |
| - name: Run lint and build | |
| run: ./gradlew ktlintCheck assembleDebug | |
| # Run Unit Test and Generate Coverage | |
| - name: Run unit tests and generate coverage | |
| run: ./gradlew generateTestCoverageReport | |
| # Upload Coverage Report | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: data/build/reports/coverage/test/debug/ | |
| # Comment PR with coverage result | |
| - name: Comment coverage report in PR | |
| if: github.event_name == 'pull_request' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| COMMENT="🚀 테스트 완료 및 커버리지 리포트가 생성되었습니다.\n\n➡️ [클릭하여 커버리지 리포트 다운로드](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})" | |
| curl -s -H "Authorization: token $GITHUB_TOKEN" \ | |
| -X POST \ | |
| -d "{\"body\": \"$COMMENT\"}" \ | |
| "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments" |