testing the cache working after the previous merge #26
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: QA | |
| on: | |
| push: | |
| branches: [main, develop] | |
| pull_request: | |
| branches: [main, develop] | |
| workflow_dispatch: | |
| jobs: | |
| # this checks the code quality very quickly | |
| detekt: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v3 | |
| - name: Run Detekt | |
| run: ./gradlew detekt | |
| # here we test and build the app in the same github runner so that no extra runner is used and saves time in setting up the environment again during build | |
| test-and-build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| #caches the gradle builds and tests and hence skip unit tests and builds for unchanged modules saving a lot of time | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v3 | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Inject Mock Google Services JSON | |
| run: | | |
| echo '{ | |
| "project_info": { | |
| "project_number": "1", | |
| "project_id": "mock-project-id", | |
| "storage_bucket": "mock-project-id.appspot.com" | |
| }, | |
| "client": [ | |
| { | |
| "client_info": { | |
| "mobilesdk_app_id": "1", | |
| "android_client_info": { | |
| "package_name": "com.deepfakeshield" | |
| } | |
| }, | |
| "api_key": [ | |
| { | |
| "current_key": "mock-api-key" | |
| } | |
| ] | |
| } | |
| ] | |
| }' > app/google-services.json | |
| - name: Generate Dummy Keystore | |
| run: | | |
| keytool -genkey -v -keystore release.keystore -alias mock-alias -keyalg RSA -keysize 2048 -validity 10000 -storepass mock-password -keypass mock-password -dname "CN=Mock, OU=Mock, O=Mock, L=Mock, S=Mock, C=Mock" | |
| - name: Run Unit Tests | |
| run: ./gradlew testReleaseUnitTest --info | |
| - name: Build Release APK | |
| env: | |
| RELEASE_BUILD: "1" | |
| KEYSTORE_PASSWORD: "mock-password" | |
| KEYSTORE_FILE: "../release.keystore" | |
| KEY_ALIAS: "mock-alias" | |
| KEY_PASSWORD: "mock-password" | |
| run: ./gradlew assembleRelease -x uploadCrashlyticsMappingFileRelease | |
| - name: Upload Test Report | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: test-report | |
| path: '**/build/reports/tests/testReleaseUnitTest/' | |
| - name: Upload Release APK | |
| uses: actions/upload-artifact@v4 | |
| if: success() | |
| with: | |
| name: release-apk | |
| path: '**/build/outputs/apk/release/*.apk' |