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