-
Notifications
You must be signed in to change notification settings - Fork 19
/
Makefile
85 lines (69 loc) · 4.21 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
.PHONY: base64-secret-to-file build-test check-env help create-sample-release-bundle create-testing-apks lint prepare-ci run-github-workflow-locally test-android-firebase test-android-firebase-emulator release-to-sonatype prepare-sample-release
.DEFAULT_GOAL := help
SHELL := /bin/bash
ifneq (,$(wildcard .env))
include .env
export
endif
REQUIRED_VARS := $(shell cat .env.example | sed 's/=.*//' | xargs)
check-env:
@MISSING_VARS=""; \
for var in $(REQUIRED_VARS); do \
if [ -z "$${!var+x}" ]; then \
MISSING_VARS="$$MISSING_VARS $$var"; \
fi; \
done; \
if [ -n "$$MISSING_VARS" ]; then \
echo "Missing environment variables:$$MISSING_VARS"; \
echo "Please set them in your .env file or as system environment variables. Check https://secret.emarsys.net/cred/detail/18243/"; \
exit 1; \
fi
help: check-env ## Show this help
@echo "Targets:"
@fgrep -h "##" $(MAKEFILE_LIST) | grep ":" | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/\(.*\):.*##[ \t]*/ \1 ## /' | sort | column -t -s '##'
@echo
base64-secret-to-file: check-env ## decode base64 secret to path
@./gradlew base64EnvToFile -PpropertyName=$(SECRET) -Pfile=$(FILE)
build-test: check-env ## builds android tests excluding and lint
@./gradlew clean assembleAndroidTest -x lint
create-testing-apks: check-env ## create apks for testing
@./gradlew assembleAndroidTest -x :sample:test
create-sample-release-bundle: check-env ## create sample app release bundle
@./gradlew :sample:bundleRelease
create-sample-release-apk: check-env ## create sample app release bundle
@./gradlew :sample:assembleRelease
lint: check-env ## run lint
@./gradlew lint
prepare-ci: check-env ## setup prerequisites for pipeline
@echo $ANDROID_HOME > local.properties
@./gradlew base64EnvToFile -PpropertyName=GOOGLE_SERVICES_JSON_BASE64 -Pfile=./sample/google-services.json
prepare-release: check-env ## setup prerequisites for release
@./gradlew base64EnvToFile -PpropertyName=SONATYPE_SIGNING_SECRET_KEY_RING_FILE_BASE64 -Pfile=./secring.asc.gpg
prepare-sample-release: check-env ## prepares .jks file for sample release
@./gradlew base64EnvToFile -PpropertyName=ANDROID_RELEASE_STORE_FILE_BASE64 -Pfile=sample/mobile-team-android.jks \
&& ./gradlew base64EnvToFile -PpropertyName=GOOGLE_PLAY_STORE_SEVICE_ACCOUNT_JSON_BASE64 -Pfile=sample/google-play-store-service-account.json
test-android-firebase-emulator: check-env ## run Android Instrumented tests on emulators on Firebase Test Lab
@gcloud firebase test android run \
--type instrumentation \
--app ./sample/build/outputs/apk/androidTest/debug/sample-debug-androidTest.apk \
--test ./$(MODULE_NAME)/build/outputs/apk/androidTest/debug/$(MODULE_NAME)-debug-androidTest.apk \
--device model=Pixel2.arm,version=28,locale=en,orientation=portrait \
--device model=MediumPhone.arm,version=30,locale=en,orientation=portrait \
--device model=SmallPhone.arm,version=33,locale=en,orientation=portrait \
--client-details matrixLabel="Android Emarsys SDK - virtual devices"
test-android-firebase: check-env ## run Android Instrumented tests on real devices on Firebase Test Lab
@gcloud firebase test android run \
--type instrumentation \
--app ./sample/build/outputs/apk/androidTest/debug/sample-debug-androidTest.apk \
--test ./$(MODULE_NAME)/build/outputs/apk/androidTest/debug/$(MODULE_NAME)-debug-androidTest.apk \
--device model=redfin,version=30,locale=en,orientation=portrait \
--device model=q2q,version=31,locale=en,orientation=portrait \
--device model=oriole,version=32,locale=en,orientation=portrait \
--device model=felix,version=33,locale=en,orientation=portrait \
--client-details matrixLabel="Android Emarsys SDK - physical devices"
run-github-workflow-locally: check-env ## needs act to be installed: `brew install act` and docker running. Pass in workflow path to run
@act --secret-file ./workflow.secrets -W $(WORKFLOW_PATH) --container-architecture linux/amd64
release: check-env prepare-release prepare-sample-release ## release to sonatype
@./gradlew assembleRelease && ./gradlew publishToSonatype
release-locally: check-env prepare-release prepare-sample-release ## release to mavenLocal
@./gradlew assembleRelease && ./gradlew publishToMavenLocal