Merge pull request #38 from min486/feature/unit-test #8
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 Build | |
| on: | |
| push: | |
| branches: | |
| - develop # develop 브랜치에 push 될 때 실행 | |
| pull_request: | |
| branches: | |
| - develop # develop 브랜치로 PR이 열리거나 업데이트 될 때 실행 | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest # 워크플로우를 실행할 가상 환경 | |
| env: | |
| GOOGLE_SERVICES_BASE64: ${{ secrets.GOOGLE_SERVICES_BASE64 }} | |
| KAKAO_NATIVE_APP_KEY: ${{ secrets.KAKAO_NATIVE_APP_KEY }} | |
| NAVER_CLIENT_ID: ${{ secrets.NAVER_CLIENT_ID }} | |
| NAVER_CLIENT_SECRET: ${{ secrets.NAVER_CLIENT_SECRET }} | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 # GitHub 저장소 코드를 워크스페이스로 가져오기 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Make gradlew executable | |
| run: chmod +x ./gradlew # gradlew 파일에 실행 권한 부여 | |
| - name: Decode Google Services File | |
| run: echo "$GOOGLE_SERVICES_BASE64" | base64 -d > app/google-services.json | |
| # Secrets를 사용하여 local.properties 파일 생성 | |
| - name: Create local.properties for CI | |
| run: | | |
| echo "kakao.native.app.key=$KAKAO_NATIVE_APP_KEY" > local.properties | |
| echo "naver.client.id=$NAVER_CLIENT_ID" >> local.properties | |
| echo "naver.client.secret=$NAVER_CLIENT_SECRET" >> local.properties | |
| # Unit Test 실행 | |
| - name: Run Unit Tests | |
| run: ./gradlew testDebugUnitTest | |
| # 테스트 결과 저장 | |
| - name: Upload Test Results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results | |
| path: app/build/reports/tests/testDebugUnitTest | |
| retention-days: 7 | |
| - name: Build Debug APK | |
| run: ./gradlew assembleDebug # 디버그 APK 빌드 명령어 실행 | |
| # 빌드된 APK 아티팩트 저장 | |
| - name: Upload APK Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dngo-app-debug | |
| path: app/build/outputs/apk/debug/app-debug.apk | |
| retention-days: 90 |