-
Notifications
You must be signed in to change notification settings - Fork 102
/
Copy pathbitrise.yml
2907 lines (2609 loc) · 95.3 KB
/
bitrise.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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
format_version: '8'
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: android
app:
envs:
- PROJECT_LOCATION: BITRISE_SOURCE_DIR
opts:
is_expand: false
- MODULE: app
opts:
is_expand: false
- VARIANT: dhisDebug
meta:
bitrise.io:
machine_type: performance
trigger_map:
- push_branch: master
workflow: primary
- push_branch: develop
workflow: primary
- push_branch: hotfix/2.4.2
workflow: primary
- push_branch: release/2.7.0
workflow: primary
- pull_request_target_branch: "*"
workflow: PullRequest
workflows:
BuildSignReleaseAPKs:
envs:
- GITHUB_RELEASES_LIST: https://github.com/dhis2/dhis2-android-capture-app/releases
opts:
is_expand: false
- GITHUB_RELEASE_BRANCH: master
opts:
is_expand: false
steps:
- activate-ssh-key:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone: {}
- cache-pull: {}
- script:
title: Rule engine build.gradle
asset_urls:
icon.svg: https://bitrise-steplib-collection.s3.amazonaws.com/steps/script/assets/icon.svg
inputs:
- content: |
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
cd dhis2-rule-engine
FILE=build.gradle
if [ -f "$FILE" ]; then
echo "$FILE rule engine exist"
exit 0
fi
echo "apply plugin: 'java'
dependencies {
testImplementation 'junit:junit:4.12'
testCompile group: 'org.assertj', name: 'assertj-core', version: '3.5.2'
testImplementation group: 'org.mockito', name: 'mockito-core', version: '2.2.9'
testCompile 'com.google.truth:truth:0.30'
testCompile group: 'nl.jqno.equalsverifier', name: 'equalsverifier', version: '2.1.6'
implementation 'com.google.code.findbugs:jsr305:3.0.1'
compileOnly 'com.google.auto.value:auto-value:1.3'
annotationProcessor 'com.google.auto.value:auto-value:1.5.2'
compile 'com.google.guava:guava:16+'
compile 'joda-time:joda-time:2.10.5'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.7'
implementation group: 'commons-logging', name: 'commons-logging', version: '1.2'
implementation group : 'org.apache.commons', name : 'commons-jexl', version: '2.1.1'
}" > build.gradle
cd ..
echo "Rule engine build gradle created"
- script:
title: zxing build.gradle
asset_urls:
icon.svg: https://bitrise-steplib-collection.s3.amazonaws.com/steps/script/assets/icon.svg
is_always_run: true
inputs:
- content: |+
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
if [ "$BITRISE_GIT_BRANCH" = "master" ]; then
exit 0
fi
FILE=zxing-core/core/build.gradle
if [ -f "$FILE" ]; then
echo "$FILE exist"
exit 0
fi
echo "apply plugin: 'java'" > $FILE
echo "zxing build gradle created"
- script@1:
title: Set Java 8 as default
inputs:
- content: |-
chmod +x ./scripts/change_java_version.sh
./scripts/change_java_version.sh
- install-missing-android-tools:
inputs:
- gradlew_path: "./gradlew"
- gradle-runner:
title: Build Release - Training APK
asset_urls:
icon.svg: https://bitrise-steplib-collection.s3.amazonaws.com/steps/gradle-runner/assets/icon.svg
inputs:
- gradle_task: assembleRelease assembleDhisDebug
- gradlew_path: "./gradlew"
- sign-apk:
asset_urls:
icon.svg: https://bitrise-steplib-collection.s3.amazonaws.com/steps/sign-apk/assets/icon.svg
inputs:
- signer_scheme: v2
- use_apk_signer: 'true'
- android_app: "$BITRISE_APK_PATH_LIST"
- deploy-to-bitrise-io:
asset_urls:
icon.svg: https://bitrise-steplib-collection.s3.amazonaws.com/steps/deploy-to-bitrise-io/assets/icon.svg
inputs:
- notify_user_groups: none
- cache-push: {}
CodeReviewReminder:
steps:
- nvm@1:
inputs:
- node_version: 17.4.0
- npm@1:
inputs:
- command: install -g zx
title: Install zx
- script@1:
inputs:
- runner_bin: zx
- script_file_path: "$TMPDIR/zx_script.mjs"
- content: "#!/usr/bin/env zx\n\nconst pr_api = \"https://api.github.com/repos/dhis2/dhis2-android-capture-app/pulls\"\n\nconst
pablo_pr = \"https://github.com/dhis2/dhis2-android-capture-app/pulls/review-requested/Balcan\"\nconst
jaime_pr = \"https://github.com/dhis2/dhis2-android-capture-app/pulls/review-requested/JaimeToca\"\nconst
ferdy_pr = \"https://github.com/dhis2/dhis2-android-capture-app/pulls/review-requested/ferdyrod\"\nconst
andres_pr = \"https://github.com/dhis2/dhis2-android-capture-app/pulls/review-requested/andresmr\"\nconst
manu_pr = \"https://github.com/dhis2/dhis2-android-capture-app/pulls/review-requested/mmmateos\"\n\nconsole.log(\"Counting
code reviews\")\n\nlet response = await fetch(pr_api, {\n method: \"get\",\n
\ headers: {\n \"Authorization\": `Token ${process.env.GITHUB_RELEASE_API_TOKEN}`\n
\ }\n})\n\nif(response.ok){\n let pull_requests = JSON.parse(await
response.text())\n var devs = []\n for(var pr of pull_requests){\n
\ var reviewers = pr[\"requested_reviewers\"]\n for(var reviewer
of reviewers){\n devs.push(reviewer[\"login\"])\n }\n
\ }\n var ferdyrodCount = 0\n var BalcanCount = 0\n var mmmateosCount
= 0\n var JaimeTocaCount = 0\n var andresmrCount = 0\n for(var
dev of devs){\n if(dev == \"ferdyrod\") ferdyrodCount += 1\n if(dev
== \"Balcan\") BalcanCount = BalcanCount +1\n if(dev == \"mmmateos\")
mmmateosCount = mmmateosCount +1\n if(dev == \"JaimeToca\") JaimeTocaCount
= JaimeTocaCount +1\n if(dev == \"andresmr\") andresmrCount = andresmrCount
+1\n }\n\n var message = \"\"\n\tif(ferdyrodCount>0) message = message
+ \"Ferdy: \" + ferdy_pr + \"\\n\"\n\tif(BalcanCount>0) message = message
+ \"Pablo: \" + pablo_pr + \"\\n\"\n\tif(mmmateosCount>0) message = message
+ \"Manu: \" + manu_pr + \"\\n\"\n\tif(JaimeTocaCount>0) message = message
+ \"Jaime: \" + jaime_pr + \"\\n\"\n\tif(andresmrCount>0) message = message
+ \"Andres: \" + andres_pr + \"\\n\"\n \n console.log(message)\n
\ await $`envman add --key CODE_REVIEW_MESSAGE --value ${message}`\n}\nconsole.log(\"Finished!\")"
- slack@3:
inputs:
- channel: "#android-app-dev"
- text: "$CODE_REVIEW_MESSAGE"
- icon_url: https://c.tenor.com/T4YneTxIzUAAAAAC/im-watching-you-eyes-on-you.gif
- pretext: "*Code review reminder!*"
- author_name: Watcher Cat
- title: I'm watching you!
- message: ''
- webhook_url: "$SLACK_CI_WEBHOOK"
envs:
- CODE_REVIEW_MESSAGE: No new message
DeployToPlayStore:
envs:
- GITHUB_RELEASES_LIST: https://github.com/dhis2/dhis2-android-capture-app/releases
opts:
is_expand: false
- GITHUB_RELEASE_BRANCH: master
opts:
is_expand: false
steps:
- activate-ssh-key:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- [email protected]: {}
- cache-pull: {}
- script@1:
title: Set Java 8 as default
inputs:
- content: |-
chmod +x ./scripts/change_java_version.sh
./scripts/change_java_version.sh
- install-missing-android-tools:
inputs:
- gradlew_path: "./gradlew"
- gradle-runner:
title: Build Release - Training APK
asset_urls:
icon.svg: https://bitrise-steplib-collection.s3.amazonaws.com/steps/gradle-runner/assets/icon.svg
inputs:
- gradle_task: assembleDhisNoSMSRelease
- gradlew_path: "./gradlew"
- script@1:
title: Swap Java 8 to Java 11
inputs:
- content: |-
# fail if any commands fails
set -e
# debug log
set -x
sudo update-alternatives --set javac /usr/lib/jvm/java-11-openjdk-amd64/bin/javac
sudo update-alternatives --set java /usr/lib/jvm/java-11-openjdk-amd64/bin/java
export JAVA_HOME='/usr/lib/jvm/java-11-openjdk-amd64'
envman add --key JAVA_HOME --value '/usr/lib/jvm/java-11-openjdk-amd64'
- sign-apk:
asset_urls:
icon.svg: https://bitrise-steplib-collection.s3.amazonaws.com/steps/sign-apk/assets/icon.svg
inputs:
- signer_scheme: v2
- verbose_log: 'true'
- use_apk_signer: 'true'
- android_app: "$BITRISE_APK_PATH_LIST"
- google-play-deploy:
inputs:
- package_name: com.dhis2
- app_path: "$BITRISE_SIGNED_APK_PATH"
- service_account_json_key_path: "$BITRISEIO_GOOGLE_PLAY_JSON_URL"
- whatsnews_dir: "./whatsnew"
- deploy-to-bitrise-io:
asset_urls:
icon.svg: https://bitrise-steplib-collection.s3.amazonaws.com/steps/deploy-to-bitrise-io/assets/icon.svg
inputs:
- notify_user_groups: none
- cache-push: {}
DesignAPK:
steps:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- [email protected]: {}
- cache-pull: {}
- script@1:
title: Set Java 8 as default
inputs:
- content: |-
chmod +x ./scripts/change_java_version.sh
./scripts/change_java_version.sh
- script:
title: zxing build.gradle
asset_urls:
icon.svg: https://bitrise-steplib-collection.s3.amazonaws.com/steps/script/assets/icon.svg
is_always_run: true
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
if [ "$BITRISE_GIT_BRANCH" = "master_legacy" ]; then
exit 0
fi
SUBMODULE=zxing-core
if [ -d "$SUBMODULE" ]; then
echo "$SUBMODULE exist"
FILE=zxing-core/core/build.gradle
if [ -f "$FILE" ]; then
echo "$FILE exist"
exit 0
fi
echo "apply plugin: 'java'" > $FILE
echo "zxing build gradle created"
fi
- install-missing-android-tools:
inputs:
- gradlew_path: "./gradlew"
- android-build:
inputs:
- variant: "$VARIANT"
- module: app
- deploy-to-bitrise-io:
asset_urls:
icon.svg: https://bitrise-steplib-collection.s3.amazonaws.com/steps/deploy-to-bitrise-io/assets/icon.svg
inputs:
- notify_user_groups: none
- [email protected]: {}
is_always_run: false
run_if: '{{getenv "SLACK" | ne "no"}}'
inputs:
- channel: "@U9LUWRXCH"
- emoji: ":white_check_mark:"
- from_username: CI Test Deployment
- pretext: ''
- buttons: 'Bitrise apk|${BITRISE_PUBLIC_INSTALL_PAGE_URL}
'
- fields: ''
- author_name: ''
- title: ''
- text: Apk from ${BITRISE_GIT_BRANCH} ready for pixel perfect ! Click on
the link below or scan the QR.
- message: ''
- image_url: "$BITRISE_PUBLIC_INSTALL_PAGE_QR_CODE_IMAGE_URL"
- webhook_url: "$SLACK_CI_WEBHOOK"
- [email protected]: {}
EndRegression:
steps:
- activate-ssh-key:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- cache-pull: {}
- git-clone: {}
- authenticate-with-github-oauth:
inputs:
- username: "$GITHUB_RELEASE_USER"
- access_token: "$GITHUB_RELEASE_API_TOKEN"
- script:
title: Read Vname and Branch
asset_urls:
icon.svg: https://bitrise-steplib-collection.s3.amazonaws.com/steps/script/assets/icon.svg
inputs:
- content: |+
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
cd scripts
python3 readReleaseInfo.py
- script:
title: Finish release branch
asset_urls:
icon.svg: https://bitrise-steplib-collection.s3.amazonaws.com/steps/script/assets/icon.svg
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
#Merge release to master
git "fetch" "origin" "master"
git "checkout" "master"
git "pull" "--no-ff" "origin" "$BRANCH_RELEASE"
git "push" "origin" "master"
#Merge master to develop
git "fetch" "origin" "develop"
git "checkout" "develop"
git "pull" "--no-ff" "origin" "master"
git "push" "origin" "develop"
#Delete release branch
git "branch" "-d" "$BRANCH_RELEASE"
git "push" "origin" "--delete" "$BRANCH_RELEASE"
- cache-push: {}
FlowUITest:
description: |+
Workflow that
1)Choose random reviewers for a PR
2)Run tests
3)Publish Results on slack
steps:
- [email protected]: {}
- script@1:
title: Configure parameters
inputs:
- content: |
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
cd scripts/
chmod +x flow_tests_configurator.sh
./flow_tests_configurator.sh
- android-build-for-ui-testing@0:
inputs:
- variant: dhisUITestingDebug
- module: app
- script@1:
title: BrowserStack Tests
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
ls
cd scripts/
chmod +x ./browserstackBitrise.sh
./browserstackBitrise.sh
inputs:
- channel: "#android-app-dev"
- emoji: ":white_check_mark:"
- from_username: Continuous integration
- buttons: |
View Build|${BITRISE_BUILD_URL}
View UnitTests|https://addons-testing.bitrise.io/builds/${BITRISE_BUILD_SLUG}/summary?status=all
View UITests|${BROWSERSTACK_TEST_REPORTS}
Install Page|${BITRISE_PUBLIC_INSTALL_PAGE_URL}
- emoji_on_error: ":laptop:"
- from_username_on_error: Local Continuous integration
- color_on_error: "#f01f33"
- pretext: "*Flow Build Succeeded!*"
- pretext_on_error: "*Flow Build Failed!*"
- webhook_url: "$SLACK_CI_WEBHOOK"
GenerateGitHubNotesOnlyPatch:
steps:
- activate-ssh-key:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- cache-pull: {}
- git-clone: {}
- authenticate-with-github-oauth:
inputs:
- username: "$GITHUB_RELEASE_USER"
- access_token: "$GITHUB_RELEASE_API_TOKEN"
- script:
title: Read Vname and Branch
asset_urls:
icon.svg: https://bitrise-steplib-collection.s3.amazonaws.com/steps/script/assets/icon.svg
inputs:
- content: |+
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
cd scripts
python3 readReleaseInfo.py
- script@1:
title: Generate Release Notes
inputs:
- content: |
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
cd scripts
python3 generateReleaseNotes.py
#Commit and push release notes on release branch
git "commit" "-am" "Update release notes"
git "push" "origin" "$BRANCH_RELEASE"
- cache-push: {}
GithubDeployment:
envs:
- GITHUB_RELEASES_LIST: https://github.com/dhis2/dhis2-android-capture-app/releases
opts:
is_expand: false
- GITHUB_RELEASE_BRANCH: master
opts:
is_expand: false
steps:
- activate-ssh-key:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- [email protected]: {}
- cache-pull: {}
- script@1:
title: Set Java 8 as default
inputs:
- content: |-
chmod +x ./scripts/change_java_version.sh
./scripts/change_java_version.sh
- install-missing-android-tools:
inputs:
- gradlew_path: "./gradlew"
- gradle-runner:
title: Build Release - Training APK
asset_urls:
icon.svg: https://bitrise-steplib-collection.s3.amazonaws.com/steps/gradle-runner/assets/icon.svg
inputs:
- gradle_task: assembleRelease assembleDhisDebug
- gradlew_path: "./gradlew"
- script@1:
title: Swap Java 8 to Java 11
inputs:
- content: |-
# fail if any commands fails
set -e
# debug log
set -x
sudo update-alternatives --set javac /usr/lib/jvm/java-11-openjdk-amd64/bin/javac
sudo update-alternatives --set java /usr/lib/jvm/java-11-openjdk-amd64/bin/java
export JAVA_HOME='/usr/lib/jvm/java-11-openjdk-amd64'
envman add --key JAVA_HOME --value '/usr/lib/jvm/java-11-openjdk-amd64'
- sign-apk:
asset_urls:
icon.svg: https://bitrise-steplib-collection.s3.amazonaws.com/steps/sign-apk/assets/icon.svg
inputs:
- signer_scheme: v2
- use_apk_signer: 'true'
- android_app: "$BITRISE_APK_PATH_LIST"
- script:
title: Read Version Name
asset_urls:
icon.svg: https://bitrise-steplib-collection.s3.amazonaws.com/steps/script/assets/icon.svg
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
RELEASE_TAG=$(cat buildsystem/dependencies.gradle | grep "vName" | awk -F ':' '{print $2}' | awk '{$1=$1};1' | sed 's/"//g' | tr " " _ | awk '{ print tolower($0) }')
envman add --key GITHUB_RELEASE_TAG --value "$RELEASE_TAG"
- script:
title: Prepare APK to Upload
asset_urls:
icon.svg: https://bitrise-steplib-collection.s3.amazonaws.com/steps/script/assets/icon.svg
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
#Get training apk
FIRST_APK_SIGNED=$(echo $BITRISE_SIGNED_APK_PATH_LIST | awk -F'|' '{print $1}')
#Rename training APK
FIRST_APK_SIGNED=$FIRST_APK_SIGNED"|dhis2-v"$GITHUB_RELEASE_TAG"_training.apk"
#Get release apk
SECOND_APK_SIGNED=$(echo $BITRISE_SIGNED_APK_PATH_LIST | awk -F'|' '{print $2}')
#Rename release apk
SECOND_APK_SIGNED=$SECOND_APK_SIGNED"|dhis2-v"$GITHUB_RELEASE_TAG".apk"
#Get release no sms apk
THIRD_APK_SIGNED=$(echo $BITRISE_SIGNED_APK_PATH_LIST | awk -F'|' '{print $3}')
#Rename no sms release apk
THIRD_APK_SIGNED=$THIRD_APK_SIGNED"|dhis2-v"$GITHUB_RELEASE_TAG"_no_sms.apk"
#Format both apk for github api
echo -e "$FIRST_APK_SIGNED\n$SECOND_APK_SIGNED\n$THIRD_APK_SIGNED" | envman add --key LIST_APK_TO_UPLOAD
- script:
title: Read release notes
asset_urls:
icon.svg: https://bitrise-steplib-collection.s3.amazonaws.com/steps/script/assets/icon.svg
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
echo "Reading release notes"
cat RELEASE.md | head -n 1 | envman add --key RELEASE_TITLE
cat RELEASE.md | tail -n +3 | envman add --key RELEASE_BODY
inputs:
- api_token: "$GITHUB_RELEASE_API_TOKEN"
- username: "$GITHUB_RELEASE_USER"
- name: "$RELEASE_TITLE"
- body: "$RELEASE_BODY"
- commit: "$GITHUB_RELEASE_BRANCH"
- tag: "$GITHUB_RELEASE_TAG"
- files_to_upload: "$LIST_APK_TO_UPLOAD"
asset_urls:
icon.svg: https://bitrise-steplib-collection.s3.amazonaws.com/steps/deploy-to-bitrise-io/assets/icon.svg
inputs:
- notify_user_groups: none
- cache-push: {}
JacocoAndSonarqubeTest:
description: |+
Workflow that
1)Choose random reviewers for a PR
2)Run tests
3)Publish Results on slack
steps:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
inputs:
- merge_pr: 'no'
- fetch_tags: 'yes'
- manual_merge: 'no'
- cache-pull@2: {}
- script@1:
title: Set Java 8 as default
inputs:
- content: |
chmod +x ./scripts/change_java_version.sh
./scripts/change_java_version.sh
- script:
title: Rule engine build.gradle
asset_urls:
icon.svg: https://bitrise-steplib-collection.s3.amazonaws.com/steps/script/assets/icon.svg
is_always_run: true
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
SUBMODULE=dhis2-rule-engine
if [ -d "$SUBMODULE" ]; then
cd dhis2-rule-engine
FILE=build.gradle
if [ -f "$FILE" ]; then
echo "$FILE rule engine exist"
exit 0
fi
echo "apply plugin: 'java'
dependencies {
testImplementation 'junit:junit:4.12'
testCompile group: 'org.assertj', name: 'assertj-core', version: '3.5.2'
testImplementation group: 'org.mockito', name: 'mockito-core', version: '2.2.9'
testCompile 'com.google.truth:truth:0.30'
testCompile group: 'nl.jqno.equalsverifier', name: 'equalsverifier', version: '2.1.6'
implementation 'com.google.code.findbugs:jsr305:3.0.1'
compileOnly 'com.google.auto.value:auto-value:1.3'
annotationProcessor 'com.google.auto.value:auto-value:1.5.2'
compile 'com.google.guava:guava:16+'
compile 'joda-time:joda-time:2.10.5'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.7'
implementation group: 'commons-logging', name: 'commons-logging', version: '1.2'
implementation group : 'org.apache.commons', name : 'commons-jexl', version: '2.1.1'
}" > build.gradle
cd ..
echo "Rule engine build gradle created"
fi
- script:
title: zxing build.gradle
asset_urls:
icon.svg: https://bitrise-steplib-collection.s3.amazonaws.com/steps/script/assets/icon.svg
is_always_run: true
inputs:
- content: |+
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
if [ "$BITRISE_GIT_BRANCH" = "master_legacy" ]; then
exit 0
fi
SUBMODULE=zxing-core
if [ -d "$SUBMODULE" ]; then
echo "$SUBMODULE exist"
FILE=zxing-core/core/build.gradle
if [ -f "$FILE" ]; then
echo "$FILE exist"
exit 0
fi
echo "apply plugin: 'java'" > $FILE
echo "zxing build gradle created"
fi
- install-missing-android-tools:
inputs:
- gradlew_path: "./gradlew"
- script@1:
title: Run Unit tests with covergae
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully
set -o pipefail
# debug log
set -x
# write your script here
git fetch origin develop
./gradlew testDhisDebugUnitTestCoverage
# or run a script from your repository, like:
# bash ./path/to/script.sh
# not just bash, e.g.:
# ruby ./path/to/script.rb
- script@1:
title: Run sonarqube
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully
set -o pipefail
# debug log
set -x
# write your script here
./gradlew sonarqube
# or run a script from your repository, like:
# bash ./path/to/script.sh
# not just bash, e.g.:
# ruby ./path/to/script.rb
LocalPrimary:
description: |+
Workflow that
1)Choose random reviewers for a PR
2)Run tests
3)Publish Results on slack
steps:
- gradle-runner@2:
title: Verify Kotlin codestyle
inputs:
- gradlew_path: "./gradlew"
- app_file_include_filter: "*.apk"
- app_file_exclude_filter: "\n"
- test_apk_file_include_filter: ''
- mapping_file_include_filter: ''
- retry_on_failure: 'no'
- gradle_task: ktlintCheck
- android-unit-test@1:
inputs:
- variant: dhisDebug
- android-build-for-ui-testing@0:
inputs:
- variant: dhisUITestingDebug
- module: app
- script@1:
title: BrowserStack Tests
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
cd scripts/
chmod +x ./browserstackBitrise.sh
./browserstackBitrise.sh
LocalUITest:
description: |+
Workflow that
1)Choose random reviewers for a PR
2)Run tests
3)Publish Results on slack
steps:
- script:
title: zxing build.gradle
asset_urls:
icon.svg: https://bitrise-steplib-collection.s3.amazonaws.com/steps/script/assets/icon.svg
is_always_run: true
inputs:
- content: |
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
FILE=zxing-core/core/build.gradle
if [ -f "$FILE" ]; then
echo "$FILE exist"
exit 0
fi
echo "apply plugin: 'java'" > $FILE
echo "zxing build gradle created"
- android-build-for-ui-testing@0:
inputs:
- variant: dhisUITestingDebug
- module: app
- script@1:
title: BrowserStack Tests
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
cd scripts/
chmod +x ./browserstackBitrise.sh
./browserstackBitrise.sh
inputs:
- channel: "#android-capture-app-ci"
- emoji: ":white_check_mark:"
- from_username: Continuous integration
- buttons: |
View Build|${BITRISE_BUILD_URL}
View UnitTests|https://addons-testing.bitrise.io/builds/${BITRISE_BUILD_SLUG}/summary?status=all
View UITests|${BROWSERSTACK_TEST_REPORTS}
Install Page|${BITRISE_PUBLIC_INSTALL_PAGE_URL}
- emoji_on_error: ":laptop:"
- from_username_on_error: Local Continuous integration
- color_on_error: "#f01f33"
- pretext: "*Local Build Succeeded!*"
- pretext_on_error: "*Local Build Failed!*"
- webhook_url: "$SLACK_CI_WEBHOOK"
PlaystoreAndGithubDeployment:
envs:
- GITHUB_RELEASES_LIST: https://github.com/dhis2/dhis2-android-capture-app/releases
opts:
is_expand: false
- GITHUB_RELEASE_BRANCH: master
opts:
is_expand: false
steps:
- activate-ssh-key:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- [email protected]: {}
- cache-pull: {}
- script:
title: Rule engine build.gradle
asset_urls:
icon.svg: https://bitrise-steplib-collection.s3.amazonaws.com/steps/script/assets/icon.svg
inputs:
- content: |
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
cd dhis2-rule-engine
FILE=build.gradle
if [ -f "$FILE" ]; then
echo "$FILE rule engine exist"
exit 0
fi
echo "apply plugin: 'java'
dependencies {
testImplementation 'junit:junit:4.12'
testCompile group: 'org.assertj', name: 'assertj-core', version: '3.5.2'
testImplementation group: 'org.mockito', name: 'mockito-core', version: '2.2.9'
testCompile 'com.google.truth:truth:0.30'
testCompile group: 'nl.jqno.equalsverifier', name: 'equalsverifier', version: '2.1.6'
implementation 'com.google.code.findbugs:jsr305:3.0.1'
compileOnly 'com.google.auto.value:auto-value:1.3'
annotationProcessor 'com.google.auto.value:auto-value:1.5.2'
compile 'com.google.guava:guava:16+'
compile 'joda-time:joda-time:2.10.5'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.7'
implementation group: 'commons-logging', name: 'commons-logging', version: '1.2'
implementation group : 'org.apache.commons', name : 'commons-jexl', version: '2.1.1'
}" > build.gradle
cd ..
echo "Rule engine build gradle created"
- script:
title: zxing build.gradle
asset_urls:
icon.svg: https://bitrise-steplib-collection.s3.amazonaws.com/steps/script/assets/icon.svg
is_always_run: true
inputs:
- content: |
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
FILE=zxing-core/core/build.gradle
if [ -f "$FILE" ]; then
echo "$FILE exist"
exit 0
fi
echo "apply plugin: 'java'" > $FILE
echo "zxing build gradle created"
- script@1:
title: Set Java 8 as default
inputs:
- content: |-
chmod +x ./scripts/change_java_version.sh
./scripts/change_java_version.sh
- install-missing-android-tools:
inputs:
- gradlew_path: "./gradlew"
- gradle-runner:
title: Build Release - Training APK
asset_urls:
icon.svg: https://bitrise-steplib-collection.s3.amazonaws.com/steps/gradle-runner/assets/icon.svg
inputs:
- gradle_task: assembleRelease assembleDhisDebug
- gradlew_path: "./gradlew"
- sign-apk:
asset_urls:
icon.svg: https://bitrise-steplib-collection.s3.amazonaws.com/steps/sign-apk/assets/icon.svg
inputs:
- android_app: "$BITRISE_APK_PATH_LIST"
- script:
title: Read Version Name
asset_urls:
icon.svg: https://bitrise-steplib-collection.s3.amazonaws.com/steps/script/assets/icon.svg
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
RELEASE_TAG=$(cat buildsystem/dependencies.gradle | grep "vName" | awk -F ':' '{print $2}' | awk '{$1=$1};1' | sed 's/"//g' | tr " " _ | awk '{ print tolower($0) }')
envman add --key GITHUB_RELEASE_TAG --value "$RELEASE_TAG"
- script:
title: Prepare APK to Upload
asset_urls:
icon.svg: https://bitrise-steplib-collection.s3.amazonaws.com/steps/script/assets/icon.svg
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
#Get training apk
FIRST_APK_SIGNED=$(echo $BITRISE_SIGNED_APK_PATH_LIST | awk -F'|' '{print $1}')
#Rename training APK
FIRST_APK_SIGNED=$FIRST_APK_SIGNED"|dhis2-v"$GITHUB_RELEASE_TAG"_training.apk"
#Get release apk
SECOND_APK_SIGNED=$(echo $BITRISE_SIGNED_APK_PATH_LIST | awk -F'|' '{print $2}')
#Rename release apk
SECOND_APK_SIGNED=$SECOND_APK_SIGNED"|dhis2-v"$GITHUB_RELEASE_TAG".apk"
#Get release no sms apk
THIRD_APK_SIGNED=$(echo $BITRISE_SIGNED_APK_PATH_LIST | awk -F'|' '{print $3}')
#Rename no sms release apk
THIRD_APK_SIGNED=$THIRD_APK_SIGNED"|dhis2-v"$GITHUB_RELEASE_TAG"_no_sms.apk"
#Format both apk for github api
echo -e "$FIRST_APK_SIGNED\n$SECOND_APK_SIGNED\n$THIRD_APK_SIGNED" | envman add --key LIST_APK_TO_UPLOAD
echo -e "$THIRD_APK_SIGNED" | envman add --key PLAYSTORE_APK
- script:
title: Read release notes