Skip to content

Commit f908981

Browse files
Merge branch 'Pin_Layout_v6' of https://github.com/samruddhi-Rahegaonkar/pslab-android into Pin_Layout_v6
2 parents 75944dc + acfd78d commit f908981

40 files changed

+1206
-258
lines changed
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: "Screenshots Workflow"
2+
3+
inputs:
4+
ANDROID_EMULATOR_API:
5+
description: 'Emulator API to be used when running tests'
6+
required: false
7+
default: 34
8+
ANDROID_EMULATOR_ARCH:
9+
description: 'Emulator architecture to be used when running tests'
10+
required: false
11+
default: x86_64
12+
13+
runs:
14+
using: "composite"
15+
steps:
16+
- name: Setup Java
17+
uses: actions/setup-java@v3
18+
with:
19+
distribution: 'adopt'
20+
java-version: '17'
21+
22+
- name: Build APKs
23+
shell: bash
24+
run: |
25+
./gradlew assembleDebug assembleAndroidTest --stacktrace
26+
27+
- name: Enable KVM group perms
28+
shell: bash
29+
run: |
30+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
31+
sudo udevadm control --reload-rules
32+
sudo udevadm trigger --name-match=kvm
33+
34+
- name: Cache AVD
35+
uses: actions/cache@v4
36+
id: avd-cache
37+
with:
38+
path: |
39+
~/.android/avd/*
40+
~/.android/adb*
41+
key: avd-${{ inputs.ANDROID_EMULATOR_API }}-${{ inputs.ANDROID_EMULATOR_ARCH }}
42+
43+
- name: Create AVD and Cache Snapshot
44+
if: steps.avd-cache.outputs.cache-hit != 'true'
45+
uses: reactivecircus/[email protected]
46+
with:
47+
api-level: ${{ inputs.ANDROID_EMULATOR_API }}
48+
arch: ${{ inputs.ANDROID_EMULATOR_ARCH }}
49+
profile: pixel_6
50+
avd-name: pixel_6
51+
force-avd-creation: false
52+
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
53+
disable-animations: false
54+
script: echo "Generated AVD snapshot for caching."
55+
56+
- name: Setup Ruby
57+
uses: ruby/setup-ruby@v1
58+
with:
59+
ruby-version: '3.3'
60+
bundler-cache: true
61+
62+
- name: Prepare Bundler
63+
shell: bash
64+
run: |
65+
bundle config path vendor/bundle
66+
bundle install --jobs 4 --retry 3
67+
68+
- name: Setup Fastlane
69+
shell: bash
70+
run: |
71+
git clone --branch=fastlane-android --depth=1 https://${{ github.repository_owner }}:${{ github.token }}@github.com/${{ github.repository }} fastlane
72+
73+
- name: Create Android Screenshots
74+
uses: reactivecircus/[email protected]
75+
with:
76+
api-level: ${{ inputs.ANDROID_EMULATOR_API }}
77+
arch: ${{ inputs.ANDROID_EMULATOR_ARCH }}
78+
profile: pixel_6
79+
avd-name: pixel_6
80+
force-avd-creation: false
81+
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
82+
disable-animations: true
83+
script: |
84+
bundle exec fastlane screengrab || exit 1
85+
86+
- name: Upload Screenshots
87+
uses: actions/upload-artifact@v4
88+
with:
89+
name: Android Screenshots
90+
path: fastlane/metadata/android/en-US/images/phoneScreenshots

.github/workflows/pull-request.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
- master
77
- development
88

9+
env:
10+
ANDROID_EMULATOR_API: 34
11+
ANDROID_EMULATOR_ARCH: x86_64
12+
913
jobs:
1014
build:
1115
runs-on: ubuntu-latest
@@ -25,7 +29,7 @@ jobs:
2529
mkdir -p ./pr
2630
echo ${{ github.event.number }} > ./pr/NR
2731
28-
- uses: actions/upload-artifact@v3
32+
- uses: actions/upload-artifact@v4
2933
with:
3034
name: pr
3135
path: pr/
@@ -35,8 +39,20 @@ jobs:
3539
bash ./gradlew build --stacktrace
3640
3741
- name: Store APK file
38-
uses: actions/upload-artifact@v3
42+
uses: actions/upload-artifact@v4
3943
with:
4044
name: apk-files
4145
path: |
42-
app/build/outputs/apk/debug/app-debug.apk
46+
app/build/outputs/apk/debug/app-debug.apk
47+
48+
screenshots:
49+
name: Screenshots
50+
runs-on: ubuntu-latest
51+
steps:
52+
- uses: actions/checkout@v4
53+
54+
- name: Android Screenshot Workflow
55+
uses: ./.github/actions/screenshot-android
56+
with:
57+
ANDROID_EMULATOR_API: ${{ env.ANDROID_EMULATOR_API }}
58+
ANDROID_EMULATOR_ARCH: ${{ env.ANDROID_EMULATOR_ARCH }}

.github/workflows/push-event.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ on:
88

99
env:
1010
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11+
ANDROID_EMULATOR_API: 34
12+
ANDROID_EMULATOR_ARCH: x86_64
1113

1214
jobs:
1315
build:
@@ -149,7 +151,7 @@ jobs:
149151
- name: Update app in Open Testing track
150152
if: ${{ github.repository == 'fossasia/pslab-android' }}
151153
run: |
152-
git clone --branch=fastlane --depth=1 https://${{ github.repository_owner }}:${{ github.token }}@github.com/${{ github.repository }} fastlane
154+
git clone --branch=fastlane-android --depth=1 https://${{ github.repository_owner }}:${{ github.token }}@github.com/${{ github.repository }} fastlane
153155
bundle exec fastlane uploadToOpenTesting
154156
if [[ $? -ne 0 ]]; then
155157
exit 1
@@ -164,4 +166,16 @@ jobs:
164166
- name: Create and Upload Assets
165167
run: |
166168
echo "${{ steps.android-version.outputs.VERSION_CODE }}" > ./versionCode.txt
167-
gh release upload ${{ steps.run-release-drafter.outputs.tag_name }} apk/pslab-development-release.apk ./versionCode.txt --clobber
169+
gh release upload ${{ steps.run-release-drafter.outputs.tag_name }} apk/pslab-development-release.apk ./versionCode.txt --clobber
170+
171+
screenshots:
172+
name: Screenshots
173+
runs-on: ubuntu-latest
174+
steps:
175+
- uses: actions/checkout@v4
176+
177+
- name: Android Screenshot Workflow
178+
uses: ./.github/actions/screenshot-android
179+
with:
180+
ANDROID_EMULATOR_API: ${{ env.ANDROID_EMULATOR_API }}
181+
ANDROID_EMULATOR_ARCH: ${{ env.ANDROID_EMULATOR_ARCH }}

.github/workflows/release.yml

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66

77
env:
88
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9+
ANDROID_EMULATOR_API: 34
10+
ANDROID_EMULATOR_ARCH: x86_64
911

1012
jobs:
1113
release:
@@ -16,17 +18,6 @@ jobs:
1618
- name: Download repository
1719
uses: actions/checkout@v4
1820

19-
- name: Setup Ruby
20-
uses: ruby/setup-ruby@v1
21-
with:
22-
ruby-version: '3.3'
23-
bundler-cache: true
24-
25-
- name: Prepare Bundler
26-
run: |
27-
bundle config path vendor/bundle
28-
bundle install --jobs 4 --retry 3
29-
3021
- name: Prepare Build Keys
3122
env:
3223
ENCRYPTED_F10B5E0E5262_IV: ${{ secrets.ENCRYPTED_F10B5E0E5262_IV }}
@@ -41,20 +32,25 @@ jobs:
4132
read -r version_code < versionCode.txt
4233
echo "VERSION_CODE=$version_code" >> $GITHUB_OUTPUT
4334
44-
- name: Add Changelogs to fastlane branch
45-
run: |
4635
git config --global user.name "github-actions[bot]"
4736
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
48-
49-
git clone --branch=fastlane --depth=1 https://${{ github.repository_owner }}:${{ github.token }}@github.com/${{ github.repository }} fastlane
37+
38+
- name: Android Screenshot Workflow
39+
uses: ./.github/actions/screenshot-android
40+
with:
41+
ANDROID_EMULATOR_API: ${{ env.ANDROID_EMULATOR_API }}
42+
ANDROID_EMULATOR_ARCH: ${{ env.ANDROID_EMULATOR_ARCH }}
43+
44+
- name: Add Changelogs to fastlane branch
45+
run: |
5046
cd fastlane
5147
5248
echo "${{ github.event.release.body }}" > metadata/android/en-US/changelogs/${{ steps.download-assets.outputs.VERSION_CODE }}.txt
5349
5450
# Force push to fastlane branch
5551
git checkout --orphan temporary
5652
git add --all .
57-
git commit -am "[Auto] Add changelogs for versionCode: ${{ steps.download-assets.outputs.VERSION_CODE }} ($(date +%Y-%m-%d.%H:%M:%S))"
53+
git commit -am "[Auto] Update metadata for versionCode: ${{ steps.download-assets.outputs.VERSION_CODE }} ($(date +%Y-%m-%d.%H:%M:%S))"
5854
git branch -D fastlane
5955
git branch -m fastlane
6056
git push --force origin fastlane

app/build.gradle.kts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,16 @@ val GITHUB_BUILD = System.getenv("GITHUB_ACTIONS") == "true" && KEYSTORE_FILE.ex
1010

1111
android {
1212
namespace = "io.pslab"
13-
compileSdk = 34
13+
compileSdk = 35
1414

1515
defaultConfig {
1616
applicationId = "io.pslab"
1717
minSdk = 24
18-
targetSdk = 34
18+
targetSdk = 35
1919
versionCode = System.getenv("VERSION_CODE")?.toInt() ?: 1
2020
versionName = System.getenv("VERSION_NAME") ?: "1.0.0"
2121
resourceConfigurations += setOf("en", "ru", "ar", "si", "pl")
22+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
2223
}
2324

2425
signingConfigs {
@@ -65,7 +66,7 @@ dependencies {
6566
// Android stock libraries
6667
implementation("androidx.appcompat:appcompat:1.7.0")
6768
implementation("androidx.cardview:cardview:1.0.0")
68-
implementation("androidx.recyclerview:recyclerview:1.3.2")
69+
implementation("androidx.recyclerview:recyclerview:1.4.0")
6970
implementation("com.google.android.material:material:1.12.0")
7071
implementation("androidx.preference:preference:1.2.1")
7172
implementation("androidx.browser:browser:1.8.0")
@@ -98,6 +99,12 @@ dependencies {
9899

99100
// OKHTTP
100101
implementation("com.squareup.okhttp3:okhttp:4.12.0")
102+
androidTestImplementation("tools.fastlane:screengrab:2.1.1")
103+
androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1")
104+
androidTestImplementation("androidx.test.uiautomator:uiautomator:2.3.0")
105+
androidTestImplementation("androidx.test.ext:junit:1.2.1")
106+
androidTestImplementation("androidx.test.espresso:espresso-contrib:3.6.1")
107+
androidTestImplementation("androidx.test:rules:1.6.1")
101108

102109
// ButterKnife
103110
val butterKnifeVersion = "10.2.3"

0 commit comments

Comments
 (0)