|
| 1 | +name: GLPI Android Inventory Library CI |
| 2 | + |
| 3 | +env: |
| 4 | + module_app: app |
| 5 | + |
| 6 | +on: |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - "develop" |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v3 |
| 16 | + - name: set up JDK 11 |
| 17 | + uses: actions/setup-java@v3 |
| 18 | + with: |
| 19 | + java-version: '11' |
| 20 | + distribution: 'temurin' |
| 21 | + cache: gradle |
| 22 | + |
| 23 | + |
| 24 | + ############################################## |
| 25 | + # Prepare / Build project APK / AAR / JAR # |
| 26 | + ############################################## |
| 27 | + # Grant execute permission for gradlew |
| 28 | + - name: Grant execute permission for gradlew |
| 29 | + run: chmod +x gradlew |
| 30 | + # Build app |
| 31 | + - name: Build with Gradle |
| 32 | + run: ./gradlew build |
| 33 | + # Create APK For Firebase Instrumentation Tests |
| 34 | + - name: Build Debug Test APK (for Firebase Test Lab) |
| 35 | + run: ./gradlew assembleDebugAndroidTest |
| 36 | + |
| 37 | + ################################################################################################ |
| 38 | + # Run Firebase Test Lab # |
| 39 | + # See : https://medium.com/firebase-developers/github-actions-firebase-test-lab-4bc830685a99 # |
| 40 | + # See : https://github.com/google-github-actions/auth # |
| 41 | + # See : https://github.com/google-github-actions/setup-gcloud # |
| 42 | + ################################################################################################ |
| 43 | + # Login to Google using Firebase Admin SDK Service Agent Key |
| 44 | + - id: 'auth' |
| 45 | + name: Login to Google Cloud |
| 46 | + uses: 'google-github-actions/auth@v1' |
| 47 | + with: |
| 48 | + credentials_json: ${{ secrets.GCP_CREDENTIALS }} |
| 49 | + |
| 50 | + # Set up Cloud SDK |
| 51 | + - name: 'Set up Cloud SDK' |
| 52 | + uses: 'google-github-actions/setup-gcloud@v1' |
| 53 | + |
| 54 | + # Set Firebase Project ID |
| 55 | + - name: Set current project |
| 56 | + run: gcloud config set project ${{ secrets.FIREBASE_PROJECT_ID }} |
| 57 | + |
| 58 | + # Run Instrumentation Tests in Firebase Test Lab |
| 59 | + - name: Run Instrumentation Tests in Firebase Test Lab |
| 60 | + run: gcloud firebase test android run --type instrumentation --app ${{ env.module_app }}/build/outputs/apk/debug/${{ env.module_app }}-debug.apk --test ${{ env.module_app }}/build/outputs/apk/androidTest/debug/${{ env.module_app }}-debug-androidTest.apk --device model=Nexus6,version=25,locale=en,orientation=portrait |
| 61 | + |
| 62 | + |
| 63 | + ########################################## |
| 64 | + # Upload Artifacts (APK / AAR / JAR) # |
| 65 | + ########################################## |
| 66 | + # Upload APK for Java version |
| 67 | + - name: Upload APK Debug for Java |
| 68 | + uses: actions/upload-artifact@v3 |
| 69 | + with: |
| 70 | + name: Java-Debug-APK |
| 71 | + path: ${{ env.module_app }}/build/outputs/apk/debug/${{ env.module_app }}-debug.apk |
| 72 | + |
| 73 | + |
0 commit comments