Updated to circleci (#31)

circleci config.yml updated
This commit is contained in:
2023-07-29 17:46:08 +01:00
committed by GitHub
parent ff9777fb78
commit fa7ad37398
6 changed files with 46 additions and 70 deletions

View File

@@ -20,34 +20,29 @@ commands:
git config --global user.email "$GIT_EMAIL" git config --global user.email "$GIT_EMAIL"
git config --global user.name "$GIT_EMAIL" git config --global user.name "$GIT_EMAIL"
git subtree add --prefix=driver_app_data https://github.com/hmalik144/driver_app_data main git subtree add --prefix=driver_app_data https://github.com/hmalik144/driver_app_data main
- restore_cache: - android/restore-gradle-cache
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
- run:
name: Chmod permissions
command: sudo chmod +x ./gradlew
- run: - run:
name: Download Dependencies name: Download Dependencies
command: ./gradlew androidDependencies command: |
- save_cache: sudo chmod +x ./gradlew
paths: ./gradlew androidDependencies
- ~/.gradle
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
# Setup files for build. # Setup files for build.
- run: - run:
name: Setup variables for build name: Setup variables for build
command: | command: |
echo "$GOOGLE_SERVICES_KEY" > "app/google-services.json" echo "$GOOGLE_SERVICES_KEY" > "app/google-services.json"
run_tests: run_tests:
description: run tests for flavour specified description: run non-instrumentation tests for flavour specified
parameters: parameters:
flavour: flavour:
type: string type: string
default: "Driver" default: "Driver"
steps: steps:
# The next step will run the unit tests # The next step will run the unit tests
- android/run-tests: - run:
test-command: ./gradlew test<< parameters.flavour >>DebugUnitTest --continue name: Run non-instrumentation unit tests
command: |
./gradlew test<< parameters.flavour >>DebugUnitTest --continue
- store_artifacts: - store_artifacts:
path: app/build/reports path: app/build/reports
destination: reports destination: reports
@@ -69,39 +64,35 @@ commands:
name: Install firebase tools name: Install firebase tools
command: | command: |
curl -sL firebase.tools | bash curl -sL firebase.tools | bash
# Save cache for firebase tools
- save_cache:
paths:
- .firebase/emulator
- ~/.cache/firebase/emulators/
key: emulator-cache-v1-{{ epoch }}
# Then start firebase emulator in the background
- run:
name: Start firebase emulator
command: |
firebase emulators:start --import=driver_app_data/export_directory
background: true
# Then start the emulator and run the Instrumentation tests! # Then start the emulator and run the Instrumentation tests!
- android/start-emulator-and-run-tests: - android/start-emulator-and-run-tests:
post-emulator-launch-assemble-command: ./gradlew assemble<< parameters.flavour >>DebugAndroidTest post-emulator-launch-assemble-command: ./gradlew assemble<< parameters.flavour >>DebugAndroidTest
test-command: ./gradlew connected<< parameters.flavour >>DebugAndroidTest test-command: ./gradlew connected<< parameters.flavour >>DebugAndroidTest
system-image: system-images;android-25;google_apis;x86 system-image: system-images;android-25;google_apis;x86
max-tries: 1 pull-data: true
kill-emulators: false pull-data-path: /storage/emulated/0/Android/data/
pull-data-target: ~/app-data
pre-emulator-wait-steps:
# Start firebase emulator in the background while waiting to start testing
- run: - run:
name: Pull screenshots from device name: Start firebase emulator and while avd starts
command: | command: |
mkdir ~/screenshots firebase emulators:start --import=driver_app_data/export_directory
adb pull /storage/emulated/0/Android/data/h_mal.appttude.com.driver.admin/files/screengrab/en-US/images/screenshots ~/screenshots background: true
when: on_fail post-run-tests-steps:
# Save cache for firebase tools
- save_cache:
paths:
- ~/.cache/firebase/emulators/
key: emulator-cache-v1-{{ epoch }}
# store test reports # store test reports
- store_artifacts: - store_artifacts:
path: app/build/reports/androidTests/connected path: app/build/reports/androidTests/connected
destination: reports destination: reports
# store screenshots for failed ui tests # store screenshots for failed ui tests
- store_artifacts: - store_artifacts:
path: ~/screenshots path: ~/app-data
destination: screenshots destination: data
# Then publish the artifacts of the Firebase emulator logs! # Then publish the artifacts of the Firebase emulator logs!
- run: - run:
name: save firebase emulator logs name: save firebase emulator logs
@@ -138,29 +129,6 @@ jobs:
flavour: << parameters.flavour >> flavour: << parameters.flavour >>
- run_ui_tests: - run_ui_tests:
flavour: << parameters.flavour >> flavour: << parameters.flavour >>
# Assemble
assemble-and-release:
# Parameters used for determining
parameters:
flavour:
type: string
default: "Driver"
executor:
name: android/android-machine
tag: 2023.05.1
steps:
- setup_repo
- run:
name: Setup variables for release
command: |
echo "$RELEASE_KEYSTORE_BASE64" | base64 --decode > "android/app/release_keystore.jks"
echo "$GOOGLE_PLAY_KEY" > "android/playstore.json"
# And finally run the release build
- run:
name: Assemble and Upload to PlayStore
command: |
pwd
bundle exec fastlane deploy<< parameters.flavour >>
# Invoke jobs via workflows # Invoke jobs via workflows
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows # See: https://circleci.com/docs/2.0/configuration-reference/#workflows
workflows: workflows:
@@ -169,22 +137,29 @@ workflows:
jobs: jobs:
- build-and-test: - build-and-test:
flavour: "Driver" flavour: "Driver"
- assemble-and-release: - android/deploy-to-play-store:
flavour: "Driver"
filters: filters:
branches: branches:
only: only:
- main_driver - main_driver
requires: requires:
- build-and-test - build-and-test
executor:
name: android/android-machine
tag: 2023.05.1
lane-name: deployDriver
build-release-admin: build-release-admin:
jobs: jobs:
- build-and-test: - build-and-test:
flavour: "Admin" flavour: "Admin"
- assemble-and-release: - android/deploy-to-play-store:
flavour: "Admin"
filters: filters:
branches: branches:
only: main_admin only:
- main_driver
requires: requires:
- build-and-test - build-and-test
executor:
name: android/android-machine
tag: 2023.05.1
lane-name: deployAdmin

3
.gitignore vendored
View File

@@ -21,7 +21,8 @@ local
/.circleci/run_local.bash /.circleci/run_local.bash
# Gem/fastlane # Gem/fastlane
/Gemfile.lock /Gemfile.lock
/playstore.json /google-play-key.json
/app/google-services.json
/fastlane/report.xml /fastlane/report.xml
# Firebase emulator # Firebase emulator
database-debug.log database-debug.log

View File

@@ -9,7 +9,6 @@ plugins {
def relStorePassword = System.getenv("RELEASE_STORE_PASSWORD") def relStorePassword = System.getenv("RELEASE_STORE_PASSWORD")
def relKeyPassword = System.getenv("RELEASE_KEY_PASSWORD") def relKeyPassword = System.getenv("RELEASE_KEY_PASSWORD")
def relKeyAlias = System.getenv("RELEASE_KEY_ALIAS") def relKeyAlias = System.getenv("RELEASE_KEY_ALIAS")
def relStoreFile = System.getenv("RELEASE_KEYSTORE")
android { android {
compileSdkVersion 31 compileSdkVersion 31
@@ -41,7 +40,7 @@ android {
storePassword relStorePassword storePassword relStorePassword
keyPassword relKeyPassword keyPassword relKeyPassword
keyAlias relKeyAlias keyAlias relKeyAlias
storeFile file(relStoreFile) storeFile file('./keystore')
} }
} }

View File

@@ -33,12 +33,12 @@ platform :android do
desc "Deploy a new version of Driver to the Google Play" desc "Deploy a new version of Driver to the Google Play"
lane :deployDriver do lane :deployDriver do
gradle(task: "clean bundle", flavor: "driver", build_type: "Release") gradle(task: "clean bundle", flavor: "driver", build_type: "Release")
upload_to_play_store(aab: "app/build/outputs/bundle/driverRelease/app-driver-release.aab", json_key: "playstore.json", package_name: "h_mal.appttude.com.driver") upload_to_play_store(aab: "app/build/outputs/bundle/driverRelease/app-driver-release.aab", json_key: "google-play-key.json", package_name: "h_mal.appttude.com.driver")
end end
desc "Deploy a new version of Admin to the Google Play" desc "Deploy a new version of Admin to the Google Play"
lane :deployAdmin do lane :deployAdmin do
gradle(task: "clean bundle", flavor: "admin", build_type: "Release") gradle(task: "clean bundle", flavor: "admin", build_type: "Release")
upload_to_play_store(aab: "app/build/outputs/bundle/adminRelease/app-admin-release.aab", json_key: "playstore.json", package_name: "h_mal.appttude.com.driver.admin") upload_to_play_store(aab: "app/build/outputs/bundle/adminRelease/app-admin-release.aab", json_key: "google-play-key.json", package_name: "h_mal.appttude.com.driver.admin")
end end
end end

View File

@@ -10,6 +10,7 @@ org.gradle.jvmargs=-Xmx1536m
android.useAndroidX=true android.useAndroidX=true
android.enableJetifier=true android.enableJetifier=true
kotlin.code.style=official kotlin.code.style=official
org.gradle.caching=true
# When configured, Gradle will run in incubating parallel mode. # When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit # This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects

0
gradlew vendored Normal file → Executable file
View File