-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconfig.yml
153 lines (142 loc) · 4.81 KB
/
config.yml
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# Android CircleCI 2.0 configuration file
#
version: 2.1
orbs:
android: circleci/[email protected]
commands:
add_google_services:
steps:
- run:
name: Write dummy google-services.json
command: |
echo '{"project_info":{"project_number":"xxx","project_id":"xxx"},"client":[{"client_info":{"mobilesdk_app_id":"xxx","android_client_info":{"package_name":"io.karte.tracker_sample"}},"api_key":[{"current_key":"xxx"}]}]}' > examples/sample_java/google-services.json
cp examples/sample_java/google-services.json examples/sample_kotlin/google-services.json
run_build:
steps:
- run:
name: Download Dependencies
command: ./gradlew androidDependencies
- run:
name: Build modules
command: ./gradlew --stacktrace assembleDebug assembleRelease --parallel --max-workers=4
run_lint:
steps:
- run:
name: Lint
command: |
./gradlew --stacktrace lintRelease
./gradlew --stacktrace ktlint
run_doc_check:
steps:
- run:
name: Doc check
command: ./gradlew dokkaHtml --parallel --max-workers=4
run_api_check:
steps:
- run:
name: API check
command:
./gradlew apiCheck -q || (echo "❌ apiCheck failed, If there are intended differences in the public API, you can run ./gradlew apiDump and commit the output. See more details https://github.com/Kotlin/binary-compatibility-validator." && exit 1)
run_static_analysis:
steps:
- run:
name: CodeCov
command: |
./gradlew jacocoMerge
curl -s https://codecov.io/bash > codecov
VERSION=$(grep '^VERSION=\"[0-9\.]*\"' codecov | awk -F '"' '{print $2}')
shasum -c --ignore-missing <(curl -s https://raw.githubusercontent.com/codecov/codecov-bash/${VERSION}/SHA256SUM)
jobs:
test:
docker:
- image: cimg/android:2023.02
environment:
GRADLE_OPTS: -Xmx6G
resource_class: large
steps:
- checkout
- add_google_services
- android/restore-gradle-cache
- android/restore-build-cache
- run_build
- run_lint
- run_doc_check
- run_api_check
- android/run-tests:
test-command: ./gradlew --stacktrace --info testDebug --parallel --max-workers=4
- run_static_analysis
- android/save-gradle-cache
- android/save-build-cache
- run:
name: Collect test results
command: |
mkdir -p ~/test-results/junit/
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/test-results/junit/ \;
when: always
- store_test_results:
path: ~/test-results
- store_artifacts:
path: ~/test-results/junit
publish_docs:
executor:
name: android/android-machine
tag: 2023.02.1
steps:
- checkout
- android/restore-gradle-cache
- run:
name: Download Dependencies
command: ./gradlew androidDependencies
- run:
name: Generate and Publish docs
command: |
git config --global user.name "${GITHUB_USER_NAME}"
git config --global user.email "${GITHUB_USER_EMAIL}"
./gradlew publishDocs
- android/save-gradle-cache
publish:
executor:
name: android/android-machine
tag: 2023.02.1
steps:
- checkout
- android/restore-gradle-cache
- run:
name: Decrypt properties
# encrypt to update(OpenSSL 1.1.1):
# openssl aes-256-cbc -e -md sha512 -pbkdf2 -iter 100000 -salt -in buildscripts/gradle.properties -out buildscripts/encrypted.properties -k $ENCRYPT_KEY
command: |
mkdir -p ~/.gradle
openssl aes-256-cbc -d -md sha512 -pbkdf2 -iter 100000 -salt -in buildscripts/encrypted.properties -k $ENCRYPT_KEY >> ~/.gradle/gradle.properties
- run:
name: Decrypt GPG key
# export gpg private key:
# gpg --export-secret-keys <key_id> | base64 | pbcopy
command: echo "$GPG_KEY" | base64 -d > secret-keys.gpg
- run:
name: Publish
command: bash ./scripts/publish.sh
- android/save-gradle-cache
workflows:
build_and_test:
when: # Execute only public repository
equal: [ "https://github.com/plaidev/karte-android-sdk", << pipeline.project.git_url >> ]
jobs:
- test
build_and_deploy:
unless: # Don't execute public repository
equal: [ "https://github.com/plaidev/karte-android-sdk", << pipeline.project.git_url >> ]
jobs:
- test
- publish_docs:
filters:
branches:
only:
- master
- publish:
requires:
- test
filters:
branches:
only:
- master