-
Notifications
You must be signed in to change notification settings - Fork 4
126 lines (110 loc) · 3.75 KB
/
Copy pathqa.yml
File metadata and controls
126 lines (110 loc) · 3.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
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: Cache Gradle
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-detekt-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-detekt-
${{ runner.os }}-gradle-
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
cache-disabled: true
- 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: Cache Gradle
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-build-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-build-
${{ runner.os }}-gradle-
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
cache-disabled: true
- 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'