Skip to content

Commit fc4aed2

Browse files
authored
Merge pull request #42 from v2er-app/feature/github-actions-pipelines
2 parents 005bdbd + 6543b3a commit fc4aed2

25 files changed

+1042
-72
lines changed

.github/dependabot.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
version: 2
2+
updates:
3+
# Enable version updates for Gradle dependencies
4+
- package-ecosystem: "gradle"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
day: "monday"
9+
time: "09:00"
10+
open-pull-requests-limit: 10
11+
groups:
12+
# Group Kotlin-related dependencies
13+
kotlin:
14+
patterns:
15+
- "org.jetbrains.kotlin*"
16+
- "org.jetbrains.kotlinx*"
17+
# Group AndroidX dependencies (excluding Compose)
18+
androidx:
19+
patterns:
20+
- "androidx.*"
21+
exclude-patterns:
22+
- "androidx.compose.*"
23+
# Group testing dependencies
24+
testing:
25+
patterns:
26+
- "*junit*"
27+
- "*espresso*"
28+
- "*mockito*"
29+
- "*robolectric*"
30+
# Group networking dependencies
31+
networking:
32+
patterns:
33+
- "com.squareup.retrofit2*"
34+
- "com.squareup.okhttp3*"
35+
- "com.google.code.gson*"
36+
# Group RxJava dependencies
37+
rxjava:
38+
patterns:
39+
- "io.reactivex.rxjava2*"
40+
- "com.jakewharton.rxbinding2*"
41+
# Group Dagger dependencies
42+
dagger:
43+
patterns:
44+
- "com.google.dagger*"
45+
46+
# Enable version updates for GitHub Actions
47+
- package-ecosystem: "github-actions"
48+
directory: "/"
49+
schedule:
50+
interval: "weekly"
51+
day: "monday"
52+
time: "09:00"
53+
open-pull-requests-limit: 5

