Refactor flavours (#17)

- Fastlane completed
 - Circleci config completed
 - Flavours build completed
This commit is contained in:
2023-08-07 20:17:08 +01:00
committed by GitHub
parent 4a37b724a6
commit baabebd40d
121 changed files with 1326 additions and 1586 deletions

View File

@@ -14,18 +14,17 @@ commands:
description: checkout repo and android dependencies
steps:
- checkout
- restore_cache:
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
- run:
name: Chmod permissions
command: sudo chmod +x ./gradlew
- android/restore-gradle-cache
build_gradle:
description: Build the gradle
steps:
- 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
- android/save-gradle-cache
run_tests:
description: run tests for flavour specified
parameters:
@@ -33,14 +32,17 @@ commands:
type: string
default: "AtlasWeather"
steps:
# The next step will run the unit tests
- android/run-tests:
test-command: ./gradlew test<< parameters.flavour >>DebugUnitTest --continue
- store_artifacts:
path: app/build/reports
destination: reports
- store_test_results:
path: app/build/test-results
# The next step will run the unit tests
- build_gradle
- run:
name: Run non-instrumentation unit tests
command: |
./gradlew test<< parameters.flavour >>DebugUnitTest --continue
- store_artifacts:
path: app/build/reports
destination: reports
- store_test_results:
path: app/build/test-results
run_ui_tests:
description: run tests for flavour specified
parameters:
@@ -48,27 +50,47 @@ commands:
type: string
default: "AtlasWeather"
steps:
- 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/com.appttude.h_mal.atlas_weather/files/screengrab/en-US/images/screenshots ~/screenshots
when: on_fail
# 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
- build_gradle
- 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-26;google_apis;x86
pull-data: true
pull-data-path: /storage/emulated/0/Android/data/
pull-data-target: ~/app-data
restore-gradle-cache-prefix: v1a
# store test reports
- store_artifacts:
path: app/build/reports/androidTests/connected
destination: reports
# store screenshots for failed ui tests
- store_artifacts:
path: ~/app-data
destination: screenshots
- store_test_results:
path: app/build/outputs/androidTest-results/connected
deploy_to_play_store:
description: deploy to playstore based on flavour
parameters:
flavour:
type: string
default: "AtlasWeather"
steps:
# The next step will run the unit tests
- android/decode-keystore:
keystore-location: "./app/keystore.jks"
- run:
name: Setup playstore key
command: |
echo "$GOOGLE_PLAY_KEY" > "google-play-key.json"
- build_gradle
- run:
name: Run fastlane command to deploy to playstore
command: |
pwd
bundle exec fastlane deploy<< parameters.flavour >>
- store_test_results:
path: fastlane/report.xml
# Define a job to be invoked later in a workflow.
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
jobs:
@@ -90,54 +112,60 @@ jobs:
- setup_repo
- run_tests:
flavour: << parameters.flavour >>
ui-test-and-release:
# Parameters used for determining
- run_ui_tests:
flavour: << parameters.flavour >>
deploy-to-playstore:
parameters:
flavour:
type: string
default: "AtlasWeather"
executor:
name: android/android-machine
tag: 2023.05.1
default: "Driver"
docker:
- image: cimg/android:2023.07-browsers
auth:
username: ${DOCKER_USERNAME}
password: ${DOCKER_PASSWORD}
steps:
- setup_repo
- run_ui_tests
- 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 >>
- deploy_to_play_store:
flavour: << parameters.flavour >>
# Invoke jobs via workflows
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
workflows:
version: 2
build-release-mono:
jobs:
- build-and-test:
context: appttude
flavour: "MonoWeather"
filters:
branches:
ignore:
- main_atlas
- deploy-to-playstore:
context: appttude
flavour: "MonoWeather"
filters:
branches:
only:
- main_mono
requires:
- build-and-test
build-release-atlas:
jobs:
- build-and-test:
context: appttude
flavour: "AtlasWeather"
- ui-test-and-release:
filters:
branches:
ignore:
- main_mono
- deploy-to-playstore:
context: appttude
flavour: "AtlasWeather"
filters:
branches:
only:
- main_atlas
requires:
- build-and-test
build-release-mono:
jobs:
- build-and-test:
flavour: "MonoWeather"
- ui-test-and-release:
flavour: "MonoWeather"
filters:
branches:
only: main_admin
requires:
- build-and-test