.github/workflows/android.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
permissions:
10+
contents: read
11+
checks: write
12+
pull-requests: write
13+
14+
jobs:
15+
test:
16+
name: Run Tests
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: Set up JDK 17
24+
uses: actions/setup-java@v4
25+
with:
26+
java-version: '17'
27+
distribution: 'temurin'
28+
cache: gradle
29+
30+
- name: Grant execute permission for gradlew
31+
run: chmod +x gradlew
32+
33+
- name: Run unit tests
34+
run: ./gradlew test --stacktrace
35+
36+
- name: Generate test report
37+
uses: dorny/test-reporter@v1
38+
if: success() || failure()
39+
with:
40+
name: Unit Test Results
41+
path: app/build/test-results/test*/TEST-*.xml
42+
reporter: java-junit
43+
44+
- name: Upload test results
45+
uses: actions/upload-artifact@v4
46+
if: always()
47+
with:
48+
name: test-results
49+
path: app/build/test-results/
50+
retention-days: 7
51+
52+
- name: Test Summary
53+
if: always()
54+
run: |
55+
echo "## Test Results Summary :test_tube:" >> $GITHUB_STEP_SUMMARY
56+
echo "" >> $GITHUB_STEP_SUMMARY
57+
58+
# Count test results
59+
if [ -d "app/build/test-results/" ]; then
60+
TOTAL=$(find app/build/test-results/ -name "TEST-*.xml" -exec grep -h "tests=" {} \; | sed 's/.*tests="\([0-9]*\)".*/\1/' | awk '{sum+=$1} END {print sum}')
61+
FAILURES=$(find app/build/test-results/ -name "TEST-*.xml" -exec grep -h "failures=" {} \; | sed 's/.*failures="\([0-9]*\)".*/\1/' | awk '{sum+=$1} END {print sum}')
62+
ERRORS=$(find app/build/test-results/ -name "TEST-*.xml" -exec grep -h "errors=" {} \; | sed 's/.*errors="\([0-9]*\)".*/\1/' | awk '{sum+=$1} END {print sum}')
63+
64+
echo "- Total tests: ${TOTAL:-0}" >> $GITHUB_STEP_SUMMARY
65+
echo "- Failures: ${FAILURES:-0}" >> $GITHUB_STEP_SUMMARY
66+
echo "- Errors: ${ERRORS:-0}" >> $GITHUB_STEP_SUMMARY
67+
else
68+
echo "No test results found" >> $GITHUB_STEP_SUMMARY
69+
fi
70+
71+
lint:
72+
name: Run Lint
73+
runs-on: ubuntu-latest
74+
75+
steps:
76+
- name: Checkout code
77+
uses: actions/checkout@v4
78+
79+
- name: Set up JDK 17
80+
uses: actions/setup-java@v4
81+
with:
82+
java-version: '17'
83+
distribution: 'temurin'
84+
cache: gradle
85+
86+
- name: Grant execute permission for gradlew
87+
run: chmod +x gradlew
88+
89+
- name: Run Android Lint
90+
run: ./gradlew lint --stacktrace
91+
92+
- name: Upload lint results
93+
uses: actions/upload-artifact@v4
94+
if: always()
95+
with:
96+
name: lint-results
97+
path: app/build/reports/lint-results-*.html
98+
retention-days: 7
99+
100+
- name: Lint Summary
101+
if: always()
102+
run: |
103+
echo "## Lint Results :mag:" >> $GITHUB_STEP_SUMMARY
104+
echo "" >> $GITHUB_STEP_SUMMARY
105+
if [ -f "app/build/reports/lint-results-debug.html" ]; then
106+
echo "Lint report generated. Check artifacts for details." >> $GITHUB_STEP_SUMMARY
107+
else
108+
echo "No lint report found" >> $GITHUB_STEP_SUMMARY
109+
fi
110+
111+
build:
112+
name: Build APK
113+
needs: [test, lint]
114+
runs-on: ubuntu-latest
115+
116+
steps:
117+
- name: Checkout code
118+
uses: actions/checkout@v4
119+
120+
- name: Set up JDK 17
121+
uses: actions/setup-java@v4
122+
with:
123+
java-version: '17'
124+
distribution: 'temurin'
125+
cache: gradle
126+
127+
- name: Grant execute permission for gradlew
128+
run: chmod +x gradlew
129+
130+
- name: Build debug APK
131+
run: ./gradlew assembleDebug --stacktrace
132+
133+
- name: Upload debug APK
134+
uses: actions/upload-artifact@v4
135+
with:
136+
name: debug-apk
137+
path: app/build/outputs/apk/debug/*.apk
138+
retention-days: 7
139+
140+
- name: Build Summary
141+
run: |
142+
echo "## Build Results :hammer:" >> $GITHUB_STEP_SUMMARY
143+
echo "" >> $GITHUB_STEP_SUMMARY
144+
145+
APK_PATH=$(find app/build/outputs/apk/debug -name "*.apk" | head -1)
146+
if [ -f "$APK_PATH" ]; then
147+
APK_SIZE=$(du -h "$APK_PATH" | cut -f1)
148+
echo "- APK Size: $APK_SIZE" >> $GITHUB_STEP_SUMMARY
149+
echo "- APK Path: \`${APK_PATH#app/build/outputs/}\`" >> $GITHUB_STEP_SUMMARY
150+
else
151+
echo "No APK found" >> $GITHUB_STEP_SUMMARY
152+
fi
153+
154+
instrumentation-test:
155+
name: Instrumentation Tests
156+
runs-on: ubuntu-latest
157+
strategy:
158+
matrix:
159+
api-level: [29, 33]
160+
161+
steps:
162+
- name: Checkout code
163+
uses: actions/checkout@v4
164+
165+
- name: Set up JDK 17
166+
uses: actions/setup-java@v4
167+
with:
168+
java-version: '17'
169+
distribution: 'temurin'
170+
cache: gradle
171+
172+
- name: Grant execute permission for gradlew
173+
run: chmod +x gradlew
174+
175+
- name: AVD cache
176+
uses: actions/cache@v4
177+
id: avd-cache
178+
with:
179+
path: |
180+
~/.android/avd/*
181+
~/.android/adb*
182+
key: avd-${{ matrix.api-level }}
183+
184+
- name: Create AVD and generate snapshot for caching
185+
if: steps.avd-cache.outputs.cache-hit != 'true'
186+
uses: reactivecircus/android-emulator-runner@v2
187+
with:
188+
api-level: ${{ matrix.api-level }}
189+
force-avd-creation: false
190+
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
191+
disable-animations: false
192+
script: echo "Generated AVD snapshot for caching."
193+
194+
- name: Run instrumentation tests
195+
uses: reactivecircus/android-emulator-runner@v2
196+
with:
197+
api-level: ${{ matrix.api-level }}
198+
force-avd-creation: false
199+
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
200+
disable-animations: true
201+
script: |
202+
# Check if there are any instrumentation tests
203+
if ./gradlew tasks --all | grep -q "connectedAndroidTest"; then
204+
./gradlew connectedAndroidTest --stacktrace
205+
else
206+
echo "No instrumentation tests found"
207+
fi
208+
209+
- name: Upload instrumentation test results
210+
uses: actions/upload-artifact@v4
211+
if: always()
212+
with:
213+
name: instrumentation-test-results-${{ matrix.api-level }}
214+
path: app/build/reports/androidTests/connected/
215+
retention-days: 7

0 commit comments

Comments
 (0)