Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4eb85fbf28 | ||
|
|
64b922c734 | ||
|
|
c8ec687300 | ||
|
|
4feb3a1c08 | ||
|
|
cb87d43aab | ||
|
|
d4e7a95a8c | ||
|
|
72418957d5 | ||
|
|
725138794b | ||
|
|
92a5487df3 | ||
|
|
0a026decdc | ||
|
|
01d12a2263 | ||
|
|
92a406e3ba | ||
|
|
56c8deedd2 | ||
|
|
7a4933c63a | ||
|
|
e268a43141 | ||
|
|
87bebdf4ea | ||
|
|
52642214ed | ||
|
|
f0985a3898 | ||
|
|
b082c0545f | ||
|
|
6625803431 | ||
|
|
6918f1519f | ||
|
|
92c655cad2 | ||
|
|
9ad0f32d93 | ||
|
|
e77bb73077 | ||
|
|
6e9d4767f6 | ||
|
|
77f1be5bdd | ||
|
|
11279d2595 | ||
|
|
b600346ab6 | ||
|
|
f727ee0667 | ||
|
|
fe61c99eff | ||
|
|
2ac43ba4cb | ||
|
|
0591667c0b | ||
|
|
af1c18856a | ||
|
|
28c71e2b65 | ||
|
|
ea2f387203 | ||
|
|
a365368044 | ||
|
|
0fe711f563 | ||
|
|
e00e0dd54e | ||
|
|
6bc9081847 | ||
|
|
9ad2a1e73e | ||
|
|
6767970307 | ||
|
|
abcdf3f4d1 | ||
|
|
69c0bbd120 | ||
|
|
1d192c85e0 | ||
|
|
fcb6a21d00 | ||
|
|
aedb5f9ce8 | ||
|
|
d436eb36c1 | ||
|
|
3ea820cd99 | ||
|
|
e642adcaad | ||
|
|
b49e96cf93 | ||
|
|
9346afc2da | ||
|
|
607f9de6b4 | ||
|
|
6be44c92d3 | ||
|
|
d58eb73294 | ||
|
|
2756b7febc | ||
|
|
ee5630f893 | ||
|
|
a72a5d1edc | ||
|
|
9f58ad6bda | ||
|
|
94a3f40ac6 | ||
|
|
e340223c8c | ||
|
|
77488aea7f | ||
|
|
8f1c4bf1ca | ||
|
|
cd63313358 | ||
|
|
d0f9534e3d | ||
|
|
7b6bc3fe3e | ||
|
|
1f1d4ccf49 | ||
|
|
8278a3f6ef | ||
|
|
92ea480e55 | ||
|
|
0188131350 | ||
|
|
371a57c663 | ||
|
|
6d4de35602 | ||
|
|
51158d8630 | ||
|
|
3a7cba3dc9 | ||
|
|
4bb9f044ed | ||
|
|
0e35dab27f | ||
|
|
14a98aea88 | ||
|
|
337aaf5103 | ||
|
|
f5e86d5806 | ||
|
|
caf2cb2cd8 | ||
|
|
03f2ea256a | ||
|
|
af2d302bbc | ||
|
|
b6752ea535 | ||
|
|
06a8e83922 | ||
|
|
a7e7eaa5aa | ||
|
|
d2c82d05c7 | ||
|
|
79d36e1536 | ||
|
|
90ff1782ae | ||
|
|
92e4933521 | ||
|
|
4f9469db55 | ||
|
|
cc409b9914 | ||
|
|
4cc5a36c32 | ||
|
|
ed77303a16 | ||
|
|
5696fe3ea0 | ||
|
|
b39a8784b7 | ||
|
|
fcb1f2ec31 | ||
|
|
49113f2cb4 | ||
|
|
0a8b7c07a2 | ||
|
|
49b9c44f3a | ||
|
|
15cddf08c4 | ||
|
|
71949ee857 | ||
|
|
d0e3c619ca | ||
|
|
8dc87a3a3c | ||
|
|
76617374c0 | ||
|
|
70fc3b411c | ||
|
|
5e7ce8ce66 | ||
|
|
1d7121c41b | ||
|
|
0a1758091f | ||
|
|
eb045aa644 | ||
|
|
e5a9fe7031 | ||
|
|
fdb464781a | ||
|
|
2e5237ec80 | ||
|
|
b1f9ec5e79 | ||
|
|
1ac4a6484e | ||
|
|
f09e38c92c | ||
|
|
e051faf84a | ||
|
|
2461a6e832 | ||
|
|
20120f5c0a | ||
|
|
6a0f135247 | ||
|
|
b36847817d | ||
|
|
0196d23103 | ||
|
|
01d1c663c1 | ||
|
|
5b8ef77bba | ||
|
|
3b3746fff3 | ||
|
|
d9ba33c9fa | ||
|
|
94132acf41 | ||
|
|
86e7e0f8e5 | ||
|
|
77a1216730 | ||
|
|
56e01002da | ||
|
|
287378162f | ||
|
|
8affae0fa1 | ||
|
|
ca28b7ad10 | ||
|
|
edebdfd380 | ||
|
|
ddf0a451c9 | ||
|
|
fcc439b938 | ||
|
|
68ac0c42ce | ||
|
|
666d3eaee6 | ||
|
|
ecfaf236b9 | ||
|
|
a5714c805d | ||
|
|
9eb4b3c595 | ||
|
|
0389f64365 | ||
|
|
ba476eb993 | ||
|
|
9b2bc985e0 | ||
|
|
1a9b9361e6 | ||
|
|
abdb45ea0b | ||
|
|
b9d6237eb4 | ||
|
|
5936037a56 | ||
|
|
0460a62956 | ||
|
|
6403ff78be | ||
|
|
7ad2eb45c8 | ||
|
|
ea5661fa41 | ||
|
|
f323d29aa4 | ||
|
|
eec0c5df02 | ||
|
|
b66c5d122a | ||
|
|
8289bc166f | ||
|
|
d1e9f7472b | ||
|
|
a22152fd4d | ||
|
|
83dcca4b8c | ||
|
|
a38691b5e2 | ||
|
|
ad696f84bf | ||
|
|
b4d8241422 | ||
|
|
feab383008 | ||
|
|
d097c08789 | ||
|
|
f5978bab45 | ||
|
|
6e953ab74b | ||
|
|
9794270552 | ||
|
|
ba5f76116b | ||
|
|
e56975ec49 | ||
|
|
2fa8734ac5 | ||
|
|
8337e63a53 | ||
|
|
ee9c3e3635 | ||
|
|
d8ac737d00 | ||
|
|
d6a582ae20 | ||
|
|
120d80f0ab | ||
|
|
377cb04ca1 | ||
|
|
a1f83daf10 | ||
|
|
c27ab1d6d6 | ||
|
|
ca0f85b48f | ||
|
|
b1114d9b87 | ||
|
|
f5e273d05c | ||
|
|
65c139e7d2 | ||
|
|
34fa736916 | ||
|
|
b707d1971f | ||
|
|
5923820261 | ||
|
|
d9389a48c6 | ||
|
|
611a93d926 | ||
|
|
4d64ece2f9 | ||
|
|
d1126b58c2 | ||
|
|
d881cb2e06 | ||
|
|
9f0c6a595e | ||
|
|
8c09a3e169 | ||
|
|
0e1ffe9cff | ||
|
|
9adec7fcfd | ||
|
|
4de36e6568 | ||
|
|
c299582ac4 | ||
|
|
69654cd036 | ||
|
|
81f110adea | ||
|
|
068bb87ab3 | ||
|
|
d1559b6748 | ||
|
|
5c3cc8ed4d | ||
|
|
2ba73f87e0 | ||
|
|
d789139be9 | ||
|
|
b162e2ee58 | ||
|
|
42b4775e9f | ||
|
|
4213882f04 | ||
|
|
1b6bdab388 | ||
|
|
087c91922c | ||
|
|
168f51471c | ||
|
|
19e26a086b | ||
|
|
de073327af | ||
|
|
e7d684eb0a | ||
|
|
6237f452f8 | ||
|
|
cd2a7a5bcd | ||
|
|
92acd04a53 | ||
|
|
7afe1c0e54 | ||
|
|
455bf6023d | ||
|
|
ce9936b6df | ||
|
|
359551e272 | ||
|
|
c888c05572 | ||
|
|
3479738457 | ||
|
|
98a3b3d8d5 | ||
|
|
abf1d33e62 | ||
|
|
9e826e4f61 | ||
|
|
5c2045a840 | ||
|
|
aa7e88cf46 | ||
|
|
4ac0bebe99 | ||
|
|
ac9b6e9af7 | ||
|
|
65afbdeeba | ||
|
|
ed29b14c9e | ||
|
|
54cb0fc824 | ||
|
|
15375cc53b | ||
|
|
4516899786 | ||
|
|
45e7df6db3 | ||
|
|
b9a7a486e1 | ||
|
|
90642436dd | ||
|
|
ef3c4e28c0 | ||
|
|
4d4c22124f | ||
|
|
7d63eac5ae | ||
|
|
b1be8ceeab | ||
|
|
fcb89f2702 | ||
|
|
226e088390 | ||
|
|
3574b9825b | ||
|
|
d34d635114 | ||
|
|
43d38adf76 | ||
|
|
a2d3c05a1c | ||
|
|
a4c7919209 | ||
|
|
2e59c45142 | ||
|
|
664ad07905 | ||
|
|
4b7de9d645 | ||
|
|
5d1cf8e671 | ||
|
|
9441d537b7 | ||
|
|
a40acea0ba | ||
|
|
54811c0c81 | ||
|
|
893abf99e4 | ||
|
|
14b6091277 | ||
|
|
5acbce6654 | ||
|
|
1c844033f6 | ||
|
|
83ba9bb79e | ||
|
|
712d3485ad | ||
|
|
04512a0d16 | ||
|
|
cf0ebd7eb9 | ||
|
|
32cb68f6c9 | ||
|
|
98b0b3a140 | ||
|
|
2c9c421c35 | ||
|
|
afea49a2c8 | ||
|
|
442a10afd2 | ||
|
|
478e0d0e51 | ||
|
|
17d09eb835 | ||
|
|
09c3fbe765 | ||
|
|
b285d8a1da | ||
|
|
46d3a4f8c1 | ||
|
|
033be6d7c4 | ||
|
|
84ed95aac1 | ||
|
|
c298cc7ae1 | ||
|
|
0ab0eaffcf | ||
|
|
0e00cffe4d | ||
|
|
3dc73b4573 | ||
|
|
711cbfef72 | ||
|
|
67a0935fc5 | ||
|
|
55012f9ac0 | ||
|
|
2e379769e9 | ||
|
|
2ffb3a0c3d | ||
|
|
e49d2a58cb | ||
|
|
099afef2a1 | ||
|
|
67a4468b05 | ||
|
|
21306b5b08 | ||
|
|
500fff9da4 | ||
|
|
68db6315d4 | ||
|
|
2ad579c77b | ||
|
|
bc5cb96ca9 | ||
|
|
85b2312b7f | ||
|
|
b518b38c35 | ||
|
|
1ebdbc7873 | ||
|
|
b3c8cb3cce | ||
|
|
05aa522965 | ||
|
|
2a48fc6f71 | ||
|
|
fd4a5a0763 | ||
|
|
7c085db7a3 | ||
|
|
e5817ebe7d | ||
|
|
2ed92c97e1 | ||
|
|
156fc288c7 | ||
|
|
c790d05e19 | ||
|
|
78b9b79212 | ||
|
|
57ae8a1f16 | ||
|
|
fc90713016 | ||
|
|
948b5cc07b | ||
|
|
dfc86227e0 | ||
|
|
dfa70768ab | ||
|
|
a34a7e8339 | ||
|
|
e9726a86af | ||
|
|
4e5370b85b | ||
|
|
da177442ce | ||
|
|
e2800863e8 | ||
|
|
c4bd3dcf55 | ||
|
|
ac594d96e9 | ||
|
|
a49cc2950e | ||
|
|
6b657dd13e | ||
|
|
aa7a798f62 | ||
|
|
ccec2c5969 | ||
|
|
e45bc0010f | ||
|
|
efd1f07e58 | ||
|
|
73418a8b4f | ||
|
|
ad444fd738 | ||
|
|
12391277e6 | ||
|
|
c50f185c65 | ||
|
|
62090f73b4 | ||
|
|
7bce737447 | ||
|
|
f2c6ab79bb | ||
|
|
afcbd4a7e7 | ||
|
|
9a714e5fb3 | ||
|
|
a6394bcf74 | ||
|
|
43d0bb1292 | ||
|
|
e56352bf74 | ||
|
|
7746b0ce1a | ||
|
|
806443e956 | ||
|
|
a5d0e6eba2 | ||
|
|
ac9371a2ed | ||
|
|
f3abb0a828 | ||
|
|
c653efc7b1 | ||
|
|
bcd7d9a29b | ||
|
|
dd7ef41590 | ||
|
|
d7c9730712 | ||
|
|
735bc64a2d | ||
|
|
307d6502af | ||
|
|
91a4e270c6 | ||
|
|
d13e60a122 | ||
|
|
c4be3a1ac0 | ||
|
|
7c7eed4a3d | ||
|
|
d0271e0be0 | ||
|
|
9d71ecded7 | ||
|
|
81af88e7a4 | ||
|
|
a8f7fd2d02 | ||
|
|
de71e5156c | ||
|
|
bcf27f0489 | ||
|
|
972445a8bc | ||
|
|
460e0b8daf | ||
|
|
3673d195ea | ||
|
|
77c6ac8507 | ||
|
|
cd35f4a3ab | ||
|
|
217df7cd65 | ||
|
|
ccfdef4fe8 | ||
|
|
b40ec48136 | ||
|
|
064331de0e | ||
|
|
5ef52ca622 | ||
|
|
15c51a4ab1 | ||
|
|
7e2b364c08 | ||
|
|
0b18e4995c | ||
|
|
f0fb5ef009 | ||
|
|
ec0c381fb6 | ||
|
|
58f7693024 | ||
|
|
40f6e67d83 | ||
|
|
852daa4e32 | ||
|
|
bf65a73eb1 | ||
|
|
3577d7e0a1 | ||
|
|
1371744b36 | ||
|
|
cf3b1cf683 | ||
|
|
416a88143f | ||
|
|
55719bb638 | ||
|
|
c22fe34e7c | ||
|
|
69154410f2 | ||
|
|
4975ebcc47 | ||
|
|
e4180a6e65 | ||
|
|
e22b8f141e | ||
|
|
7d29525b48 | ||
|
|
f47cc495b0 | ||
|
|
bc516d5a8e | ||
|
|
b54fcd2087 | ||
|
|
7e7d12e4e8 | ||
|
|
8d9fc61158 | ||
|
|
bc5635ed0a | ||
|
|
0b7ca97939 | ||
|
|
7e0a2e4770 | ||
|
|
c82443e221 | ||
|
|
1d7b7c2ac7 | ||
|
|
59f792f7c0 | ||
|
|
84ac59f66a | ||
|
|
d176e69cc1 | ||
|
|
59f61e057e | ||
|
|
601d58c51f | ||
|
|
ac33a1f687 | ||
|
|
91ebdbf5ab | ||
|
|
c8fb92e400 | ||
|
|
80a64e82dd | ||
|
|
780278b519 | ||
|
|
b4544ae90f | ||
|
|
0af1143e72 | ||
|
|
48eb6bf9ae | ||
|
|
f8940c79f5 | ||
|
|
4b7d2aa125 | ||
|
|
d4832ad2b8 | ||
|
|
54d5365907 | ||
|
|
2922e3ba92 | ||
|
|
820b6e0e0e | ||
|
|
75514ef1f0 | ||
|
|
ab34ca36d9 | ||
|
|
15f6541621 | ||
|
|
99c1b1f6b6 | ||
|
|
32258461be | ||
|
|
b7f332fd3b | ||
|
|
09068f20c5 | ||
|
|
59bf049159 | ||
|
|
d6b69863ca | ||
|
|
68d0c2fc81 | ||
|
|
5b89a28198 | ||
|
|
705be0e3c9 | ||
|
|
b5f8c28fc1 | ||
|
|
79f797213c | ||
|
|
424b6bb2ec | ||
|
|
efccb144a4 | ||
|
|
a960f34381 | ||
|
|
11e3428145 | ||
|
|
cde35287c7 | ||
|
|
29898ba91e | ||
|
|
2d25517bfa | ||
|
|
e3219ac24b | ||
|
|
c4fb6243c5 | ||
|
|
d021fd69e6 | ||
|
|
cacfe568a2 | ||
|
|
9d0c66fb2b | ||
|
|
cb100330ad | ||
|
|
bc0972318f | ||
|
|
2b02843cfd | ||
|
|
3a88fa4ae4 | ||
|
|
398a694ccd | ||
|
|
14a29344b8 | ||
|
|
47621a7ccb | ||
|
|
c1d66496fb | ||
|
|
1365ec736b | ||
|
|
4aee17de2d | ||
|
|
5c9ad32522 | ||
|
|
366aa8b3b3 | ||
|
|
905f2c723b | ||
|
|
0e028d9a4a | ||
|
|
ce61b992f9 | ||
|
|
e62573036c | ||
|
|
e27b2e5fdf | ||
|
|
fdd4a86c40 | ||
|
|
15012fd3b4 | ||
|
|
1f440e1a07 | ||
|
|
567a494ccb | ||
|
|
d28c4dc5e0 | ||
|
|
7a052b7e2f | ||
|
|
988397318f | ||
|
|
0d6356ba47 | ||
|
|
0ea71ea6b8 | ||
|
|
08ff64d950 | ||
|
|
fcffca21ff | ||
|
|
95adfd1fbd | ||
|
|
5029d33528 | ||
|
|
c9ab42ecfb | ||
|
|
7c48af9b84 | ||
|
|
e1d6e3cdbe | ||
|
|
648010d519 | ||
|
|
9d3cb60f41 | ||
|
|
e2ad6b75d2 | ||
|
|
486fb5825b | ||
|
|
e56eb0e3ab | ||
|
|
6fe6a80f40 | ||
|
|
f7b30c3129 | ||
|
|
1062da3dcc | ||
|
|
c431118465 | ||
|
|
b6a1a57bed | ||
|
|
83baa09384 | ||
|
|
8a69c64de3 | ||
|
|
488e53149c | ||
|
|
2bc30edf4c | ||
|
|
8d544448f1 | ||
|
|
f7b560a28b | ||
|
|
0e578710f3 | ||
|
|
65df456066 | ||
|
|
5b694c2c55 | ||
|
|
6406504f94 | ||
|
|
b7c4538896 | ||
|
|
c7d988bd61 | ||
|
|
47e968927a | ||
|
|
dcf196ec4a | ||
|
|
aff1b062e1 | ||
|
|
59f6e4bd33 | ||
|
|
0b9af7e6b2 | ||
|
|
d9b5f8d86c | ||
|
|
0360c181c0 | ||
|
|
47ff7bf223 | ||
|
|
bedf77e83d | ||
|
|
151e3a8d6f | ||
|
|
7170ee20d4 | ||
|
|
768d793ba0 | ||
|
|
5501a20426 | ||
|
|
1a7453d6b6 | ||
|
|
d379133801 | ||
|
|
333c2b2a90 | ||
|
|
ab45f6bb52 | ||
|
|
a2e59992d9 | ||
|
|
e9ed10d08c | ||
|
|
d1a1bb5fa7 | ||
|
|
c3c7f9506f | ||
|
|
8c4d947833 | ||
|
|
80bbf1bd36 | ||
|
|
f05d2564fa | ||
|
|
81e63fb88e | ||
|
|
a7c9be6fc3 | ||
|
|
76393754fb | ||
|
|
10eb1b0d31 | ||
|
|
c3ad9b3d48 | ||
|
|
e2a0b7c840 |
@@ -0,0 +1,19 @@
|
||||
# Git
|
||||
.git/
|
||||
|
||||
# IDE
|
||||
**/*.idea
|
||||
backup
|
||||
|
||||
# Python
|
||||
**/*.egg-info
|
||||
**/*.pyc
|
||||
**/__pycache__
|
||||
**/venv
|
||||
|
||||
# Unit Test
|
||||
**/.coverage
|
||||
**/coverage.xml
|
||||
**/xunit.xml
|
||||
**/coverage
|
||||
tmp/
|
||||
@@ -0,0 +1,3 @@
|
||||
github: [budtmo]
|
||||
custom:
|
||||
- "paypal.me/budtmo"
|
||||
@@ -0,0 +1,45 @@
|
||||
name: 🐛 Bug Report
|
||||
description: File a bug report
|
||||
title: "[🐛 Bug ]: "
|
||||
labels: [bug]
|
||||
body:
|
||||
- type: input
|
||||
id: operating-system
|
||||
attributes:
|
||||
label: Operating System
|
||||
description: Which host operating system do you use?
|
||||
placeholder: e.g. OSX Yosemite / Ubuntu 20.04 / Windows 10 etc
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: docker-image
|
||||
attributes:
|
||||
label: Docker Image
|
||||
description: Which docker image do you use?
|
||||
placeholder: e.g. budtmo/docker-android:emulator_10.0_v2.0 / budtmo/docker-android:genymotion_v2.0 etc
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: expected-behaviour
|
||||
attributes:
|
||||
label: Expected behaviour
|
||||
description: |
|
||||
What behaviour that you expected?
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: actual-behaviour
|
||||
attributes:
|
||||
label: Actual behaviour
|
||||
description: |
|
||||
What is the actual behaviour?
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: Logs
|
||||
description: |
|
||||
Please provide logs here
|
||||
validations:
|
||||
required: false
|
||||
@@ -0,0 +1,45 @@
|
||||
name: 🐛 [Pro version] Bug Report
|
||||
description: File a bug report
|
||||
title: "[🐛 PRO | Bug ]: "
|
||||
labels: [bug, pro]
|
||||
body:
|
||||
- type: input
|
||||
id: operating-system
|
||||
attributes:
|
||||
label: Operating System
|
||||
description: Which host operating system do you use?
|
||||
placeholder: e.g. OSX Yosemite / Ubuntu 20.04 / Windows 10 etc
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: docker-image
|
||||
attributes:
|
||||
label: Docker Image
|
||||
description: Which docker image do you use?
|
||||
placeholder: e.g. budtmo/docker-android-pro:emulator_10.0_v2.0 / budtmo/docker-android-pro:emulator_headless_10.0_v2.0 etc
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: expected-behaviour
|
||||
attributes:
|
||||
label: Expected behaviour
|
||||
description: |
|
||||
What behaviour that you expected?
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: actual-behaviour
|
||||
attributes:
|
||||
label: Actual behaviour
|
||||
description: |
|
||||
What is the actual behaviour?
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: Logs
|
||||
description: |
|
||||
Please provide logs here
|
||||
validations:
|
||||
required: false
|
||||
@@ -0,0 +1,5 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: 📖 Docker-Android Documentation
|
||||
url: https://github.com/budtmo/docker-android
|
||||
about: Please read the whole project README before filling out an issue.
|
||||
@@ -0,0 +1,29 @@
|
||||
name: 🚀 Feature Request
|
||||
description: Submit your idea to have cool feature(s)
|
||||
title: "[🚀 Feature Request ]: "
|
||||
labels: [feature-request]
|
||||
body:
|
||||
- type: textarea
|
||||
id: idea
|
||||
attributes:
|
||||
label: Idea
|
||||
description: |
|
||||
What is the idea that you want to share to improve the project?
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: problem
|
||||
attributes:
|
||||
label: Probelm to solve
|
||||
description: |
|
||||
What is the problem that you want to solve with requested feature?
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: Note
|
||||
attributes:
|
||||
label: Additional Note
|
||||
description: |
|
||||
Please share any additional information here if needed
|
||||
validations:
|
||||
required: false
|
||||
@@ -0,0 +1,8 @@
|
||||
### Types of changes
|
||||
_Put an `x` in the boxes that apply_
|
||||
|
||||
- [ ] Bug fix (non-breaking change which fixes an issue)
|
||||
- [ ] New feature (non-breaking change which adds functionality)
|
||||
|
||||
### Purpose of changes
|
||||
<!-- Please describe why this change is required / What problem you want to solve. -->
|
||||
@@ -0,0 +1,40 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: docker
|
||||
directory: "/docker"
|
||||
schedule:
|
||||
interval: daily
|
||||
time: '01:00'
|
||||
timezone: "Europe/Berlin"
|
||||
commit-message:
|
||||
prefix: "[docker] "
|
||||
target-branch: "master"
|
||||
open-pull-requests-limit: 99
|
||||
reviewers:
|
||||
- "budtmo"
|
||||
|
||||
- package-ecosystem: pip
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: daily
|
||||
time: '01:00'
|
||||
timezone: "Europe/Berlin"
|
||||
commit-message:
|
||||
prefix: "[pip] "
|
||||
target-branch: "master"
|
||||
open-pull-requests-limit: 99
|
||||
reviewers:
|
||||
- "budtmo"
|
||||
|
||||
- package-ecosystem: github-actions
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: daily
|
||||
time: '01:00'
|
||||
timezone: "Europe/Berlin"
|
||||
commit-message:
|
||||
prefix: "[github-action] "
|
||||
target-branch: "master"
|
||||
open-pull-requests-limit: 99
|
||||
reviewers:
|
||||
- "budtmo"
|
||||
@@ -0,0 +1,82 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*.*-*'
|
||||
|
||||
jobs:
|
||||
run_test:
|
||||
runs-on: ubuntu-20.04
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ["3.8"]
|
||||
steps:
|
||||
- name: Checkout the repo
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
cd cli
|
||||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
||||
|
||||
- name: Run test
|
||||
run: |
|
||||
cd cli && nosetests -v
|
||||
|
||||
release_base:
|
||||
runs-on: ubuntu-20.04
|
||||
needs: run_test
|
||||
steps:
|
||||
- name: Checkout the repo
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Get release version
|
||||
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
||||
|
||||
- name: Build and push base image (${RELEASE_VERSION})
|
||||
run: |
|
||||
docker login -u=${{secrets.DOCKER_USERNAME}} -p=${{secrets.DOCKER_PASSWORD}}
|
||||
./app.sh push base ${RELEASE_VERSION}
|
||||
docker logout
|
||||
|
||||
release_emulator:
|
||||
runs-on: ubuntu-20.04
|
||||
needs: release_base
|
||||
strategy:
|
||||
matrix:
|
||||
android: ["9.0", "10.0", "11.0", "12.0", "13.0"]
|
||||
steps:
|
||||
- name: Checkout the repo
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Get release version
|
||||
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
||||
|
||||
- name: Build and push emulator image ${{ matrix.android }} (${RELEASE_VERSION})
|
||||
run: |
|
||||
docker login -u=${{secrets.DOCKER_USERNAME}} -p=${{secrets.DOCKER_PASSWORD}}
|
||||
./app.sh push emulator ${RELEASE_VERSION} ${{ matrix.android }}
|
||||
docker logout
|
||||
|
||||
release_genymotion:
|
||||
runs-on: ubuntu-20.04
|
||||
needs: release_base
|
||||
steps:
|
||||
- name: Checkout the repo
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Get release version
|
||||
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
||||
|
||||
- name: Build and push genymotion image (${RELEASE_VERSION})
|
||||
run: |
|
||||
docker login -u=${{secrets.DOCKER_USERNAME}} -p=${{secrets.DOCKER_PASSWORD}}
|
||||
./app.sh push genymotion ${RELEASE_VERSION}
|
||||
docker logout
|
||||
@@ -0,0 +1,25 @@
|
||||
name: Run Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build_and_test:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout the repo
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Build base image
|
||||
run: script -e -c "./app.sh build base test"
|
||||
|
||||
- name: Build emulator image and run unit-test
|
||||
run: script -e -c "./app.sh test emulator test 11.0 && sudo mv tmp/* ."
|
||||
|
||||
- name: Publish test result
|
||||
run: bash <(curl -s https://codecov.io/bash)
|
||||
@@ -1,9 +1,20 @@
|
||||
.idea/*
|
||||
.DS_Store
|
||||
*.pyc
|
||||
# IDE
|
||||
**/*.idea
|
||||
backup
|
||||
|
||||
# Coverage
|
||||
.coverage
|
||||
coverage.xml
|
||||
xunit.xml
|
||||
coverage/*
|
||||
# Python
|
||||
**/*.egg-info
|
||||
**/*.pyc
|
||||
**/__pycache__
|
||||
**/venv
|
||||
|
||||
# Unit Test
|
||||
**/.coverage
|
||||
**/coverage.xml
|
||||
**/xunit.xml
|
||||
**/coverage
|
||||
tmp/
|
||||
|
||||
# Dev-files
|
||||
n*.txt
|
||||
test-*.sh
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
language: python
|
||||
|
||||
python:
|
||||
- "3.5"
|
||||
|
||||
sudo: required
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
||||
install: "pip install -r requirements.txt"
|
||||
|
||||
env:
|
||||
matrix:
|
||||
- ANDROID_VERSION=5.0.1
|
||||
- ANDROID_VERSION=5.1.1
|
||||
- ANDROID_VERSION=6.0
|
||||
- ANDROID_VERSION=7.0
|
||||
- ANDROID_VERSION=7.1.1
|
||||
|
||||
script: bash travis.sh
|
||||
|
||||
after_success:
|
||||
- bash <(curl -s https://codecov.io/bash)
|
||||
@@ -1,175 +0,0 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
|
||||
#=============
|
||||
# Set WORKDIR
|
||||
#=============
|
||||
WORKDIR /root
|
||||
|
||||
#==================
|
||||
# General Packages
|
||||
#------------------
|
||||
# wget
|
||||
# Network downloader
|
||||
# unzip
|
||||
# Unzip zip file
|
||||
# curl
|
||||
# Transfer data from or to a server
|
||||
# xterm
|
||||
# Terminal emulator
|
||||
# supervisor
|
||||
# Process manager
|
||||
# openjdk-8-jdk
|
||||
# Java
|
||||
# libqt5webkit5
|
||||
# Web content engine (Fix issue in Android)
|
||||
# socat
|
||||
# Port forwarder
|
||||
#------------------
|
||||
# NoVNC Packages
|
||||
#------------------
|
||||
# xvfb
|
||||
# X virtual framebuffer
|
||||
# x11vnc
|
||||
# VNC server for X display
|
||||
# openbox
|
||||
# Windows manager
|
||||
# menu
|
||||
# Debian menu
|
||||
# python-numpy
|
||||
# Numpy, For faster performance: https://github.com/novnc/websockify/issues/77
|
||||
# net-tools
|
||||
# Netstat
|
||||
#------------------
|
||||
# KVM Package
|
||||
# for emulator x86
|
||||
# https://help.ubuntu.com/community/KVM/Installation
|
||||
#------------------
|
||||
# qemu-kvm
|
||||
# libvirt-bin
|
||||
# ubuntu-vm-builder
|
||||
# bridge-utils
|
||||
#==================
|
||||
RUN apt-get -qqy update && apt-get -qqy install --no-install-recommends \
|
||||
wget \
|
||||
unzip \
|
||||
curl \
|
||||
xterm \
|
||||
supervisor \
|
||||
openjdk-8-jdk \
|
||||
libqt5webkit5 \
|
||||
socat \
|
||||
xvfb \
|
||||
x11vnc \
|
||||
openbox \
|
||||
menu \
|
||||
python-numpy \
|
||||
net-tools \
|
||||
qemu-kvm \
|
||||
libvirt-bin \
|
||||
ubuntu-vm-builder \
|
||||
bridge-utils \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
#=======
|
||||
# noVNC
|
||||
# Use same commit id that docker-selenium uses
|
||||
# https://github.com/elgalu/docker-selenium/blob/236b861177bd2917d864e52291114b1f5e4540d7/Dockerfile#L412-L413
|
||||
#=======
|
||||
ENV NOVNC_SHA="b403cb92fb8de82d04f305b4f14fa978003890d7" \
|
||||
WEBSOCKIFY_SHA="558a6439f14b0d85a31145541745e25c255d576b"
|
||||
RUN wget -nv -O noVNC.zip "https://github.com/kanaka/noVNC/archive/${NOVNC_SHA}.zip" \
|
||||
&& unzip -x noVNC.zip \
|
||||
&& rm noVNC.zip \
|
||||
&& mv noVNC-${NOVNC_SHA} noVNC \
|
||||
&& wget -nv -O websockify.zip "https://github.com/kanaka/websockify/archive/${WEBSOCKIFY_SHA}.zip" \
|
||||
&& unzip -x websockify.zip \
|
||||
&& mv websockify-${WEBSOCKIFY_SHA} ./noVNC/utils/websockify \
|
||||
&& rm websockify.zip \
|
||||
&& ln noVNC/vnc_auto.html noVNC/index.html
|
||||
|
||||
#=====================
|
||||
# Install Android SDK
|
||||
#=====================
|
||||
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/jre
|
||||
ENV PATH ${PATH}:${JAVA_HOME}/bin
|
||||
|
||||
ENV SDK_VERSION=25.2.3 \
|
||||
ANDROID_HOME=/root
|
||||
RUN wget -nv -O android.zip https://dl.google.com/android/repository/tools_r${SDK_VERSION}-linux.zip \
|
||||
&& unzip android.zip && rm android.zip
|
||||
ENV PATH ${PATH}:${ANDROID_HOME}/tools
|
||||
RUN echo y | android update sdk --no-ui -a --filter platform-tools
|
||||
ENV PATH ${PATH}:${ANDROID_HOME}/platform-tools
|
||||
|
||||
#====================================
|
||||
# Install latest nodejs, npm, appium
|
||||
#====================================
|
||||
RUN curl -sL https://deb.nodesource.com/setup_7.x | bash - \
|
||||
&& apt-get -qqy update && apt-get -qqy install nodejs && rm -rf /var/lib/apt/lists/*
|
||||
ENV APPIUM_VERSION 1.6.3
|
||||
RUN npm install -g appium@$APPIUM_VERSION && npm cache clean
|
||||
|
||||
#======================
|
||||
# Install SDK packages
|
||||
#======================
|
||||
ARG ANDROID_VERSION=5.0.1
|
||||
ARG BUILD_TOOL=21.1.2
|
||||
ARG API_LEVEL=21
|
||||
ARG PROCESSOR=x86
|
||||
ARG SYS_IMG=x86_64
|
||||
ARG IMG_TYPE=google_apis
|
||||
ENV ANDROID_VERSION=$ANDROID_VERSION \
|
||||
BUILD_TOOL=$BUILD_TOOL \
|
||||
API_LEVEL=$API_LEVEL \
|
||||
PROCESSOR=$PROCESSOR \
|
||||
SYS_IMG=$SYS_IMG \
|
||||
IMG_TYPE=$IMG_TYPE
|
||||
RUN echo y | android update sdk --no-ui -a --filter build-tools-${BUILD_TOOL}
|
||||
ENV PATH ${PATH}:${ANDROID_HOME}/build-tools
|
||||
|
||||
RUN rm ${ANDROID_HOME}/tools/emulator \
|
||||
&& ln -s ${ANDROID_HOME}/tools/emulator64-${PROCESSOR} ${ANDROID_HOME}/tools/emulator
|
||||
RUN echo y | android update sdk --no-ui -a -t android-${API_LEVEL},sys-img-${SYS_IMG}-${IMG_TYPE}-${API_LEVEL}
|
||||
|
||||
#================================================
|
||||
# noVNC Default Configurations
|
||||
# These Configurations can be changed through -e
|
||||
#================================================
|
||||
ENV DISPLAY=:0 \
|
||||
SCREEN=0 \
|
||||
SCREEN_WIDTH=1600 \
|
||||
SCREEN_HEIGHT=900 \
|
||||
SCREEN_DEPTH=16 \
|
||||
LOCAL_PORT=5900 \
|
||||
TARGET_PORT=6080 \
|
||||
TIMEOUT=1 \
|
||||
LOG_PATH=/var/log/supervisor
|
||||
|
||||
#===============
|
||||
# Expose Ports
|
||||
#---------------
|
||||
# 4723
|
||||
# Appium port
|
||||
# 6080
|
||||
# noVNC port
|
||||
# 5554
|
||||
# Emulator port
|
||||
# 5555
|
||||
# ADB connection port
|
||||
#===============
|
||||
EXPOSE 4723 6080 5554 5555
|
||||
|
||||
#======================
|
||||
# Add Emulator Devices
|
||||
#======================
|
||||
COPY devices /root/devices
|
||||
|
||||
#===================
|
||||
# Run docker-appium
|
||||
#===================
|
||||
COPY src /root/src
|
||||
COPY supervisord.conf /root/
|
||||
RUN chmod -R +x /root/src && chmod +x /root/supervisord.conf
|
||||
CMD /usr/bin/supervisord --configuration supervisord.conf
|
||||
@@ -1,13 +0,0 @@
|
||||
Copyright 2016 budi utomo
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -0,0 +1,46 @@
|
||||
## License Information
|
||||
|
||||
Copyright 2023 budi utomo
|
||||
|
||||
This program is subject to the terms of the Apache License, Version 2.0 AND the following amendments on forks and data processing. Thus, this is a Custom Apache 2.0 License, NOT a dual-license model you may choose from.
|
||||
|
||||
|
||||
You can obtain a copy of the license at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
||||
|
||||
|
||||
## Forks
|
||||
Additionally to Apache-2.0, when you fork this repo you are required to either remove our Google Form ID: 1FAIpQLSdrKWQdMh6Nt8v8NQdYvTIntohebAgqWCpXT3T9NofAoxcpkw or stop usage gathering completely.
|
||||
|
||||
## Data processing agreement
|
||||
By using this software you agree that the following non-PII (non personally identifiable information) data will be collected, processed and used by the maintainers for the purpose of improving the docker-android project.
|
||||
|
||||
|
||||
By using this software you also grant us a nonexclusive, irrevocable, world-wide, perpetual royalty-free permission to use, modify and publish these data for all purposes, internally or publicly, including the right to sub-license said permission rights.
|
||||
|
||||
|
||||
We collect, process and use the following data:
|
||||
|
||||
* Date and time when Docker-Android started
|
||||
* User (it will collect the information about Release Version of Machine), e.g. Linux-5.4.0-146-generic-x86_64-with-glibc2.29_#163-Ubuntu_SMP_Fri_Mar_17_18:26:02_UTC_2023. This does not allow us to track individual users but does enable us to accurately measure user counts
|
||||
* City (the information come from https://ipinfo.io)
|
||||
* Region (the information come from https://ipinfo.io)
|
||||
* Country (the information come from https://ipinfo.io)
|
||||
* Release version of Docker-Android
|
||||
* Appium (Whether user use Appium or not - The possible value will be "true" or "false")
|
||||
* Appium Additional Arguments
|
||||
* Web-Log (Whether user use Web-Log feature or not - The possible value will be "true" or "false")
|
||||
* Web-Vnc (Whether user use Web-Vnc feature or not - The possible value will be "true" or "false")
|
||||
* Screen-Resolution
|
||||
* Device Type (Which docker image is used - The possible value will be "emulator" or "geny_cloud" or "geny_aws")
|
||||
* Emulator Device (Which device profile and skin is used if the user use device_type "emulator")
|
||||
* Emulator Android Version (Which Android version is used if the user use device_type "emulator"
|
||||
* Emulator No-Skin feature (Whether user use no-skin feature or not - The possible value will be "true" or "false")
|
||||
* Emulator Data Partition
|
||||
* Emulator Additional Arguments
|
||||
|
||||
## End of License Information
|
||||
|
||||
More information about anonymized data collection can be seen [here](./documentations/USER_BEHAVIOR_ANALYTICS.md)
|
||||
@@ -1 +0,0 @@
|
||||
Budi Utomo <budi.ut.1989@gmail.com>
|
||||
@@ -0,0 +1 @@
|
||||
Budi Utomo <budtmo.os@gmail.com>
|
||||
@@ -1,196 +1,167 @@
|
||||
Docker-Android
|
||||
==============
|
||||
|
||||
[](https://travis-ci.org/butomo1989/docker-android)
|
||||
[](https://codecov.io/gh/butomo1989/docker-android)
|
||||
<p align="center">
|
||||
<img id="header" src="./images/logo_docker-android.png" />
|
||||
</p>
|
||||
|
||||
Docker-Android is an android environment, an android emulator that facilitates different devices and [appium] in docker solution integrated with noVNC.
|
||||
[](http://paypal.me/budtmo) [](http://makeapullrequest.com) [](https://codecov.io/gh/budtmo/docker-android) [](https://gitter.im/budtmo/docker-android?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [](https://github.com/budtmo/docker-android/releases)
|
||||
|
||||
Samsung Device | Google Device
|
||||
:---------------------------:|:---------------------------:
|
||||
![][docker android samsung] | ![][docker android nexus]
|
||||
Docker-Android is a docker image built to be used for everything related to Android. It can be used for Application development and testing (native, web and hybrid-app).
|
||||
|
||||
Purpose
|
||||
-------
|
||||
Advantages of using this projects
|
||||
---------------------------------
|
||||
1. Emulator with different device profile and skins, such as Samsung Galaxy S6, LG Nexus 4, HTC Nexus One and more.
|
||||
2. Support vnc to be able to see what happen inside docker container
|
||||
3. Support log sharing feature where all logs can be accessed from web-UI
|
||||
4. Ability to control emulator from outside container by using adb connect
|
||||
5. Integrated with other cloud solutions, e.g. [Genymotion Cloud](https://www.genymotion.com/cloud/)
|
||||
6. It can be used to build Android project
|
||||
7. It can be used to run unit and UI-Test with different test-frameworks, e.g. Appium, Espresso, etc.
|
||||
|
||||
1. Build android project and run unit test inside container
|
||||
2. Run UI Test for mobile application with different frameworks (appium, espresso, etc.)
|
||||
3. Run UI Test for mobile website with appium test framework
|
||||
4. Video recording to analyse failing test cases ***(soon)***
|
||||
5. Monkey test for stress test ***(soon)***
|
||||
|
||||
Advantages compare with other docker-android projects
|
||||
-----------------------------------------------------
|
||||
|
||||
1. noVNC to see what happen inside docker container
|
||||
2. Android emulator that facilitates different devices
|
||||
3. Able to connect with selenium grid
|
||||
4. Able to control emulator from outside container by using adb connect
|
||||
5. It will have more important features for testing purpose like video recording and monkey test ***(soon)***
|
||||
|
||||
List of Docker images
|
||||
List of Docker-Images
|
||||
---------------------
|
||||
|
||||
|Supported OS |Android version |API level |Image name |Image status |
|
||||
|:---|:---|:---|:---|:---:|
|
||||
|Linux|5.0.1|21|butomo1989/docker-android-x86-5.0.1|[](https://microbadger.com/images/butomo1989/docker-android-x86-5.0.1 "Get your own image badge on microbadger.com")|
|
||||
|Linux|5.1.1|22|butomo1989/docker-android-x86-5.1.1|[](https://microbadger.com/images/butomo1989/docker-android-x86-5.1.1 "Get your own image badge on microbadger.com")|
|
||||
|Linux|6.0|23|butomo1989/docker-android-x86-6.0|[](https://microbadger.com/images/butomo1989/docker-android-x86-6.0 "Get your own image badge on microbadger.com")|
|
||||
|Linux|7.0|24|butomo1989/docker-android-x86-7.0|[](https://microbadger.com/images/butomo1989/docker-android-x86-7.0 "Get your own image badge on microbadger.com")|
|
||||
|Linux|7.1.1|25|butomo1989/docker-android-x86-7.1.1|[](https://microbadger.com/images/butomo1989/docker-android-x86-7.1.1 "Get your own image badge on microbadger.com")|
|
||||
|OSX / Windows|5.0.1|21|butomo1989/docker-android-arm-5.0.1|[](https://microbadger.com/images/butomo1989/docker-android-arm-5.0.1 "Get your own image badge on microbadger.com")|
|
||||
|OSX / Windows|5.1.1|22|butomo1989/docker-android-arm-5.1.1|[](https://microbadger.com/images/butomo1989/docker-android-arm-5.1.1 "Get your own image badge on microbadger.com")|
|
||||
|OSX / Windows|6.0|23|butomo1989/docker-android-arm-6.0|[](https://microbadger.com/images/butomo1989/docker-android-arm-6.0 "Get your own image badge on microbadger.com")|
|
||||
|OSX / Windows|7.0|24|butomo1989/docker-android-arm-7.0|[](https://microbadger.com/images/butomo1989/docker-android-arm-7.0 "Get your own image badge on microbadger.com")|
|
||||
|OSX / Windows|7.1.1|25|butomo1989/docker-android-arm-7.1.1|[](https://microbadger.com/images/butomo1989/docker-android-arm-7.1.1 "Get your own image badge on microbadger.com")|
|
||||
|Android |API |Image with latest release version |Image with specific release version|
|
||||
|:---|:---|:---|:---|
|
||||
|9.0|28|budtmo/docker-android:emulator_9.0|budtmo/docker-android:emulator_9.0_<release_version>|
|
||||
|10.0|29|budtmo/docker-android:emulator_10.0|budtmo/docker-android:emulator_10.0_<release_version>|
|
||||
|11.0|30|budtmo/docker-android:emulator_11.0|budtmo/docker-android:emulator_11.0_<release_version>|
|
||||
|12.0|32|budtmo/docker-android:emulator_12.0|budtmo/docker-android:emulator_12.0_<release_version>|
|
||||
|13.0|33|budtmo/docker-android:emulator_13.0|budtmo/docker-android:emulator_13.0_<release_version>|
|
||||
|-|-|budtmo/docker-android:genymotion|budtmo/docker-android:genymotion_<release_version>|
|
||||
|
||||
List of Devices
|
||||
---------------
|
||||
|
||||
Type | Device Name
|
||||
----- | -----
|
||||
Phone | Samsung Galaxy S10
|
||||
Phone | Samsung Galaxy S9
|
||||
Phone | Samsung Galaxy S8
|
||||
Phone | Samsung Galaxy S7 Edge
|
||||
Phone | Samsung Galaxy S7
|
||||
Phone | Samsung Galaxy S6
|
||||
Phone | Nexus 4
|
||||
Phone | Nexus 5
|
||||
Phone | Nexus 5x
|
||||
Phone | Nexus 6
|
||||
Phone | Nexus 6P
|
||||
Phone | Nexus One
|
||||
Phone | Nexus S
|
||||
Tablet | Pixel C
|
||||
Tablet | Nexus 7
|
||||
Tablet | Nexus 9
|
||||
Tablet | Nexus 10
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
Docker is installed in your system.
|
||||
1. Docker is installed on your system.
|
||||
|
||||
Quick Start
|
||||
-----------
|
||||
|
||||
1. Run docker-android
|
||||
1. If you use ***Ubuntu OS*** on your host machine, you can skip this step. For ***OSX*** and ***Windows OS*** user, you need to use Virtual Machine that support Virtualization with Ubuntu OS because the image can be run under ***Ubuntu OS only***.
|
||||
|
||||
- For ***Linux OS***, please use image name that contains "x86"
|
||||
2. Your machine should support virtualization. To check if the virtualization is enabled is:
|
||||
```
|
||||
sudo apt install cpu-checker
|
||||
kvm-ok
|
||||
```
|
||||
|
||||
```bash
|
||||
docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -e DEVICE="Samsung Galaxy S6" --name android-container butomo1989/docker-android-x86-7.1.1
|
||||
```
|
||||
3. Run Docker-Android container
|
||||
```
|
||||
docker run -d -p 6080:6080 -e EMULATOR_DEVICE="Samsung Galaxy S10" -e WEB_VNC=true --device /dev/kvm --name android-container budtmo/docker-android:emulator_11.0
|
||||
```
|
||||
|
||||
- For ***OSX*** and ***Windows OS***, please use image name that contains "arm"
|
||||
4. Open ***http://localhost:6080*** to see inside running container.
|
||||
|
||||
```bash
|
||||
docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -e DEVICE="Samsung Galaxy S6" --name android-container butomo1989/docker-android-arm-7.1.1
|
||||
```
|
||||
5. To check the status of the emulator
|
||||
```
|
||||
docker exec -it android-container cat device_status
|
||||
```
|
||||
|
||||
2. Verify the ip address of docker host.
|
||||
WSL2 Hardware acceleration (Windows 11 only)
|
||||
-----------
|
||||
|
||||
- For OSX, you can find out by using following command:
|
||||
Credit goes to [Guillaume - The Parallel Interface blog](https://www.paralint.com/2022/11/find-new-modified-and-unversioned-subversion-files-on-windows)
|
||||
|
||||
```bash
|
||||
docker-machine ip default
|
||||
```
|
||||
[Microsoft - Advanced settings configuration in WSL](https://learn.microsoft.com/en-us/windows/wsl/wsl-config)
|
||||
|
||||
- For different OS, localhost should work.
|
||||
|
||||
3. Open ***http://docker-host-ip-address:6080*** from web browser.
|
||||
1. Add yourself to the `kvm` usergroup.
|
||||
```
|
||||
sudo usermod -a -G kvm ${USER}
|
||||
```
|
||||
|
||||
Run Appium Server
|
||||
-----------------
|
||||
2. Add necessary flags to `/etc/wsl2.conf` to their respective sections.
|
||||
```
|
||||
[boot]
|
||||
command = /bin/bash -c 'chown -v root:kvm /dev/kvm && chmod 660 /dev/kvm'
|
||||
|
||||
Appium is automation test framework to test mobile website and mobile application, including android. To be able to use appium, you need to run appium-server. You run appium server inside docker-android container by ***opening port 4723*** and ***passing an environment variable APPIUM=TRUE***.
|
||||
[wsl2]
|
||||
nestedVirtualization=true
|
||||
```
|
||||
3. Restart WSL2 via CMD prompt or Powershell
|
||||
```
|
||||
wsl --shutdown
|
||||
```
|
||||
|
||||
```bash
|
||||
docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -p 4723:4723 -e DEVICE="Samsung Galaxy S6" -e APPIUM=True --name android-container butomo1989/docker-android-x86-7.1.1
|
||||
```
|
||||
|
||||
### Connect to Selenium Grid
|
||||
`command = /bin/bash -c 'chown -v root:kvm /dev/kvm && chmod 660 /dev/kvm'` sets `/dev/kvm` to `kvm` usergroup rather than the default `root` usergroup on WSL2 startup.
|
||||
|
||||
![][selenium grid]
|
||||
![][devices are connected with selenium grid]
|
||||
`nestedVirtualization` flag is only available to Windows 11.
|
||||
|
||||
It is also possible to connect appium server that run inside docker-android with selenium grid by passing following environment variables:
|
||||
Use-Cases
|
||||
---------
|
||||
|
||||
- CONNECT\_TO\_GRID=True
|
||||
- APPIUM_HOST="\<host\_ip\_address>"
|
||||
- APPIUM_PORT=\<port\_number>
|
||||
- SELENIUM_HOST="\<host\_ip\_address>"
|
||||
- SELENIUM_PORT=\<port\_number>
|
||||
1. [Build Android project](./documentations/USE_CASE_BUILD_ANDROID_PROJECT.md)
|
||||
2. [UI-Test with Appium](./documentations/USE_CASE_APPIUM.md)
|
||||
3. [Control Android emulator on host machine](./documentations/USE_CASE_CONTROL_EMULATOR.md)
|
||||
4. [SMS Simulation](./documentations/USE_CASE_SMS.md)
|
||||
5. [Jenkins](./documentations/USE_CASE_JENKINS.md)
|
||||
6. [Deploying on cloud (Azure, AWS, GCP)](./documentations/USE_CASE_CLOUD.md)
|
||||
|
||||
```bash
|
||||
docker run --privileged -d --rm -p 6080:6080 -p 4723:4723 -p 5554:5554 -p 5555:5555 -e DEVICE="Samsung Galaxy S6" -e APPIUM=True -e CONNECT_TO_GRID=True -e APPIUM_HOST="127.0.0.1" -e APPIUM_PORT=4723 -e SELENIUM_HOST="172.17.0.1" -e SELENIUM_PORT=4444 --name android-container butomo1989/docker-android-x86-7.1.1
|
||||
```
|
||||
Custom-Configurations
|
||||
---------------------
|
||||
|
||||
### Share Volume
|
||||
This [document](./documentations/CUSTOM_CONFIGURATIONS.md) contains information about configurations that can be used to enable some features, e.g. log-sharing, etc.
|
||||
|
||||
If you want to use appium to test UI of your android application, you need to share volume where the APK is located to folder ***/root/tmp***.
|
||||
Genymotion
|
||||
----------
|
||||
|
||||
```bash
|
||||
docker run --privileged -it --rm -p 6080:6080 -p 4723:4723 -p 5554:5554 -p 5555:5555 -v $PWD/example/sample_apk:/root/tmp -e DEVICE="Nexus 5" -e APPIUM=True -e CONNECT_TO_GRID=True -e APPIUM_HOST="127.0.0.1" -e APPIUM_PORT=4723 -e SELENIUM_HOST="172.17.0.1" -e SELENIUM_PORT=4444 --name android-container butomo1989/docker-android-x86-7.1.1
|
||||
```
|
||||
<p align="center">
|
||||
<img id="geny" src="./images/logo_genymotion_and_dockerandroid.png" />
|
||||
</p>
|
||||
|
||||
Control android emulator outside container
|
||||
------------------------------------------
|
||||
For you who do not have ressources to maintain the simulator or to buy machines or need different device profiles, you can give a try by using [Genymotion SAAS](https://cloud.geny.io/). Docker-Android is [integrated with Genymotion](https://www.genymotion.com/blog/partner_tag/docker/) on different cloud services, e.g. Genymotion SAAS, AWS, GCP, Alibaba Cloud. Please follow [this document](./documentations/THIRD_PARTY_GENYMOTION.md) for more detail.
|
||||
|
||||
```bash
|
||||
adb connect <docker-machine-ip-address>:5555
|
||||
```
|
||||
|
||||
![][adb_connection]
|
||||
|
||||
**Note:** You need to have Android Debug Bridge (adb) installed in your host machine.
|
||||
|
||||
SMS Simulation
|
||||
Emulator Skins
|
||||
--------------
|
||||
The Emulator skins are taken from [Android Studio IDE](https://developer.android.com/studio) and [Samsung Developer Website](https://developer.samsung.com/)
|
||||
|
||||
1. Using telnet
|
||||
- Find the auth_token and copy it.
|
||||
USERS
|
||||
-----
|
||||
|
||||
```bash
|
||||
docker exec -it android-container cat /root/.emulator_console_auth_token
|
||||
```
|
||||
<a href="https://lookerstudio.google.com/s/iGaemHJqQvg">
|
||||
<p align="center">
|
||||
<img src="./images/docker-android_users.png" alt="docker-android-users" width="800" height="600">
|
||||
</p>
|
||||
</a>
|
||||
|
||||
- Access emulator using telnet and login with auth_token
|
||||
PRO VERSION
|
||||
-----------
|
||||
|
||||
```bash
|
||||
telnet <docker-machine-ip-address> 5554
|
||||
```
|
||||
Due to high requests for help and to be able to actively maintain the projects, the creator has decided to create docker-android-pro. Docker-Android-Pro is a sponsor based project which mean that the docker image of pro-version can be pulled only by [active sponsor](https://github.com/sponsors/budtmo).
|
||||
|
||||
- Login with given auth_token from 1.step
|
||||
The differences between normal version and pro version are:
|
||||
|
||||
```bash
|
||||
auth <auth_token>
|
||||
```
|
||||
|Feature |Normal |Pro |Comment|
|
||||
|:---|:---|:---|:---|
|
||||
|user-behavior-analytics|Yes|No|-|
|
||||
|proxy|No|Yes|Set up company proxy on Android emulator on fly|
|
||||
|language|No|Yes|Set up language on Android emulator on fly|
|
||||
|root-privileged|No|Yes|Able to run command with security privileged|
|
||||
|headless-mode|No|Yes|Save resources by using headless mode|
|
||||
|Selenium 4.x integration|No|Yes|Running Appium UI-Tests againt one (Selenium Hub) endpoint for Android- and iOS emulator(s) / device(s)|
|
||||
|multiple Android-Simulators|No|Yes (soon)|Save resources by having multiple Android-Simulators on one docker-container|
|
||||
|Google Play Store|No|Yes (soon)|-|
|
||||
|Video Recording|No|Yes (soon)|Helpful for debugging|
|
||||
|
||||
- Send the sms
|
||||
This [document](./documentations/DOCKER-ANDROID-PRO.md) contains detail information about how to use docker-android-pro.
|
||||
|
||||
```bash
|
||||
sms send <phone_number> <message>
|
||||
```
|
||||
|
||||
2. Using adb
|
||||
|
||||
```bash
|
||||
docker exec -it android-container adb emu sms send <phone_number> <message>
|
||||
```
|
||||
|
||||
3. You can also integrate it inside project using adb library.
|
||||
|
||||
![][sms]
|
||||
|
||||
Troubleshooting
|
||||
---------------
|
||||
All logs inside container are stored under folder **/var/log/supervisor**. you can print out log file by using **docker exec**. Example:
|
||||
|
||||
```bash
|
||||
docker exec -it android-container tail -f /var/log/supervisor/docker-android.stdout.log
|
||||
```
|
||||
|
||||
[appium]: <https://appium.io>
|
||||
[docker android samsung]: <images/docker_android_samsung.png>
|
||||
[docker android nexus]: <images/docker_android_nexus.png>
|
||||
[selenium grid]: <images/selenium_grid.png>
|
||||
[devices are connected with selenium grid]: <images/connected_with_grid.png>
|
||||
[adb_connection]: <images/adb_connection.png>
|
||||
[sms]: <images/SMS.png>
|
||||
LICENSE
|
||||
-------
|
||||
See [License](LICENSE.md)
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
#!/bin/bash
|
||||
|
||||
function is_str_in_list(){
|
||||
local given_str=${1}
|
||||
local list_str=${@:2}
|
||||
|
||||
if [[ ! " ${list_str[*]} " =~ " ${given_str} " ]]; then
|
||||
echo "${given_str} is not supported!"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
tasks=("test" "build" "push")
|
||||
if [ -z "${1}" ]; then
|
||||
read -p "Task ($(echo "${tasks[@]}" | tr ' ' '|')) : " t
|
||||
else
|
||||
t=${1}
|
||||
fi
|
||||
is_str_in_list ${t} ${tasks[@]}
|
||||
|
||||
projects=("base" "emulator" "genymotion" "pro-emulator" "pro-emulator_headless")
|
||||
if [ -z "${2}" ]; then
|
||||
read -p "Project ($(echo "${projects[@]}" | tr ' ' '|')) : " p
|
||||
else
|
||||
p=${2}
|
||||
fi
|
||||
is_str_in_list ${p} ${projects[@]}
|
||||
|
||||
if [ -z "${3}" ]; then
|
||||
read -p "Release Version (v2.0.0-p0|v2.0.0-p1|etc) : " r_v
|
||||
else
|
||||
r_v=${3}
|
||||
fi
|
||||
|
||||
FOLDER_PATH=""
|
||||
IMAGE_NAME=""
|
||||
TAG_NAME=""
|
||||
|
||||
if [[ "${p}" == "pro"* ]]; then
|
||||
IFS='-' read -ra arr <<<"${p}"
|
||||
FOLDER_PATH+="docker/${arr[0]}/${arr[1]}"
|
||||
IMAGE_NAME+="budtmo2/docker-android-${arr[0]}"
|
||||
TAG_NAME+="${arr[1]}"
|
||||
else
|
||||
FOLDER_PATH+="docker/${p}"
|
||||
IMAGE_NAME+="budtmo/docker-android"
|
||||
TAG_NAME+="${p}"
|
||||
fi
|
||||
|
||||
if [[ "${p}" == *"emulator"* ]]; then
|
||||
supported_android_version=("9.0" "10.0" "11.0" "12.0" "13.0")
|
||||
declare -A api_levels=(
|
||||
["9.0"]=28
|
||||
["10.0"]=29
|
||||
["11.0"]=30
|
||||
["12.0"]=32
|
||||
["13.0"]=33
|
||||
)
|
||||
|
||||
# To get the last index
|
||||
keys=("${!api_levels[@]}")
|
||||
sorted_keys=($(printf '%s\n' "${keys[@]}" | sort))
|
||||
last_key=${keys[-2]} # because 9.0 will be last
|
||||
|
||||
if [ -z "${4}" ]; then
|
||||
read -p "Android Version ($(echo "${supported_android_version[@]}" \
|
||||
| tr ' ' '|')) : " a_v
|
||||
else
|
||||
a_v=${4}
|
||||
fi
|
||||
is_str_in_list ${a_v} ${supported_android_version[@]}
|
||||
a_l=${api_levels[${a_v}]}
|
||||
TAG_NAME+="_${a_v}"
|
||||
fi
|
||||
|
||||
IMAGE_NAME_LATEST="${IMAGE_NAME}:${TAG_NAME}"
|
||||
TAG_NAME+="_${r_v}"
|
||||
IMAGE_NAME_SPECIFIC_RELEASE=${IMAGE_NAME}:${TAG_NAME}
|
||||
echo "${IMAGE_NAME_SPECIFIC_RELEASE} or ${IMAGE_NAME_LATEST} "
|
||||
|
||||
function build() {
|
||||
# autopep8 --recursive --exclude=.git,__pycache__,venv --max-line-length=120 --in-place .
|
||||
cmd="docker build -t ${IMAGE_NAME_SPECIFIC_RELEASE} --build-arg DOCKER_ANDROID_VERSION=${r_v} "
|
||||
if [ -n "${a_v}" ]; then
|
||||
cmd+="--build-arg EMULATOR_ANDROID_VERSION=${a_v} --build-arg EMULATOR_API_LEVEL=${a_l} "
|
||||
fi
|
||||
|
||||
cmd+="-f ${FOLDER_PATH} ."
|
||||
${cmd}
|
||||
docker tag ${IMAGE_NAME_SPECIFIC_RELEASE} ${IMAGE_NAME_LATEST}
|
||||
|
||||
if [ -n "${a_v}" ] && [ "${a_v}" = "${last_key}" ]; then
|
||||
echo "${a_v} is the last version in the list, will use it as default image tag"
|
||||
docker tag ${IMAGE_NAME_SPECIFIC_RELEASE} ${IMAGE_NAME}:latest
|
||||
fi
|
||||
}
|
||||
|
||||
function test() {
|
||||
cli_path="/home/androidusr/docker-android/cli"
|
||||
results_path="test-results"
|
||||
tmp_folder="tmp"
|
||||
|
||||
mkdir -p tmp
|
||||
build
|
||||
docker run -it --rm --name test --entrypoint /bin/bash \
|
||||
-v $PWD/${tmp_folder}:${cli_path}/${tmp_folder} ${IMAGE_NAME_SPECIFIC_RELEASE} \
|
||||
-c "cd ${cli_path} && sudo rm -rf ${tmp_folder}/* && \
|
||||
nosetests -v && sudo mv .coverage ${tmp_folder} && \
|
||||
sudo cp -r ${results_path}/* ${tmp_folder} && sudo chown -R 1300:1301 ${tmp_folder} &&
|
||||
sudo chmod a+x -R ${tmp_folder}"
|
||||
}
|
||||
|
||||
function push() {
|
||||
build
|
||||
docker push ${IMAGE_NAME_SPECIFIC_RELEASE}
|
||||
docker push ${IMAGE_NAME_LATEST}
|
||||
if [ -n "${a_v}" ] && [ "${a_v}" = "${last_key}" ]; then
|
||||
docker push ${IMAGE_NAME}:latest
|
||||
fi
|
||||
}
|
||||
|
||||
${t}
|
||||
@@ -0,0 +1,6 @@
|
||||
autopep8==2.0.4
|
||||
click==8.1.7
|
||||
coverage==7.3.0
|
||||
mock==5.1.0
|
||||
nose==1.3.7
|
||||
requests==2.31.0
|
||||
@@ -1,13 +1,10 @@
|
||||
[nosetests]
|
||||
cover-xml=true
|
||||
cover-xml-file=coverage.xml
|
||||
cover-xml-file=test-results/coverage.xml
|
||||
with-coverage=true
|
||||
cover-package=src
|
||||
cover-erase=true
|
||||
with-xunit=true
|
||||
xunit-file=xunit.xml
|
||||
xunit-file=test-results/xunit.xml
|
||||
cover-html=true
|
||||
cover-html-dir=coverage
|
||||
|
||||
[flake8]
|
||||
max-line-length = 120
|
||||
cover-html-dir=test-results/coverage
|
||||
@@ -0,0 +1,21 @@
|
||||
import os
|
||||
|
||||
from setuptools import setup
|
||||
|
||||
|
||||
app_version = os.getenv("DOCKER_ANDROID_VERSION", "test-version")
|
||||
|
||||
with open("requirements.txt", "r") as f:
|
||||
reqs = f.read().splitlines()
|
||||
|
||||
setup(
|
||||
name="docker-android",
|
||||
version=app_version,
|
||||
url="https://github.com/budtmo/docker-android",
|
||||
description="CLI for docker-android",
|
||||
author="Budi Utomo",
|
||||
author_email="budtmo.os@gmail.com",
|
||||
install_requires=reqs,
|
||||
py_modules=["cli", "docker-android"],
|
||||
entry_points={"console_scripts": "docker-android=src.app:cli"}
|
||||
)
|
||||
@@ -0,0 +1,213 @@
|
||||
#!/usr/bin/env python3
|
||||
import subprocess
|
||||
from typing import Union
|
||||
|
||||
import click
|
||||
import logging
|
||||
import os
|
||||
|
||||
from enum import Enum
|
||||
|
||||
from src.application import Application
|
||||
from src.device import DeviceType
|
||||
from src.device.emulator import Emulator
|
||||
from src.device.geny_aws import GenyAWS
|
||||
from src.device.geny_saas import GenySAAS
|
||||
from src.helper import convert_str_to_bool, get_env_value_or_raise
|
||||
from src.constants import ENV
|
||||
from src.logger import log
|
||||
|
||||
log.init()
|
||||
logger = logging.getLogger("App")
|
||||
|
||||
|
||||
def get_device(given_input: str) -> Union[Emulator, GenyAWS, GenySAAS, None]:
|
||||
"""
|
||||
Get Device object based on given input
|
||||
|
||||
:param given_input: device in string
|
||||
:return: Platform object
|
||||
"""
|
||||
|
||||
input_lower = given_input.lower()
|
||||
|
||||
if input_lower == DeviceType.EMULATOR.value.lower():
|
||||
emu_av = get_env_value_or_raise(ENV.EMULATOR_ANDROID_VERSION)
|
||||
emu_img_type = get_env_value_or_raise(ENV.EMULATOR_IMG_TYPE)
|
||||
emu_sys_img = get_env_value_or_raise(ENV.EMULATOR_SYS_IMG)
|
||||
|
||||
emu_device = os.getenv(ENV.EMULATOR_DEVICE, "Nexus 5")
|
||||
emu_data_partition = os.getenv(ENV.EMULATOR_DATA_PARTITION, "550m")
|
||||
emu_additional_args = os.getenv(ENV.EMULATOR_ADDITIONAL_ARGS, "")
|
||||
|
||||
emu_name = os.getenv(ENV.EMULATOR_NAME, "{d}_{v}".format(
|
||||
d=emu_device.replace(" ", "_").lower(), v=emu_av))
|
||||
emu = Emulator(emu_name, emu_device, emu_av, emu_data_partition,
|
||||
emu_additional_args, emu_img_type, emu_sys_img)
|
||||
return emu
|
||||
elif input_lower == DeviceType.GENY_AWS.value.lower():
|
||||
return GenyAWS()
|
||||
elif input_lower == DeviceType.GENY_SAAS.value.lower():
|
||||
return GenySAAS()
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
@click.group(context_settings=dict(help_option_names=['-h', '--help']))
|
||||
def cli():
|
||||
pass
|
||||
|
||||
|
||||
def start_appium() -> None:
|
||||
if convert_str_to_bool(os.getenv(ENV.APPIUM)):
|
||||
cmd = f"/usr/bin/appium"
|
||||
app_appium = Application("Appium", cmd,
|
||||
os.getenv(ENV.APPIUM_ADDITIONAL_ARGS, ""), False)
|
||||
app_appium.start()
|
||||
else:
|
||||
logger.info("env APPIUM cannot be found, Appium is not started!")
|
||||
|
||||
|
||||
def start_device() -> None:
|
||||
given_pt = get_env_value_or_raise(ENV.DEVICE_TYPE)
|
||||
selected_device = get_device(given_pt)
|
||||
if selected_device is None:
|
||||
raise RuntimeError(f"'{given_pt}' is invalid! Please check again!")
|
||||
selected_device.create()
|
||||
selected_device.start()
|
||||
selected_device.wait_until_ready()
|
||||
selected_device.reconfigure()
|
||||
selected_device.keep_alive()
|
||||
|
||||
|
||||
def start_display_screen() -> None:
|
||||
cmd = "/usr/bin/Xvfb"
|
||||
args = f"{os.getenv(ENV.DISPLAY)} " \
|
||||
f"-screen {os.getenv(ENV.SCREEN_NUMBER)} " \
|
||||
f"{os.getenv(ENV.SCREEN_WIDTH)}x" \
|
||||
f"{os.getenv(ENV.SCREEN_HEIGHT)}x" \
|
||||
f"{os.getenv(ENV.SCREEN_DEPTH)}"
|
||||
d_screen = Application("d_screen", cmd, args, False)
|
||||
d_screen.start()
|
||||
|
||||
|
||||
def start_display_wm() -> None:
|
||||
cmd = "/usr/bin/openbox-session"
|
||||
d_wm = Application("d_wm", cmd)
|
||||
d_wm.start()
|
||||
|
||||
|
||||
def start_port_forwarder() -> None:
|
||||
import socket
|
||||
local_ip = socket.gethostbyname(socket.gethostname())
|
||||
cmd = f"/usr/bin/socat tcp-listen:5554,bind={local_ip},fork tcp:127.0.0.1:5554 & " \
|
||||
f"/usr/bin/socat tcp-listen:5555,bind={local_ip},fork tcp:127.0.0.1:5555"
|
||||
pf = Application("port_forwarder", cmd)
|
||||
pf.start()
|
||||
|
||||
|
||||
def start_vnc_server() -> None:
|
||||
cmd = "/usr/bin/x11vnc"
|
||||
vnc_pass = os.getenv(ENV.VNC_PASSWORD)
|
||||
if vnc_pass:
|
||||
pass_path = os.path.join(os.getenv(ENV.WORK_PATH), ".vncpass")
|
||||
subprocess.check_call(f"{cmd} -storepasswd {vnc_pass} {pass_path}", shell=True)
|
||||
last_arg = f"-rfbauth {pass_path}"
|
||||
else:
|
||||
last_arg = "-nopw"
|
||||
|
||||
display = os.getenv(ENV.DISPLAY)
|
||||
args = f"-display {display} -forever -shared {last_arg}"
|
||||
vnc_server = Application("vnc_web", cmd, args, False)
|
||||
vnc_server.start()
|
||||
|
||||
|
||||
def start_vnc_web() -> None:
|
||||
if convert_str_to_bool(os.getenv(ENV.WEB_VNC)):
|
||||
vnc_port = get_env_value_or_raise(ENV.VNC_PORT)
|
||||
vnc_web_port = get_env_value_or_raise(ENV.WEB_VNC_PORT)
|
||||
cmd = "/opt/noVNC/utils/novnc_proxy"
|
||||
args = f"--vnc localhost:{vnc_port} localhost:{vnc_web_port}"
|
||||
vnc_web = Application("vnc_web", cmd, args, False)
|
||||
vnc_web.start()
|
||||
else:
|
||||
logger.info("env WEB_VNC cannot be found, VNC_WEB is not started!")
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.argument("app", type=click.Choice([app.value for app in Application.App]))
|
||||
def start(app):
|
||||
selected_app = str(app).lower()
|
||||
if selected_app == Application.App.APPIUM.value.lower():
|
||||
start_appium()
|
||||
elif selected_app == Application.App.DEVICE.value.lower():
|
||||
start_device()
|
||||
elif selected_app == Application.App.DISPLAY_SCREEN.value.lower():
|
||||
start_display_screen()
|
||||
elif selected_app == Application.App.DISPLAY_WM.value.lower():
|
||||
start_display_wm()
|
||||
elif selected_app == Application.App.PORT_FORWARDER.value.lower():
|
||||
start_port_forwarder()
|
||||
elif selected_app == Application.App.VNC_SERVER.value.lower():
|
||||
start_vnc_server()
|
||||
elif selected_app == Application.App.VNC_WEB.value.lower():
|
||||
start_vnc_web()
|
||||
else:
|
||||
logger.error(f"application '{selected_app}' is not supported!")
|
||||
|
||||
|
||||
class SharedComponent(Enum):
|
||||
LOG = "log"
|
||||
|
||||
|
||||
def shared_log() -> None:
|
||||
if convert_str_to_bool(os.getenv(ENV.WEB_LOG)):
|
||||
from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||
|
||||
log_path = get_env_value_or_raise(ENV.LOG_PATH)
|
||||
log_port = int(get_env_value_or_raise(ENV.WEB_LOG_PORT))
|
||||
logger.info(f"Shared log is enabled! all logs can be found on port '{log_port}'")
|
||||
|
||||
class LogSharedHandler(BaseHTTPRequestHandler):
|
||||
def do_GET(self):
|
||||
# root path
|
||||
if self.path == "/":
|
||||
html = "<html><body>"
|
||||
for f in os.listdir(log_path):
|
||||
html += f"<p><a href=\"{f}\">{f}</a></p>"
|
||||
html += "</body></html>"
|
||||
|
||||
self.send_response(200)
|
||||
self.send_header("Content-type", "text/html")
|
||||
self.end_headers()
|
||||
self.wfile.write(html.encode())
|
||||
# open each selected log file
|
||||
else:
|
||||
p = log_path + self.path
|
||||
try:
|
||||
with open(p, "rb") as file:
|
||||
self.send_response(200)
|
||||
self.send_header("Content-type", "text/plain")
|
||||
self.end_headers()
|
||||
self.wfile.write(file.read())
|
||||
except FileNotFoundError:
|
||||
self.send_error(404, "File not found")
|
||||
|
||||
httpd = HTTPServer(('0.0.0.0', log_port), LogSharedHandler)
|
||||
httpd.serve_forever()
|
||||
else:
|
||||
logger.info(f"Shared log is disabled! nothing to do!")
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.argument("component", type=click.Choice([component.value for component in SharedComponent]))
|
||||
def share(component):
|
||||
selected_component = str(component).lower()
|
||||
if selected_component == SharedComponent.LOG.value.lower():
|
||||
shared_log()
|
||||
else:
|
||||
logger.error(f"component '{component}' is not supported!")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
cli()
|
||||
@@ -0,0 +1,35 @@
|
||||
import logging
|
||||
import subprocess
|
||||
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class Application:
|
||||
class App(Enum):
|
||||
APPIUM = "appium"
|
||||
DEVICE = "device"
|
||||
DISPLAY_SCREEN = "display_screen"
|
||||
DISPLAY_WM = "display_wm"
|
||||
PORT_FORWARDER = "port_forwarder"
|
||||
VNC_SERVER = "vnc_server"
|
||||
VNC_WEB = "vnc_web"
|
||||
|
||||
def __init__(self, name: str, command: str, additional_args: str = "", ui: bool = False) -> None:
|
||||
self.logger = logging.getLogger(self.__class__.__name__)
|
||||
self.name = name
|
||||
self.command = command
|
||||
self.additional_args = additional_args
|
||||
self.ui = ui
|
||||
|
||||
def start(self) -> None:
|
||||
if self.ui:
|
||||
self.logger.info(f"{self.name} will be started with ui!")
|
||||
subprocess.check_call(f"/usr/bin/xterm -T {self.name} -n {self.name} "
|
||||
f"-e '{self.command} {self.additional_args}'", shell=True)
|
||||
else:
|
||||
self.logger.info(f"{self.name} will be started without ui!")
|
||||
subprocess.check_call(f"{self.command} {self.additional_args}", shell=True)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return "Application(name={n}, command={c}, args={args}, ui={ui})".format(
|
||||
n=self.name, c=self.command, args=self.additional_args, ui=self.ui)
|
||||
@@ -0,0 +1,6 @@
|
||||
# Status
|
||||
STATUS_CREATING = "CREATING"
|
||||
STATUS_STARTING = "STARTING"
|
||||
STATUS_BOOTING = "BOOTING"
|
||||
STATUS_RECONFIGURING = "RECONFIGURING"
|
||||
STATUS_READY = "READY"
|
||||
@@ -0,0 +1,45 @@
|
||||
# General
|
||||
DOCKER_ANDROID_VERSION = "DOCKER_ANDROID_VERSION"
|
||||
USER_BEHAVIOR_ANALYTICS = "USER_BEHAVIOR_ANALYTICS"
|
||||
APPIUM = "APPIUM"
|
||||
APPIUM_ADDITIONAL_ARGS = "APPIUM_ADDITIONAL_ARGS"
|
||||
DISPLAY = "DISPLAY"
|
||||
SCREEN_DEPTH = "SCREEN_DEPTH"
|
||||
SCREEN_HEIGHT = "SCREEN_HEIGHT"
|
||||
SCREEN_NUMBER = "SCREEN_NUMBER"
|
||||
SCREEN_WIDTH = "SCREEN_WIDTH"
|
||||
VNC_PASSWORD = "VNC_PASSWORD"
|
||||
VNC_PORT = "VNC_PORT"
|
||||
WEB_VNC_PORT = "WEB_VNC_PORT"
|
||||
WEB_VNC = "WEB_VNC"
|
||||
WORK_PATH = "WORK_PATH"
|
||||
LOG_PATH = "LOG_PATH"
|
||||
WEB_LOG_PORT = "WEB_LOG_PORT"
|
||||
WEB_LOG = "WEB_LOG"
|
||||
|
||||
# Device
|
||||
DEVICE_INTERVAL_WAITING = "DEVICE_INTERVAL_WAITING"
|
||||
DEVICE_TYPE = "DEVICE_TYPE"
|
||||
|
||||
# Device (Emulator)
|
||||
EMULATOR_ADDITIONAL_ARGS = "EMULATOR_ADDITIONAL_ARGS"
|
||||
EMULATOR_ANDROID_VERSION = "EMULATOR_ANDROID_VERSION"
|
||||
EMULATOR_DATA_PARTITION = "EMULATOR_DATA_PARTITION"
|
||||
EMULATOR_DEVICE = "EMULATOR_DEVICE"
|
||||
EMULATOR_IMG_TYPE = "EMULATOR_IMG_TYPE"
|
||||
EMULATOR_NAME = "EMULATOR_NAME"
|
||||
EMULATOR_NO_SKIN = "EMULATOR_NO_SKIN"
|
||||
EMULATOR_SYS_IMG = "EMULATOR_SYS_IMG"
|
||||
|
||||
# Device (Genymotion - General)
|
||||
GENYMOTION_TEMPLATE_PATH = "GENYMOTION_TEMPLATE_PATH"
|
||||
|
||||
# Device (Geny_SAAS)
|
||||
GENY_SAAS_USER = "GENY_SAAS_USER"
|
||||
GENY_SAAS_PASS = "GENY_SAAS_PASS"
|
||||
GENY_SAAS_TEMPLATE_FILE_NAME = "saas.json"
|
||||
|
||||
# Device (Geny_AWS)
|
||||
AWS_ACCESS_KEY_ID = "AWS_ACCESS_KEY_ID"
|
||||
AWS_SECRET_ACCESS_KEY = "AWS_SECRET_ACCESS_KEY"
|
||||
GENY_AWS_TEMPLATE_FILE_NAME = "aws.json"
|
||||
@@ -0,0 +1 @@
|
||||
UTF8 = "utf-8"
|
||||
@@ -0,0 +1,172 @@
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import platform
|
||||
import requests
|
||||
import signal
|
||||
import time
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
from enum import Enum
|
||||
|
||||
from src.helper import convert_str_to_bool, get_env_value_or_raise
|
||||
from src.constants import DEVICE, ENV
|
||||
|
||||
|
||||
class DeviceType(Enum):
|
||||
EMULATOR = "emulator"
|
||||
GENY_SAAS = "geny_saas"
|
||||
GENY_AWS = "geny_aws"
|
||||
|
||||
|
||||
class Device(ABC):
|
||||
FORM_ID = "1FAIpQLSdrKWQdMh6Nt8v8NQdYvTIntohebAgqWCpXT3T9NofAoxcpkw"
|
||||
FORM_USER = "user"
|
||||
FORM_CITY = "city"
|
||||
FORM_REGION = "region"
|
||||
FORM_COUNTRY = "country"
|
||||
FORM_APP_VERSION = "app_version"
|
||||
FORM_APPIUM = "appium"
|
||||
FORM_APPIUM_ADDITIONAL_ARGS = "appium_additional_args"
|
||||
FORM_WEB_LOG = "web_log"
|
||||
FORM_WEB_VNC = "web_vnc"
|
||||
FORM_SCREEN_RESOLUTION = "screen_resolution"
|
||||
FORM_DEVICE_TYPE = "device_type"
|
||||
FORM_EMU_DEVICE = "emu_device"
|
||||
FORM_EMU_ANDROID_VERSION = "emu_android_version"
|
||||
FORM_EMU_NO_SKIN = "emu_no_skin"
|
||||
FORM_EMU_DATA_PARTITION = "emu_data_partition"
|
||||
FORM_EMU_ADDITIONAL_ARGS = "emu_additional_args"
|
||||
|
||||
def __init__(self) -> None:
|
||||
self.logger = logging.getLogger(self.__class__.__name__)
|
||||
self.device_type = None
|
||||
self.interval_waiting = int(os.getenv(ENV.DEVICE_INTERVAL_WAITING, 2))
|
||||
self.user_behavior_analytics = convert_str_to_bool(os.getenv(ENV.USER_BEHAVIOR_ANALYTICS, "true"))
|
||||
self.form_field = {
|
||||
Device.FORM_USER: "entry.108751316",
|
||||
Device.FORM_CITY: "entry.2083022547",
|
||||
Device.FORM_REGION: "entry.1083141079",
|
||||
Device.FORM_COUNTRY: "entry.1946159560",
|
||||
Device.FORM_APP_VERSION: "entry.818050927",
|
||||
Device.FORM_APPIUM: "entry.181610571",
|
||||
Device.FORM_APPIUM_ADDITIONAL_ARGS: "entry.727759656",
|
||||
Device.FORM_WEB_LOG: "entry.1225589007",
|
||||
Device.FORM_WEB_VNC: "entry.2055392048",
|
||||
Device.FORM_SCREEN_RESOLUTION: "entry.709976626",
|
||||
Device.FORM_DEVICE_TYPE: "entry.207096546",
|
||||
Device.FORM_EMU_DEVICE: "entry.1960740382",
|
||||
Device.FORM_EMU_ANDROID_VERSION: "entry.671872491",
|
||||
Device.FORM_EMU_NO_SKIN: "entry.403556951",
|
||||
Device.FORM_EMU_DATA_PARTITION: "entry.1052258875",
|
||||
Device.FORM_EMU_ADDITIONAL_ARGS: "entry.57529972"
|
||||
}
|
||||
self.form_data = {}
|
||||
signal.signal(signal.SIGTERM, self.tear_down)
|
||||
|
||||
def set_status(self, current_status) -> None:
|
||||
bashrc_file = f"{os.getenv(ENV.WORK_PATH)}/device_status"
|
||||
with open(bashrc_file, "w+") as bf:
|
||||
bf.write(current_status)
|
||||
# It won't work using docker exec
|
||||
# os.environ[constants.ENV_DEVICE_STATUS] = current_status
|
||||
|
||||
def _prepare_analytics_payload(self) -> None:
|
||||
self.form_data.update({
|
||||
self.form_field[Device.FORM_USER]: f"{platform.platform()}_{platform.version().replace(' ', '_')}",
|
||||
self.form_field[Device.FORM_APP_VERSION]: os.getenv(ENV.DOCKER_ANDROID_VERSION),
|
||||
self.form_field[Device.FORM_DEVICE_TYPE]: self.device_type,
|
||||
self.form_field[Device.FORM_WEB_VNC]: convert_str_to_bool(os.getenv(ENV.WEB_VNC)),
|
||||
self.form_field[Device.FORM_WEB_LOG]: convert_str_to_bool(os.getenv(ENV.WEB_LOG)),
|
||||
self.form_field[Device.FORM_APPIUM]: convert_str_to_bool(os.getenv(ENV.APPIUM))
|
||||
})
|
||||
|
||||
try:
|
||||
res = requests.get("https://ipinfo.io")
|
||||
if res.ok:
|
||||
json_res = res.json()
|
||||
self.form_data.update({
|
||||
self.form_field[Device.FORM_CITY]: json_res[Device.FORM_CITY],
|
||||
self.form_field[Device.FORM_REGION]: json_res[Device.FORM_REGION],
|
||||
self.form_field[Device.FORM_COUNTRY]: json_res[Device.FORM_COUNTRY]
|
||||
})
|
||||
except requests.exceptions.RequestException as rer:
|
||||
self.logger.warning(rer)
|
||||
pass
|
||||
except KeyError as ke:
|
||||
self.logger.warning(ke)
|
||||
pass
|
||||
|
||||
def create(self) -> None:
|
||||
if self.user_behavior_analytics:
|
||||
self.logger.info("Sending user behavior analytics to improve the tool")
|
||||
try:
|
||||
form_url = f"https://docs.google.com/forms/d/e/{Device.FORM_ID}/formResponse"
|
||||
self._prepare_analytics_payload()
|
||||
requests.post(url=form_url, data=self.form_data)
|
||||
except requests.exceptions.RequestException as rer:
|
||||
self.logger.warning(rer)
|
||||
pass
|
||||
self.set_status(DEVICE.STATUS_CREATING)
|
||||
|
||||
def start(self) -> None:
|
||||
self.set_status(DEVICE.STATUS_STARTING)
|
||||
|
||||
def wait_until_ready(self) -> None:
|
||||
self.set_status(DEVICE.STATUS_BOOTING)
|
||||
|
||||
def reconfigure(self) -> None:
|
||||
self.set_status(DEVICE.STATUS_RECONFIGURING)
|
||||
|
||||
def keep_alive(self) -> None:
|
||||
self.set_status(DEVICE.STATUS_READY)
|
||||
self.logger.warning(f"{self.device_type} process will be kept alive to be able to get sigterm signal...")
|
||||
while True:
|
||||
time.sleep(2)
|
||||
|
||||
@abstractmethod
|
||||
def tear_down(self, *args) -> None:
|
||||
pass
|
||||
|
||||
|
||||
class Genymotion(Device):
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
self.logger = logging.getLogger(self.__class__.__name__)
|
||||
|
||||
def get_data_from_template(self, filename: str) -> dict:
|
||||
path_template_json = os.path.join(get_env_value_or_raise(ENV.GENYMOTION_TEMPLATE_PATH), filename)
|
||||
data = {}
|
||||
if os.path.isfile(path_template_json):
|
||||
try:
|
||||
self.logger.info(path_template_json)
|
||||
with open(path_template_json, "r") as f:
|
||||
data = json.load(f)
|
||||
except FileNotFoundError as fnf:
|
||||
self.shutdown_and_logout()
|
||||
self.logger.error(f"File cannot be found: {fnf}")
|
||||
except json.JSONDecodeError as jde:
|
||||
self.shutdown_and_logout()
|
||||
self.logger.error(f"Error Decoding Json: {jde}")
|
||||
except Exception as e:
|
||||
self.shutdown_and_logout()
|
||||
self.logger.error(e)
|
||||
else:
|
||||
self.shutdown_and_logout()
|
||||
raise RuntimeError(f"'{path_template_json}' cannot be found!")
|
||||
return data
|
||||
|
||||
@abstractmethod
|
||||
def login(self) -> None:
|
||||
pass
|
||||
|
||||
def create(self) -> None:
|
||||
super().create()
|
||||
self.login()
|
||||
|
||||
@abstractmethod
|
||||
def shutdown_and_logout(self) -> None:
|
||||
pass
|
||||
|
||||
def tear_down(self, *args) -> None:
|
||||
self.shutdown_and_logout()
|
||||
@@ -0,0 +1,237 @@
|
||||
import logging
|
||||
import os
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
from enum import Enum
|
||||
|
||||
from src.device import Device, DeviceType
|
||||
from src.helper import convert_str_to_bool, get_env_value_or_raise, symlink_force
|
||||
from src.constants import ENV, UTF8
|
||||
|
||||
|
||||
class Emulator(Device):
|
||||
DEVICE = (
|
||||
"Nexus 4",
|
||||
"Nexus 5",
|
||||
"Nexus 7",
|
||||
"Nexus One",
|
||||
"Nexus S",
|
||||
"Samsung Galaxy S6",
|
||||
"Samsung Galaxy S7",
|
||||
"Samsung Galaxy S7 Edge",
|
||||
"Samsung Galaxy S8",
|
||||
"Samsung Galaxy S9",
|
||||
"Samsung Galaxy S10"
|
||||
)
|
||||
|
||||
API_LEVEL = {
|
||||
"9.0": "28",
|
||||
"10.0": "29",
|
||||
"11.0": "30",
|
||||
"12.0": "32",
|
||||
"13.0": "33"
|
||||
}
|
||||
|
||||
adb_name_id = 5554
|
||||
|
||||
class ReadinessCheck(Enum):
|
||||
BOOTED = "booted"
|
||||
RUN_STATE = "in running state"
|
||||
WELCOME_SCREEN = "in welcome screen"
|
||||
POP_UP_WINDOW = "pop up window"
|
||||
|
||||
def __init__(self, name: str, device: str, android_version: str, data_partition: str,
|
||||
additional_args: str, img_type: str, sys_img: str) -> None:
|
||||
super().__init__()
|
||||
self.logger = logging.getLogger(self.__class__.__name__)
|
||||
self.adb_name = f"emulator-{Emulator.adb_name_id}"
|
||||
self.device_type = DeviceType.EMULATOR.value
|
||||
self.name = name
|
||||
if device in self.DEVICE:
|
||||
self.device = device
|
||||
else:
|
||||
raise RuntimeError(f"device '{device}' is not supported!")
|
||||
if android_version in self.API_LEVEL.keys():
|
||||
self.android_version = android_version
|
||||
else:
|
||||
raise RuntimeError(f"android version '{android_version}' is not supported!")
|
||||
self.api_level = self.API_LEVEL[self.android_version]
|
||||
self.data_partition = data_partition
|
||||
self.additional_args = additional_args
|
||||
self.img_type = img_type
|
||||
self.sys_img = sys_img
|
||||
workdir = get_env_value_or_raise(ENV.WORK_PATH)
|
||||
self.path_device_profile_target = os.path.join(workdir, ".android", "devices.xml")
|
||||
self.path_emulator = os.path.join(workdir, "emulator")
|
||||
self.path_emulator_config = os.path.join(workdir, "emulator", "config.ini")
|
||||
self.path_emulator_profiles = os.path.join(workdir, "docker-android", "mixins",
|
||||
"configs", "devices", "profiles")
|
||||
self.path_emulator_skins = os.path.join(workdir, "docker-android", "mixins",
|
||||
"configs", "devices", "skins")
|
||||
self.file_name = self.device.replace(" ", "_").lower()
|
||||
self.no_skin = convert_str_to_bool(os.getenv(ENV.EMULATOR_NO_SKIN))
|
||||
self.interval_after_booting = 15
|
||||
Emulator.adb_name_id += 2
|
||||
self.form_data.update({
|
||||
self.form_field[Device.FORM_SCREEN_RESOLUTION]: f"{os.getenv(ENV.SCREEN_WIDTH)}x"
|
||||
f"{os.getenv(ENV.SCREEN_HEIGHT)}x"
|
||||
f"{os.getenv(ENV.SCREEN_DEPTH)}",
|
||||
self.form_field[Device.FORM_EMU_DEVICE]: self.device,
|
||||
self.form_field[Device.FORM_EMU_ANDROID_VERSION]: self.android_version,
|
||||
self.form_field[Device.FORM_EMU_NO_SKIN]: self.no_skin,
|
||||
self.form_field[Device.FORM_EMU_DATA_PARTITION]: self.data_partition,
|
||||
self.form_field[Device.FORM_EMU_ADDITIONAL_ARGS]: self.additional_args
|
||||
})
|
||||
|
||||
def is_initialized(self) -> bool:
|
||||
import re
|
||||
if os.path.exists(self.path_emulator_config):
|
||||
self.logger.info("Config file exists")
|
||||
with open(self.path_emulator_config, 'r') as f:
|
||||
if any(re.match(r'hw\.device\.name ?= ?{}'.format(self.device), line) for line in f):
|
||||
self.logger.info("Selected device is already created")
|
||||
return True
|
||||
else:
|
||||
self.logger.info("Selected device is not created")
|
||||
return False
|
||||
|
||||
self.logger.info("Config file does not exist")
|
||||
return False
|
||||
|
||||
def _add_profile(self) -> None:
|
||||
if "samsung" in self.device.lower():
|
||||
path_device_profile_source = os.path.join(self.path_emulator_profiles,
|
||||
"{fn}.xml".format(fn=self.file_name))
|
||||
symlink_force(path_device_profile_source, self.path_device_profile_target)
|
||||
self.logger.info("Samsung device profile is linked")
|
||||
|
||||
def _add_skin(self) -> None:
|
||||
device_skin_path = os.path.join(
|
||||
self.path_emulator_skins, "{fn}".format(fn=self.file_name))
|
||||
with open(self.path_emulator_config, "a") as cf:
|
||||
cf.write("hw.keyboard=yes\n")
|
||||
cf.write("disk.dataPartition.size={dp}\n".format(dp=self.data_partition))
|
||||
cf.write("skin.path={sp}\n".format(
|
||||
sp="_no_skin" if self.no_skin else device_skin_path))
|
||||
self.logger.info(f"Skin is added in: '{self.path_emulator_config}'")
|
||||
|
||||
def create(self) -> None:
|
||||
super().create()
|
||||
first_run = not self.is_initialized()
|
||||
if first_run:
|
||||
self.logger.info(f"Creating the {self.device_type}...")
|
||||
self._add_profile()
|
||||
creation_cmd = "avdmanager create avd -f -n {n} -b {it}/{si} " \
|
||||
"-k 'system-images;android-{al};{it};{si}' " \
|
||||
"-d {d} -p {pe}".format(n=self.name, it=self.img_type, si=self.sys_img,
|
||||
al=self.api_level, d=self.device.replace(" ", "\ "),
|
||||
pe=self.path_emulator)
|
||||
self.logger.info(f"Command to create emulator: '{creation_cmd}'")
|
||||
subprocess.check_call(creation_cmd, shell=True)
|
||||
self._add_skin()
|
||||
self.logger.info(f"{self.device_type} is created!")
|
||||
|
||||
def change_permission(self) -> None:
|
||||
kvm_path = "/dev/kvm"
|
||||
if os.path.exists(kvm_path):
|
||||
cmds = (f"sudo chown 1300:1301 {kvm_path}",
|
||||
"sudo sed -i '1d' /etc/passwd")
|
||||
for c in cmds:
|
||||
subprocess.check_call(c, shell=True)
|
||||
self.logger.info("KVM permission is granted!")
|
||||
else:
|
||||
raise RuntimeError("/dev/kvm cannot be found!")
|
||||
|
||||
def deploy(self):
|
||||
self.logger.info(f"Deploying the {self.device_type}")
|
||||
|
||||
basic_cmd = "emulator @{n}".format(n=self.name)
|
||||
basic_args = "-gpu swiftshader_indirect -accel on -writable-system -verbose"
|
||||
wipe_arg = "-wipe-data" if not self.is_initialized() else ""
|
||||
|
||||
start_cmd = f"{basic_cmd} {basic_args} {wipe_arg} {self.additional_args}"
|
||||
self.logger.info(f"Command to run {self.device_type}: '{start_cmd}'")
|
||||
subprocess.Popen(start_cmd.split())
|
||||
|
||||
def start(self) -> None:
|
||||
super().start()
|
||||
self.change_permission()
|
||||
self.deploy()
|
||||
|
||||
def check_adb_command(self, readiness_check_type: ReadinessCheck, bash_command: str,
|
||||
expected_keyword: str, max_attempts: int, interval_waiting_time: int,
|
||||
adb_action: str = None) -> None:
|
||||
success = False
|
||||
for _ in range(1, max_attempts):
|
||||
if success:
|
||||
break
|
||||
else:
|
||||
try:
|
||||
output = subprocess.check_output(
|
||||
bash_command.split()).decode(UTF8)
|
||||
if expected_keyword in str(output).lower():
|
||||
if readiness_check_type is self.ReadinessCheck.POP_UP_WINDOW:
|
||||
subprocess.check_call(adb_action, shell=True)
|
||||
else:
|
||||
self.logger.info(
|
||||
f"{self.device_type} is {readiness_check_type.value}!")
|
||||
success = True
|
||||
else:
|
||||
self.logger.info(f"[attempt: {_}] {self.device_type} is not {readiness_check_type.value}! "
|
||||
f"will check again in {interval_waiting_time} seconds")
|
||||
time.sleep(interval_waiting_time)
|
||||
except subprocess.CalledProcessError:
|
||||
self.logger.warning("command cannot be executed! will continue...")
|
||||
time.sleep(2)
|
||||
continue
|
||||
else:
|
||||
if readiness_check_type is self.ReadinessCheck.POP_UP_WINDOW:
|
||||
self.logger.info(f"Pop up windows '{expected_keyword}' is not found!")
|
||||
else:
|
||||
raise RuntimeError(
|
||||
f"{readiness_check_type.value} is checked {_} times!")
|
||||
|
||||
def wait_until_ready(self) -> None:
|
||||
super().wait_until_ready()
|
||||
booting_cmd = f"adb -s {self.adb_name} wait-for-device shell getprop sys.boot_completed"
|
||||
focus_cmd = f"adb -s {self.adb_name} shell dumpsys window | grep -i mCurrentFocus"
|
||||
self.check_adb_command(self.ReadinessCheck.BOOTED,
|
||||
booting_cmd, "1", 60, self.interval_waiting)
|
||||
time.sleep(self.interval_after_booting)
|
||||
|
||||
interval_pop_up = 0
|
||||
max_attempt_pop_up = 3
|
||||
pop_up_system_ui = "Not Responding: com.android.systemui"
|
||||
system_ui_cmd = f"adb shell su root 'kill $(pidof com.android.systemui)'"
|
||||
pop_up_key_enter = {
|
||||
"Not Responding: com.google.android.gms",
|
||||
"Not Responding: system",
|
||||
"ConversationListActivity"
|
||||
}
|
||||
key_enter_cmd = "adb shell input keyevent KEYCODE_ENTER"
|
||||
self.check_adb_command(self.ReadinessCheck.POP_UP_WINDOW, focus_cmd, pop_up_system_ui,
|
||||
max_attempt_pop_up, interval_pop_up, system_ui_cmd)
|
||||
for pe in pop_up_key_enter:
|
||||
self.check_adb_command(self.ReadinessCheck.POP_UP_WINDOW, focus_cmd, pe, max_attempt_pop_up,
|
||||
interval_pop_up, key_enter_cmd)
|
||||
|
||||
self.check_adb_command(self.ReadinessCheck.WELCOME_SCREEN,
|
||||
focus_cmd, "launcheractivity", 60, self.interval_waiting)
|
||||
self.logger.info(f"{self.device_type} is ready to use")
|
||||
|
||||
def tear_down(self, *args) -> None:
|
||||
self.logger.warning("Sigterm is detected! Nothing to do!")
|
||||
|
||||
def __repr__(self) -> str:
|
||||
try:
|
||||
return "Emulator(name={n}, device={d}, adb_name={an}, android_version={av}, api_level={al}, " \
|
||||
"data_partition={dp}, additional_args={aa}, img_type={it}, sys_img={si}, " \
|
||||
"path_device_profile_target={pdpt}, path_emulator={pe}, path_emulator_config={pec}, " \
|
||||
"file={f})".format(n=self.name, d=self.device, an=self.adb_name, av=self.android_version,
|
||||
al=self.api_level, dp=self.data_partition, aa=self.additional_args,
|
||||
it=self.img_type, si=self.sys_img, pdpt=self.path_device_profile_target,
|
||||
pe=self.path_emulator, pec=self.path_emulator_config, f=self.file_name)
|
||||
except AttributeError as ae:
|
||||
self.logger.error(ae)
|
||||
return ""
|
||||
@@ -0,0 +1,223 @@
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
from src.device import Genymotion, DeviceType
|
||||
from src.helper import get_env_value_or_raise
|
||||
from src.constants import ENV, UTF8
|
||||
|
||||
|
||||
class GenyAWS(Genymotion):
|
||||
port = 5555
|
||||
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
self.logger = logging.getLogger(self.__class__.__name__)
|
||||
self.device_type = DeviceType.GENY_AWS.value
|
||||
self.workdir = get_env_value_or_raise(ENV.WORK_PATH)
|
||||
self.aws_credentials_path = os.path.join(self.workdir, ".aws")
|
||||
self.remove_cred_at_the_end = False # for logout
|
||||
self.geny_aws_template_path = os.path.join(self.workdir, "docker-android", "mixins",
|
||||
"templates", "genymotion", "aws")
|
||||
self.created_devices = {}
|
||||
|
||||
def login(self) -> None:
|
||||
aws_credentials_file = os.path.join(self.aws_credentials_path, "credentials")
|
||||
if os.path.exists(self.aws_credentials_path):
|
||||
self.logger.info(".aws is found! It will be used as credentials")
|
||||
else:
|
||||
self.logger.info(".aws cannot be found! the template will be used!")
|
||||
self.remove_cred_at_the_end = True
|
||||
aws_credentials_template_path = os.path.join(self.geny_aws_template_path, ".aws")
|
||||
shutil.move(aws_credentials_template_path, self.aws_credentials_path)
|
||||
|
||||
aws_key_id = get_env_value_or_raise(ENV.AWS_ACCESS_KEY_ID)
|
||||
aws_secret_key = get_env_value_or_raise(ENV.AWS_SECRET_ACCESS_KEY)
|
||||
replacements_cred = {
|
||||
f"<{ENV.AWS_ACCESS_KEY_ID.lower()}>": aws_key_id,
|
||||
f"<{ENV.AWS_SECRET_ACCESS_KEY.lower()}>": aws_secret_key
|
||||
}
|
||||
with open(aws_credentials_file, 'r+') as cred_file:
|
||||
cred_file_contents = cred_file.read()
|
||||
for old_str, new_str in replacements_cred.items():
|
||||
cred_file_contents = cred_file_contents.replace(old_str, new_str)
|
||||
cred_file.seek(0)
|
||||
cred_file.write(cred_file_contents)
|
||||
cred_file.truncate()
|
||||
self.logger.info("aws credentials is set!")
|
||||
|
||||
def create_ssh_key(self) -> None:
|
||||
subprocess.check_call('ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa -N ""', shell=True)
|
||||
self.logger.info("ssh key is created!")
|
||||
|
||||
def create_tf_files(self) -> None:
|
||||
try:
|
||||
for item in self.get_data_from_template(ENV.GENY_AWS_TEMPLATE_FILE_NAME):
|
||||
name = item["name"]
|
||||
region = item["region"]
|
||||
ami = item["ami"]
|
||||
instance_type = item["instance_type"]
|
||||
if "security_group" in item:
|
||||
sg = item["security_group"]
|
||||
tf_content = f'''
|
||||
provider "aws" {{
|
||||
alias = "provider_{name}"
|
||||
region = "{region}"
|
||||
}}
|
||||
|
||||
resource "aws_key_pair" "geny_key_{name}" {{
|
||||
provider = aws.provider_{name}
|
||||
public_key = file("~/.ssh/id_rsa.pub")
|
||||
}}
|
||||
|
||||
resource "aws_instance" "geny_aws_{name}" {{
|
||||
provider = aws.provider_{name}
|
||||
ami = "{ami}"
|
||||
instance_type = "{instance_type}"
|
||||
vpc_security_group_ids = ["{sg}"]
|
||||
key_name = aws_key_pair.geny_key_{name}.key_name
|
||||
tags = {{
|
||||
Name = "DockerAndroid-GenyAWS-{ami}.id}}"
|
||||
}}
|
||||
|
||||
provisioner "remote-exec" {{
|
||||
connection {{
|
||||
type = "ssh"
|
||||
user = "shell"
|
||||
host = self.public_ip
|
||||
private_key = file("~/.ssh/id_rsa")
|
||||
}}
|
||||
script = "/home/androidusr/docker-android/mixins/scripts/genymotion/aws/enable_adb.sh"
|
||||
}}
|
||||
}}
|
||||
|
||||
output "public_dns_{name}" {{
|
||||
value = aws_instance.geny_aws_{name}.public_dns
|
||||
}}
|
||||
'''
|
||||
else:
|
||||
ingress_rules = json.dumps(item["ingress_rules"])
|
||||
egress_rules = json.dumps(item["egress_rules"])
|
||||
tf_content = f'''
|
||||
locals {{
|
||||
ingress_rules = {ingress_rules}
|
||||
egress_rules = {egress_rules}
|
||||
}}
|
||||
|
||||
provider "aws" {{
|
||||
alias = "provider_{name}"
|
||||
region = "{region}"
|
||||
}}
|
||||
|
||||
resource "aws_security_group" "geny_sg_{name}" {{
|
||||
provider = aws.provider_{name}
|
||||
dynamic "ingress" {{
|
||||
for_each = local.ingress_rules
|
||||
content {{
|
||||
from_port = ingress.value.from_port
|
||||
to_port = ingress.value.to_port
|
||||
protocol = ingress.value.protocol
|
||||
cidr_blocks = ingress.value.cidr_blocks
|
||||
}}
|
||||
}}
|
||||
|
||||
dynamic "egress" {{
|
||||
for_each = local.egress_rules
|
||||
content {{
|
||||
from_port = egress.value.from_port
|
||||
to_port = egress.value.to_port
|
||||
protocol = egress.value.protocol
|
||||
cidr_blocks = egress.value.cidr_blocks
|
||||
}}
|
||||
}}
|
||||
}}
|
||||
|
||||
resource "aws_key_pair" "geny_key_{name}" {{
|
||||
provider = aws.provider_{name}
|
||||
public_key = file("~/.ssh/id_rsa.pub")
|
||||
}}
|
||||
|
||||
resource "aws_instance" "geny_aws_{name}" {{
|
||||
provider = aws.provider_{name}
|
||||
ami = "{ami}"
|
||||
instance_type = "{instance_type}"
|
||||
vpc_security_group_ids = [aws_security_group.geny_sg_{name}.name]
|
||||
key_name = aws_key_pair.geny_key_{name}.key_name
|
||||
tags = {{
|
||||
Name = "DockerAndroid-GenyAWS-{ami}.id}}"
|
||||
}}
|
||||
|
||||
provisioner "remote-exec" {{
|
||||
connection {{
|
||||
type = "ssh"
|
||||
user = "shell"
|
||||
host = self.public_ip
|
||||
private_key = file("~/.ssh/id_rsa")
|
||||
}}
|
||||
script = "/home/androidusr/docker-android/mixins/scripts/genymotion/aws/enable_adb.sh"
|
||||
}}
|
||||
}}
|
||||
|
||||
output "public_dns_{name}" {{
|
||||
value = aws_instance.geny_aws_{name}.public_dns
|
||||
}}
|
||||
'''
|
||||
tf_deployment_filename = f"{name}.tf"
|
||||
self.created_devices[name] = GenyAWS.port
|
||||
GenyAWS.port += 1
|
||||
with open(tf_deployment_filename, "w") as df:
|
||||
df.write(tf_content)
|
||||
self.logger.info("Terraform files are created!")
|
||||
except Exception as e:
|
||||
self.logger.error(e)
|
||||
self.shutdown_and_logout()
|
||||
|
||||
def deploy_tf(self) -> None:
|
||||
try:
|
||||
cmds = (
|
||||
"terraform init",
|
||||
"terraform plan",
|
||||
"terraform apply -auto-approve"
|
||||
)
|
||||
for c in cmds:
|
||||
subprocess.check_call(c, shell=True)
|
||||
self.logger.info("Genymotion-Device(s) are deployed on AWS")
|
||||
except subprocess.CalledProcessError as cpe:
|
||||
self.logger.error(cpe)
|
||||
self.shutdown_and_logout()
|
||||
|
||||
def connect_with_local_adb(self) -> None:
|
||||
self.logger.info(f"created devices: {self.created_devices}")
|
||||
try:
|
||||
for d, p in self.created_devices.items():
|
||||
dns_cmd = f"terraform output public_dns_{d}"
|
||||
dns_ip = subprocess.check_output(dns_cmd.split()).decode(UTF8).replace('"', '')
|
||||
tunnel_cmd = f"ssh -i ~/.ssh/id_rsa -o ServerAliveInterval=60 -o StrictHostKeyChecking=no -q -NL " \
|
||||
f"{p}:localhost:5555 shell@{dns_ip}"
|
||||
subprocess.Popen(tunnel_cmd.split())
|
||||
time.sleep(10)
|
||||
subprocess.check_call(f"adb connect localhost:{p} >/dev/null 2>&1", shell=True)
|
||||
except Exception as e:
|
||||
self.logger.error(e)
|
||||
self.shutdown_and_logout()
|
||||
|
||||
def create(self) -> None:
|
||||
super().create()
|
||||
self.create_ssh_key()
|
||||
self.create_tf_files()
|
||||
self.deploy_tf()
|
||||
self.connect_with_local_adb()
|
||||
|
||||
def shutdown_and_logout(self) -> None:
|
||||
try:
|
||||
subprocess.check_call("terraform destroy -auto-approve -lock=false", shell=True)
|
||||
self.logger.info("device(s) is successfully removed!")
|
||||
except subprocess.CalledProcessError as cpe:
|
||||
self.logger.error(cpe)
|
||||
finally:
|
||||
if self.remove_cred_at_the_end:
|
||||
subprocess.check_call(f"rm -rf {self.aws_credentials_path}", shell=True)
|
||||
self.logger.info("successfully logged out!")
|
||||
@@ -0,0 +1,72 @@
|
||||
import logging
|
||||
import subprocess
|
||||
|
||||
from src.device import Genymotion, DeviceType
|
||||
from src.helper import get_env_value_or_raise
|
||||
from src.constants import ENV, UTF8
|
||||
|
||||
|
||||
class GenySAAS(Genymotion):
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
self.logger = logging.getLogger(self.__class__.__name__)
|
||||
self.device_type = DeviceType.GENY_SAAS.value
|
||||
self.created_devices = []
|
||||
|
||||
def login(self) -> None:
|
||||
user = get_env_value_or_raise(ENV.GENY_SAAS_USER)
|
||||
password = get_env_value_or_raise(ENV.GENY_SAAS_PASS)
|
||||
subprocess.check_call(f"gmsaas auth login {user} {password} > /dev/null 2>&1", shell=True)
|
||||
self.logger.info("successfully logged in!")
|
||||
|
||||
def create(self) -> None:
|
||||
super().create()
|
||||
for item in self.get_data_from_template(ENV.GENY_SAAS_TEMPLATE_FILE_NAME):
|
||||
name = ""
|
||||
template = ""
|
||||
local_port = ""
|
||||
|
||||
# implement like this because local_port param is not a must
|
||||
for k, v in item.items():
|
||||
if k.lower() == "name":
|
||||
name = v
|
||||
elif k.lower() == "template":
|
||||
template = v
|
||||
elif k.lower() == "local_port":
|
||||
local_port = v
|
||||
else:
|
||||
self.logger.warning(f"'{k}' is not supported! Please check the documentation!")
|
||||
|
||||
if not name:
|
||||
import uuid
|
||||
name = str(uuid.uuid4())
|
||||
|
||||
if not template:
|
||||
self.shutdown_and_logout()
|
||||
raise RuntimeError(f"'template' is a must parameter and not given!")
|
||||
else:
|
||||
self.logger.info(f"name: {name}, template: {template}")
|
||||
creation_cmd = f"gmsaas instances start {template} {name}"
|
||||
try:
|
||||
instance_id = subprocess.check_output(creation_cmd.split()).decode(UTF8).replace("\n", "")
|
||||
created_device = {f"{name}": {instance_id}}
|
||||
self.created_devices.append(created_device)
|
||||
additional_args = ""
|
||||
if local_port:
|
||||
additional_args = f"--adb-serial-port {local_port}"
|
||||
connect_cmd = f"gmsaas instances adbconnect {instance_id} {additional_args}"
|
||||
subprocess.check_call(f"{connect_cmd}", shell=True)
|
||||
except Exception as e:
|
||||
self.shutdown_and_logout()
|
||||
self.logger.error(e)
|
||||
exit(1)
|
||||
|
||||
def shutdown_and_logout(self) -> None:
|
||||
if bool(self.created_devices):
|
||||
self.logger.info("Created device(s) will be removed!")
|
||||
for d in self.created_devices:
|
||||
for n, i in d.items():
|
||||
subprocess.check_call(f"gmsaas instances stop {i}", shell=True)
|
||||
self.logger.info(f"device '{n}' is successfully removed!")
|
||||
subprocess.check_call("gmsaas auth logout", shell=True)
|
||||
self.logger.info("successfully logged out!")
|
||||
@@ -0,0 +1,56 @@
|
||||
import logging
|
||||
import os
|
||||
|
||||
logger = logging.getLogger("helper")
|
||||
|
||||
|
||||
def convert_str_to_bool(given_str: str) -> bool:
|
||||
"""
|
||||
Convert String to Boolean value
|
||||
|
||||
:param given_str: given string
|
||||
:return: converted string in Boolean
|
||||
"""
|
||||
if given_str:
|
||||
if type(given_str) is str:
|
||||
return given_str.lower() in ("yes", "true", "t", "1")
|
||||
else:
|
||||
raise AttributeError
|
||||
else:
|
||||
logger.info(f"'{given_str}' is empty!")
|
||||
return False
|
||||
|
||||
|
||||
def get_env_value_or_raise(env_key: str) -> str:
|
||||
"""
|
||||
Get value of necessary environment variable.
|
||||
|
||||
:param env_key: given environment variable
|
||||
:return: env_value in String
|
||||
"""
|
||||
try:
|
||||
env_value = os.getenv(env_key)
|
||||
if not env_value:
|
||||
raise RuntimeError(f"'{env_key}' is missing.")
|
||||
elif env_value.isspace():
|
||||
raise RuntimeError(f"'{env_key}' contains only white space.")
|
||||
return env_value
|
||||
except TypeError as t_err:
|
||||
logger.error(t_err)
|
||||
|
||||
|
||||
def symlink_force(source: str, target: str) -> None:
|
||||
"""
|
||||
Create Symbolic link
|
||||
|
||||
:param source: source file
|
||||
:param target: target file
|
||||
:return: None
|
||||
"""
|
||||
try:
|
||||
os.symlink(source, target)
|
||||
except FileNotFoundError as ffe_err:
|
||||
logger.error(ffe_err)
|
||||
except FileExistsError:
|
||||
os.remove(target)
|
||||
os.symlink(source, target)
|
||||
@@ -0,0 +1,3 @@
|
||||
import os
|
||||
|
||||
LOGGING_FILE = os.path.join(os.path.dirname(__file__), 'logging.conf')
|
||||
@@ -1,9 +1,7 @@
|
||||
import logging
|
||||
import logging.config
|
||||
|
||||
from src import LOGGING_FILE
|
||||
from src.logger import LOGGING_FILE
|
||||
|
||||
|
||||
def init():
|
||||
"""Init log."""
|
||||
logging.config.fileConfig(LOGGING_FILE)
|
||||
@@ -1,5 +1,5 @@
|
||||
[loggers]
|
||||
keys=root, app
|
||||
keys=root
|
||||
|
||||
[handlers]
|
||||
keys=console
|
||||
@@ -11,16 +11,11 @@ keys=formatter
|
||||
level=INFO
|
||||
handlers=console
|
||||
|
||||
[logger_app]
|
||||
level=INFO
|
||||
handlers=console
|
||||
propagate=0
|
||||
qualname=app
|
||||
|
||||
[handler_console]
|
||||
class=StreamHandler
|
||||
formatter=formatter
|
||||
args=(sys.stdout,)
|
||||
|
||||
[formatter_formatter]
|
||||
format=[%(process)2d] [%(levelname)5s] %(name)s - %(message)s
|
||||
format=%(asctime)s %(levelname)s %(name)s - %(message)s
|
||||
datefmt=%Y-%m-%d %H:%M:%S
|
||||
@@ -0,0 +1,9 @@
|
||||
from unittest import TestCase
|
||||
|
||||
|
||||
class BaseTest(TestCase):
|
||||
def setUp(self) -> None:
|
||||
pass
|
||||
|
||||
def tearDown(self) -> None:
|
||||
pass
|
||||
@@ -0,0 +1,21 @@
|
||||
import os
|
||||
|
||||
from src.constants import ENV
|
||||
from src.tests import BaseTest
|
||||
|
||||
|
||||
class BaseDeviceTest(BaseTest):
|
||||
DEVICE_ENVS = {
|
||||
ENV.WORK_PATH: "/home/androidusr",
|
||||
ENV.USER_BEHAVIOR_ANALYTICS: str(False),
|
||||
ENV.EMULATOR_NO_SKIN: str(False)
|
||||
}
|
||||
|
||||
def setUp(self) -> None:
|
||||
for k, v in self.DEVICE_ENVS.items():
|
||||
os.environ[k] = v
|
||||
|
||||
def tearDown(self) -> None:
|
||||
for k in self.DEVICE_ENVS.keys():
|
||||
if os.environ[k]:
|
||||
del os.environ[k]
|
||||
@@ -0,0 +1,8 @@
|
||||
from src.device import Device
|
||||
from src.tests.device import BaseDeviceTest
|
||||
|
||||
|
||||
class TestDevice(BaseDeviceTest):
|
||||
def test_create_device(self):
|
||||
with self.assertRaises(TypeError):
|
||||
Device()
|
||||
@@ -0,0 +1,87 @@
|
||||
import mock
|
||||
|
||||
from src.device.emulator import Emulator
|
||||
from src.tests.device import BaseDeviceTest
|
||||
|
||||
|
||||
class TestEmulator(BaseDeviceTest):
|
||||
def setUp(self) -> None:
|
||||
super().setUp()
|
||||
self.name = "my_emu"
|
||||
self.device = "Nexus 4"
|
||||
self.a_version = "10.0"
|
||||
self.d_partition = "550m"
|
||||
self.additional_args = ""
|
||||
self.i_type = "google_apis"
|
||||
self.s_img = "x86"
|
||||
self.emu = Emulator(self.name, self.device, self.a_version, self.d_partition,
|
||||
self.additional_args, self.i_type, self.s_img)
|
||||
|
||||
def tearDown(self) -> None:
|
||||
super().tearDown()
|
||||
|
||||
def test_adb_name(self):
|
||||
my_emu = Emulator("my_other_emu", self.device, self.a_version, self.d_partition,
|
||||
self.additional_args, self.i_type, self.s_img)
|
||||
self.assertNotEqual(self.emu.adb_name, my_emu.adb_name)
|
||||
|
||||
def test_invalid_device(self):
|
||||
with self.assertRaises(RuntimeError):
|
||||
Emulator("my_other_emu", "unknown device", self.a_version, self.d_partition,
|
||||
self.additional_args, self.i_type, self.s_img)
|
||||
with self.assertRaises(RuntimeError):
|
||||
Emulator("my_other_emu", "NEXUS 5", self.a_version, self.d_partition,
|
||||
self.additional_args, self.i_type, self.s_img)
|
||||
|
||||
def test_invalid_android_version(self):
|
||||
with self.assertRaises(RuntimeError):
|
||||
Emulator("my_other_emu", self.device, "0.0", self.d_partition,
|
||||
self.additional_args, self.i_type, self.s_img)
|
||||
|
||||
@mock.patch("os.path.exists", mock.MagicMock(return_value=False))
|
||||
def test_initialisation_config_not_exist(self):
|
||||
self.assertEqual(self.emu.is_initialized(), False)
|
||||
|
||||
@mock.patch("os.path.exists", mock.MagicMock(return_value=True))
|
||||
@mock.patch("builtins.open", mock.mock_open(read_data=""))
|
||||
def test_initialisation_device_not_exist(self):
|
||||
self.assertEqual(self.emu.is_initialized(), False)
|
||||
|
||||
@mock.patch("os.path.exists", mock.MagicMock(return_value=True))
|
||||
@mock.patch("builtins.open", mock.mock_open(read_data="hw.device.name=Nexus 4\n"))
|
||||
def test_initialisation_device_exists(self):
|
||||
self.assertEqual(self.emu.is_initialized(), True)
|
||||
|
||||
@mock.patch("src.device.Device.set_status")
|
||||
@mock.patch("src.device.emulator.Emulator._add_profile")
|
||||
@mock.patch("subprocess.check_call")
|
||||
@mock.patch("src.device.emulator.Emulator._add_skin")
|
||||
@mock.patch("src.device.emulator.Emulator.is_initialized", mock.MagicMock(return_value=False))
|
||||
def test_create_device_not_exist(self, mocked_status, mocked_profile, mocked_subprocess, mocked_skin):
|
||||
self.emu.create()
|
||||
self.assertEqual(mocked_status.called, True)
|
||||
self.assertEqual(mocked_profile.called, True)
|
||||
self.assertEqual(mocked_subprocess.called, True)
|
||||
self.assertEqual(mocked_skin.called, True)
|
||||
|
||||
@mock.patch("src.device.Device.set_status")
|
||||
@mock.patch("src.device.emulator.Emulator._add_profile")
|
||||
@mock.patch("subprocess.check_call")
|
||||
@mock.patch("src.device.emulator.Emulator._add_skin")
|
||||
@mock.patch("src.device.emulator.Emulator.is_initialized", mock.MagicMock(return_value=True))
|
||||
def test_create_device_exists(self, mocked_status, mocked_profile, mocked_subprocess, mocked_skin):
|
||||
self.emu.create()
|
||||
self.assertEqual(mocked_status.called, False)
|
||||
self.assertEqual(mocked_profile.called, False)
|
||||
self.assertEqual(mocked_subprocess.called, False)
|
||||
|
||||
def test_check_adb_command(self):
|
||||
with mock.patch("subprocess.check_output", mock.MagicMock(return_value="1".encode("utf-8"))):
|
||||
self.emu.check_adb_command(
|
||||
self.emu.ReadinessCheck.BOOTED, "mocked_command", "1", 3, 0)
|
||||
|
||||
def test_check_adb_command_out_of_attempts(self):
|
||||
with mock.patch("subprocess.check_output", mock.MagicMock(return_value=" ".encode("utf-8"))):
|
||||
with self.assertRaises(RuntimeError):
|
||||
self.emu.check_adb_command(
|
||||
self.emu.ReadinessCheck.BOOTED, "mocked_command", "1", 3, 0)
|
||||
@@ -0,0 +1,73 @@
|
||||
import os
|
||||
import mock
|
||||
|
||||
from src.helper import convert_str_to_bool, get_env_value_or_raise, symlink_force
|
||||
from src.tests import BaseTest
|
||||
|
||||
|
||||
class TestHelperMethods(BaseTest):
|
||||
def test_boolean_converter_with_valid_str(self):
|
||||
self.assertEqual(convert_str_to_bool("TRUE"), True)
|
||||
self.assertEqual(convert_str_to_bool("true"), True)
|
||||
self.assertEqual(convert_str_to_bool("T"), True)
|
||||
self.assertEqual(convert_str_to_bool("Yes"), True)
|
||||
self.assertEqual(convert_str_to_bool("1"), True)
|
||||
self.assertEqual(convert_str_to_bool("False"), False)
|
||||
self.assertEqual(convert_str_to_bool("f"), False)
|
||||
self.assertEqual(convert_str_to_bool("0"), False)
|
||||
|
||||
def test_boolean_converter_with_empty(self):
|
||||
self.assertEqual(convert_str_to_bool(None), False)
|
||||
self.assertEqual(convert_str_to_bool(""), False)
|
||||
|
||||
def test_boolean_converter_with_invalid_str(self):
|
||||
self.assertEqual(convert_str_to_bool(" "), False)
|
||||
self.assertEqual(convert_str_to_bool("test"), False)
|
||||
|
||||
def test_boolean_converter_with_invalid_format(self):
|
||||
with self.assertRaises(AttributeError):
|
||||
convert_str_to_bool(True)
|
||||
|
||||
def test_get_env_value_from_valid_key(self):
|
||||
env_key = "env_key01"
|
||||
os.environ[env_key] = "env_value01"
|
||||
get_env_value_or_raise(env_key)
|
||||
del os.environ[env_key]
|
||||
|
||||
def test_get_env_value_with_empty_string(self):
|
||||
with self.assertRaises(RuntimeError):
|
||||
env_key = "env_key01"
|
||||
os.environ[env_key] = " "
|
||||
get_env_value_or_raise(env_key)
|
||||
del os.environ[env_key]
|
||||
|
||||
def test_get_env_value_from_invalid_key(self):
|
||||
with self.assertRaises(RuntimeError):
|
||||
get_env_value_or_raise("env_key02")
|
||||
|
||||
def test_get_env_value_with_invalid_format(self):
|
||||
with mock.patch("src.logger"):
|
||||
get_env_value_or_raise(True)
|
||||
|
||||
def test_symlink(self):
|
||||
s = os.path.join("source.txt")
|
||||
t = os.path.join("target_file.txt")
|
||||
open(s, "a").close()
|
||||
symlink_force(s, t)
|
||||
os.remove(s)
|
||||
os.remove(t)
|
||||
|
||||
def test_symlink_already_exist(self):
|
||||
s = os.path.join("source.txt")
|
||||
t = os.path.join("target_file.txt")
|
||||
open(s, "a").close()
|
||||
open(t, "a").close()
|
||||
symlink_force(s, t)
|
||||
os.remove(s)
|
||||
os.remove(t)
|
||||
|
||||
def test_symlink_file_not_exists(self):
|
||||
s = os.path.join("source.txt")
|
||||
t = os.path.join("target_file.txt")
|
||||
symlink_force(s, t)
|
||||
os.remove(t)
|
||||
@@ -0,0 +1,4 @@
|
||||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file
|
||||
!.gitignore
|
||||
|
Before Width: | Height: | Size: 112 KiB |
|
Before Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 53 KiB |
@@ -1,59 +0,0 @@
|
||||
parts {
|
||||
device {
|
||||
display {
|
||||
width 720
|
||||
height 1280
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
}
|
||||
portrait {
|
||||
background {
|
||||
image port_back.png
|
||||
}
|
||||
onion {
|
||||
image port_fore.png
|
||||
}
|
||||
}
|
||||
landscape {
|
||||
background {
|
||||
image land_back.png
|
||||
}
|
||||
onion {
|
||||
image land_fore.png
|
||||
}
|
||||
}
|
||||
}
|
||||
layouts {
|
||||
portrait {
|
||||
width 1101
|
||||
height 1709
|
||||
event EV_SW:0:1
|
||||
part1 {
|
||||
name portrait
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
part2 {
|
||||
name device
|
||||
x 192
|
||||
y 213
|
||||
}
|
||||
}
|
||||
landscape {
|
||||
width 1847
|
||||
height 886
|
||||
event EV_SW:0:0
|
||||
part1 {
|
||||
name landscape
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
part2 {
|
||||
name device
|
||||
x 304
|
||||
y 788
|
||||
rotation 3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 81 KiB |
|
Before Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 45 KiB |
|
Before Width: | Height: | Size: 7.6 KiB |
|
Before Width: | Height: | Size: 557 KiB |
|
Before Width: | Height: | Size: 68 KiB |
|
Before Width: | Height: | Size: 72 KiB |
@@ -1,59 +0,0 @@
|
||||
parts {
|
||||
device {
|
||||
display {
|
||||
width 1600
|
||||
height 2560
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
}
|
||||
portrait {
|
||||
background {
|
||||
image port_back.png
|
||||
}
|
||||
onion {
|
||||
image port_fore.png
|
||||
}
|
||||
}
|
||||
landscape {
|
||||
background {
|
||||
image land_back.png
|
||||
}
|
||||
onion {
|
||||
image land_fore.png
|
||||
}
|
||||
}
|
||||
}
|
||||
layouts {
|
||||
portrait {
|
||||
width 2330
|
||||
height 3136
|
||||
event EV_SW:0:1
|
||||
part1 {
|
||||
name portrait
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
part2 {
|
||||
name device
|
||||
x 366
|
||||
y 266
|
||||
}
|
||||
}
|
||||
landscape {
|
||||
width 3340
|
||||
height 2176
|
||||
event EV_SW:0:0
|
||||
part1 {
|
||||
name landscape
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
part2 {
|
||||
name device
|
||||
x 388
|
||||
y 1866
|
||||
rotation 3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 511 KiB |
|
Before Width: | Height: | Size: 65 KiB |
|
Before Width: | Height: | Size: 86 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 806 KiB |
|
Before Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 39 KiB |
@@ -1,59 +0,0 @@
|
||||
parts {
|
||||
device {
|
||||
display {
|
||||
width 1080
|
||||
height 1920
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
}
|
||||
portrait {
|
||||
background {
|
||||
image port_back.png
|
||||
}
|
||||
onion {
|
||||
image port_fore.png
|
||||
}
|
||||
}
|
||||
landscape {
|
||||
background {
|
||||
image land_back.png
|
||||
}
|
||||
onion {
|
||||
image land_fore.png
|
||||
}
|
||||
}
|
||||
}
|
||||
layouts {
|
||||
portrait {
|
||||
width 1370
|
||||
height 2446
|
||||
event EV_SW:0:1
|
||||
part1 {
|
||||
name portrait
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
part2 {
|
||||
name device
|
||||
x 147
|
||||
y 233
|
||||
}
|
||||
}
|
||||
landscape {
|
||||
width 2497
|
||||
height 1234
|
||||
event EV_SW:0:0
|
||||
part1 {
|
||||
name landscape
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
part2 {
|
||||
name device
|
||||
x 278
|
||||
y 1143
|
||||
rotation 3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 820 KiB |
|
Before Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 62 KiB |
|
Before Width: | Height: | Size: 690 KiB |
|
Before Width: | Height: | Size: 221 KiB |
|
Before Width: | Height: | Size: 60 KiB |
@@ -1,59 +0,0 @@
|
||||
parts {
|
||||
device {
|
||||
display {
|
||||
width 1440
|
||||
height 2560
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
}
|
||||
portrait {
|
||||
background {
|
||||
image port_back.png
|
||||
}
|
||||
onion {
|
||||
image port_fore.png
|
||||
}
|
||||
}
|
||||
landscape {
|
||||
background {
|
||||
image land_back.png
|
||||
}
|
||||
onion {
|
||||
image land_fore.png
|
||||
}
|
||||
}
|
||||
}
|
||||
layouts {
|
||||
portrait {
|
||||
width 1896
|
||||
height 3054
|
||||
event EV_SW:0:1
|
||||
part1 {
|
||||
name portrait
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
part2 {
|
||||
name device
|
||||
x 229
|
||||
y 239
|
||||
}
|
||||
}
|
||||
landscape {
|
||||
width 3142
|
||||
height 1639
|
||||
event EV_SW:0:0
|
||||
part1 {
|
||||
name landscape
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
part2 {
|
||||
name device
|
||||
x 318
|
||||
y 1516
|
||||
rotation 3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 779 KiB |
|
Before Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 92 KiB |
|
Before Width: | Height: | Size: 959 KiB |
|
Before Width: | Height: | Size: 72 KiB |
|
Before Width: | Height: | Size: 63 KiB |
@@ -1,59 +0,0 @@
|
||||
parts {
|
||||
device {
|
||||
display {
|
||||
width 1440
|
||||
height 2560
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
}
|
||||
portrait {
|
||||
background {
|
||||
image port_back.png
|
||||
}
|
||||
onion {
|
||||
image port_fore.png
|
||||
}
|
||||
}
|
||||
landscape {
|
||||
background {
|
||||
image land_back.png
|
||||
}
|
||||
onion {
|
||||
image land_fore.png
|
||||
}
|
||||
}
|
||||
}
|
||||
layouts {
|
||||
portrait {
|
||||
width 1840
|
||||
height 3251
|
||||
event EV_SW:0:1
|
||||
part1 {
|
||||
name portrait
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
part2 {
|
||||
name device
|
||||
x 195
|
||||
y 329
|
||||
}
|
||||
}
|
||||
landscape {
|
||||
width 3427
|
||||
height 1620
|
||||
event EV_SW:0:0
|
||||
part1 {
|
||||
name landscape
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
part2 {
|
||||
name device
|
||||
x 442
|
||||
y 1511
|
||||
rotation 3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1001 KiB |
|
Before Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 94 KiB |
|
Before Width: | Height: | Size: 1.5 MiB |
|
Before Width: | Height: | Size: 64 KiB |
|
Before Width: | Height: | Size: 67 KiB |
@@ -1,59 +0,0 @@
|
||||
parts {
|
||||
device {
|
||||
display {
|
||||
width 1536
|
||||
height 2048
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
}
|
||||
portrait {
|
||||
background {
|
||||
image port_back.png
|
||||
}
|
||||
onion {
|
||||
image port_fore.png
|
||||
}
|
||||
}
|
||||
landscape {
|
||||
background {
|
||||
image land_back.png
|
||||
}
|
||||
onion {
|
||||
image land_fore.png
|
||||
}
|
||||
}
|
||||
}
|
||||
layouts {
|
||||
portrait {
|
||||
width 1978
|
||||
height 2631
|
||||
event EV_SW:0:1
|
||||
part1 {
|
||||
name portrait
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
part2 {
|
||||
name device
|
||||
x 219
|
||||
y 264
|
||||
}
|
||||
}
|
||||
landscape {
|
||||
width 2854
|
||||
height 1785
|
||||
event EV_SW:0:0
|
||||
part1 {
|
||||
name landscape
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
part2 {
|
||||
name device
|
||||
x 401
|
||||
y 1635
|
||||
rotation 3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.7 MiB |
|
Before Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 67 KiB |
|
Before Width: | Height: | Size: 493 KiB |
|
Before Width: | Height: | Size: 76 KiB |
|
Before Width: | Height: | Size: 60 KiB |
@@ -1,59 +0,0 @@
|
||||
parts {
|
||||
device {
|
||||
display {
|
||||
width 1800
|
||||
height 2560
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
}
|
||||
portrait {
|
||||
background {
|
||||
image port_back.png
|
||||
}
|
||||
onion {
|
||||
image port_fore.png
|
||||
}
|
||||
}
|
||||
landscape {
|
||||
background {
|
||||
image land_back.png
|
||||
}
|
||||
onion {
|
||||
image land_fore.png
|
||||
}
|
||||
}
|
||||
}
|
||||
layouts {
|
||||
portrait {
|
||||
width 2307
|
||||
height 2971
|
||||
event EV_SW:0:1
|
||||
part1 {
|
||||
name portrait
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
part2 {
|
||||
name device
|
||||
x 259
|
||||
y 181
|
||||
}
|
||||
}
|
||||
landscape {
|
||||
width 3096
|
||||
height 2215
|
||||
event EV_SW:0:0
|
||||
part1 {
|
||||
name landscape
|
||||
x 0
|
||||
y 0
|
||||
}
|
||||
part2 {
|
||||
name device
|
||||
x 269
|
||||
y 1988
|
||||
rotation 3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 368 KiB |
|
Before Width: | Height: | Size: 67 KiB |
|
Before Width: | Height: | Size: 54 KiB |
@@ -1,3 +0,0 @@
|
||||
Sources:
|
||||
1. Android Studio IDE
|
||||
2. http://developer.samsung.com/technical-doc/view.do?v=T000000095
|
||||
@@ -0,0 +1,48 @@
|
||||
FROM appium/appium:v2.1.3-p0
|
||||
|
||||
LABEL maintainer "Budi Utomo <budtmo.os@gmail.com>"
|
||||
|
||||
USER root
|
||||
|
||||
#================
|
||||
# Basic Packages
|
||||
#----------------
|
||||
# socat
|
||||
# Port forwarder
|
||||
# supervisor
|
||||
# Process manager
|
||||
#================
|
||||
RUN apt-get -qqy update && apt-get -qqy install --no-install-recommends \
|
||||
socat \
|
||||
supervisor \
|
||||
&& apt autoremove -y \
|
||||
&& apt clean all \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
#==================
|
||||
# Configure Python
|
||||
#==================
|
||||
RUN apt-get -qqy update && \
|
||||
apt-get -qqy --no-install-recommends install \
|
||||
python3-pip \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
|
||||
|
||||
#=====================
|
||||
# Set release version
|
||||
#=====================
|
||||
ARG DOCKER_ANDROID_VERSION=test-version
|
||||
ENV DOCKER_ANDROID_VERSION=${DOCKER_ANDROID_VERSION}
|
||||
|
||||
#===============
|
||||
# Expose Ports
|
||||
#---------------
|
||||
# 4723
|
||||
# Appium port
|
||||
# 5554
|
||||
# Emulator port
|
||||
# 5555
|
||||
# ADB connection port
|
||||
#===============
|
||||
EXPOSE 4723 5554 5555
|
||||
@@ -0,0 +1,108 @@
|
||||
ARG DOCKER_ANDROID_VERSION
|
||||
FROM budtmo/docker-android:base_${DOCKER_ANDROID_VERSION}
|
||||
|
||||
#==================
|
||||
# Android Packages
|
||||
#==================
|
||||
ARG EMULATOR_ANDROID_VERSION
|
||||
ARG EMULATOR_API_LEVEL
|
||||
ENV EMULATOR_ANDROID_VERSION=${EMULATOR_ANDROID_VERSION} \
|
||||
EMULATOR_API_LEVEL=${EMULATOR_API_LEVEL} \
|
||||
EMULATOR_SYS_IMG=x86_64 \
|
||||
EMULATOR_IMG_TYPE=google_apis \
|
||||
EMULATOR_BROWSER=chrome
|
||||
ENV PATH ${PATH}:${ANDROID_HOME}/build-tools
|
||||
RUN yes | sdkmanager --licenses \
|
||||
&& sdkmanager "platforms;android-${EMULATOR_API_LEVEL}" \
|
||||
"system-images;android-${EMULATOR_API_LEVEL};${EMULATOR_IMG_TYPE};${EMULATOR_SYS_IMG}" "emulator" \
|
||||
&& ln -s ${ANDROID_HOME}/emulator/emulator /usr/bin/
|
||||
|
||||
#=============
|
||||
# UI Packages
|
||||
#-------------
|
||||
# ffmpeg
|
||||
# Video recorder
|
||||
# feh
|
||||
# Screen background
|
||||
# libxcomposite-dev
|
||||
# Window System for Emulator
|
||||
# menu
|
||||
# Debian menu
|
||||
# openbox
|
||||
# Windows manager
|
||||
# x11vnc
|
||||
# VNC server
|
||||
# xterm
|
||||
# Terminal emulator
|
||||
#==================
|
||||
RUN apt-get -qqy update && apt-get -qqy install --no-install-recommends \
|
||||
ffmpeg \
|
||||
feh \
|
||||
libxcomposite-dev \
|
||||
menu \
|
||||
openbox \
|
||||
x11vnc \
|
||||
xterm \
|
||||
&& apt autoremove -y \
|
||||
&& apt clean all \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
#=======
|
||||
# noVNC
|
||||
#=======
|
||||
ENV NOVNC_VERSION="1.4.0" \
|
||||
WEBSOCKIFY_VERSION="0.11.0" \
|
||||
OPT_PATH="/opt"
|
||||
RUN wget -nv -O noVNC.zip "https://github.com/novnc/noVNC/archive/refs/tags/v${NOVNC_VERSION}.zip" \
|
||||
&& unzip -x noVNC.zip \
|
||||
&& rm noVNC.zip \
|
||||
&& mv noVNC-${NOVNC_VERSION} ${OPT_PATH}/noVNC \
|
||||
&& wget -nv -O websockify.zip "https://github.com/novnc/websockify/archive/refs/tags/v${WEBSOCKIFY_VERSION}.zip" \
|
||||
&& unzip -x websockify.zip \
|
||||
&& mv websockify-${WEBSOCKIFY_VERSION} ${OPT_PATH}/noVNC/utils/websockify \
|
||||
&& rm websockify.zip \
|
||||
&& ln ${OPT_PATH}/noVNC/vnc.html ${OPT_PATH}/noVNC/index.html
|
||||
|
||||
ENV DISPLAY=:0 \
|
||||
SCREEN_NUMBER=0 \
|
||||
SCREEN_WIDTH=1600 \
|
||||
SCREEN_HEIGHT=900 \
|
||||
SCREEN_DEPTH=24+32 \
|
||||
VNC_PORT=5900 \
|
||||
WEB_VNC_PORT=6080
|
||||
|
||||
EXPOSE 5900 6080
|
||||
|
||||
#==========
|
||||
# Copy app
|
||||
#==========
|
||||
RUN rm -rf ${SCRIPT_PATH}
|
||||
ENV SCRIPT_PATH="docker-android"
|
||||
ENV WORK_PATH="/home/androidusr"
|
||||
ENV APP_PATH=${WORK_PATH}/${SCRIPT_PATH}
|
||||
RUN mkdir -p ${APP_PATH}
|
||||
COPY mixins ${APP_PATH}/mixins
|
||||
COPY cli ${APP_PATH}/cli
|
||||
RUN chown -R 1300:1301 ${APP_PATH} \
|
||||
&& pip install --quiet -e ${APP_PATH}/cli
|
||||
|
||||
#===================
|
||||
# Configure OpenBox
|
||||
#===================
|
||||
RUN echo ${APP_PATH}/mixins/configs/display/.fehbg >> /etc/xdg/openbox/autostart
|
||||
|
||||
#==================
|
||||
# Use created user
|
||||
#==================
|
||||
USER 1300:1301
|
||||
ENV LOG_PATH=${WORK_PATH}/logs \
|
||||
WEB_LOG_PORT=9000
|
||||
EXPOSE 9000
|
||||
RUN mkdir -p ${LOG_PATH}
|
||||
|
||||
#=========
|
||||
# Run App
|
||||
#=========
|
||||
STOPSIGNAL SIGTERM
|
||||
ENV DEVICE_TYPE=emulator
|
||||
ENTRYPOINT ["/home/androidusr/docker-android/mixins/scripts/run.sh"]
|
||||
@@ -0,0 +1,66 @@
|
||||
ARG DOCKER_ANDROID_VERSION
|
||||
FROM budtmo/docker-android:base_${DOCKER_ANDROID_VERSION}
|
||||
|
||||
#===================================================
|
||||
# Install Genymotion CLI
|
||||
# (for user management and deployment on Geny Cloud)
|
||||
#===================================================
|
||||
ENV GMSAAS_CLI_VERSION="1.7.1"
|
||||
RUN pip install gmsaas==${GMSAAS_CLI_VERSION}
|
||||
|
||||
#================
|
||||
# Cloud Packages
|
||||
#----------------
|
||||
# keychain
|
||||
# ssh-key generator
|
||||
#================
|
||||
RUN apt-get -qqy update && apt-get -qqy install --no-install-recommends \
|
||||
keychain \
|
||||
&& apt autoremove -y \
|
||||
&& apt clean all \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
#=========================================
|
||||
# Install Terraform
|
||||
# (for deployment on other cloud services)
|
||||
#=========================================
|
||||
ENV TERRAFORM_VERSION=1.4.6
|
||||
RUN wget -nv -O terraform.zip "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip" \
|
||||
&& unzip -x terraform.zip \
|
||||
&& mv terraform /usr/local/bin \
|
||||
&& rm terraform.zip
|
||||
|
||||
#==========
|
||||
# Copy app
|
||||
#==========
|
||||
RUN rm -rf ${SCRIPT_PATH}
|
||||
ENV SCRIPT_PATH="docker-android"
|
||||
ENV WORK_PATH="/home/androidusr"
|
||||
ENV APP_PATH=${WORK_PATH}/${SCRIPT_PATH}
|
||||
RUN mkdir -p ${APP_PATH}
|
||||
COPY mixins ${APP_PATH}/mixins
|
||||
COPY cli ${APP_PATH}/cli
|
||||
RUN chown -R 1300:1301 ${APP_PATH} \
|
||||
&& pip install --quiet -e ${APP_PATH}/cli
|
||||
|
||||
#===================================
|
||||
# Create Genymotion Template folder
|
||||
#===================================
|
||||
ENV GENYMOTION_TEMPLATE_PATH=${WORK_PATH}/genymotion_template
|
||||
RUN mkdir -p ${GENYMOTION_TEMPLATE_PATH}
|
||||
|
||||
#==================
|
||||
# Use created user
|
||||
#==================
|
||||
USER 1300:1301
|
||||
ENV LOG_PATH=${WORK_PATH}/logs \
|
||||
WEB_LOG_PORT=9000
|
||||
EXPOSE 9000
|
||||
RUN mkdir -p ${LOG_PATH}
|
||||
|
||||
#=========
|
||||
# Run App
|
||||
#=========
|
||||
STOPSIGNAL SIGTERM
|
||||
RUN gmsaas config set android-sdk-path ${ANDROID_HOME}
|
||||
ENTRYPOINT ["/home/androidusr/docker-android/mixins/scripts/run.sh"]
|
||||
@@ -0,0 +1,61 @@
|
||||
VNC-CLIENT
|
||||
----------
|
||||
|
||||
Vnc-server inside container is run on port 5900
|
||||
|
||||
1. Run docker-android:
|
||||
```
|
||||
docker run -d -p 5900:5900 -e EMULATOR_DEVICE="Samsung Galaxy S10" --device /dev/kvm --name android-container budtmo/docker-android:emulator_11.0
|
||||
```
|
||||
|
||||
2. Connect docker-container using vnc-client
|
||||
|
||||
Environment variables that can be passed to docker container for vnc configuration:
|
||||
|Environment Variable |Description |Example|
|
||||
|:---|:---|:---|
|
||||
|VNC_PASSWORD|protect vnc connection with password|docker run ... -e VNC_PASSWORD=thisissecret ...|
|
||||
|
||||
|
||||
VNC-WEB
|
||||
-------
|
||||
|
||||
Vnc-web inside container is run on port 6080
|
||||
|
||||
Environment variables that can be passed to docker container for vnc configuration:
|
||||
|Environment Variable |Description |Example|
|
||||
|:---|:---|:---|
|
||||
|WEB_VNC|access inside of the container through web-ui|docker run ... -p 6080:6080 -e WEB_VNC=true ...|
|
||||
|WEB_VNC_PORT|access inside of the container through web-ui on given port (default port 6080)|docker run ... -p 6081:6081 -e WEB_VNC=true -e WEB_VNC_PORT=6081 ...|
|
||||
|
||||
Possible endpoints if WEB_VNC is activated:
|
||||
|Endpoint |Description |Example|
|
||||
|:---|:---|:---|
|
||||
|autoconnect|access web-ui of vnc direclty|http://localhost:6080/?autoconnect=true|
|
||||
|view_only|give only view access|http://localhost:6080/?autoconnect=true&view_only=true|
|
||||
|password|access web-ui of vnc directly with protected password|http://localhost:6080/?autoconnect=true&password=thisissecret|
|
||||
|
||||
|
||||
LOG-SHARING
|
||||
-----------
|
||||
|
||||
The user has possibility to access log-files through web-ui:
|
||||
|Environment Variable |Description |Example|
|
||||
|:---|:---|:---|
|
||||
|WEB_LOG|access log-files through web-ui|docker run ... -e WEB_LOG=true ...|
|
||||
|WEB_LOG_PORT|access log-files through web-ui on given port (default port 9000)|docker run ... -e WEB_LOG=true -e WEB_LOG_PORT=9001 ...|
|
||||
|
||||
|
||||
EMULATOR
|
||||
--------
|
||||
|
||||
Possible environment variable to configure the Emulator:
|
||||
|Environment Variable |Description |Example|
|
||||
|:---|:---|:---|
|
||||
|EMULATOR_NAME|give emulator name (default name is a combination between Device name and Android version)|docker run ... -e EMULATOR_NAME=my_emu ...|
|
||||
|EMULATOR_DATA_PARTITION|set data partition on emulator (default value 550m)|docker run ... -e EMULATOR_DATA_PARTITION=900m ...|
|
||||
|EMULATOR_NO_SKIN|deploying emulator without skin|docker run ... -e EMULATOR_NO_SKIN=true ...|
|
||||
|
||||
The user can also pass needed arguments to android emulator through environment variable ***EMULATOR_ADDITIONAL_ARGS***. Please check [this page](https://developer.android.com/studio/run/emulator-commandline) for possible arguments that can be passed.
|
||||
|
||||
|
||||
[<- BACK TO README](../README.md)
|
||||
@@ -0,0 +1,91 @@
|
||||
Docker-Android-Pro
|
||||
------------------
|
||||
|
||||
Docker-Android-Pro is a sponsor based project which mean that the docker image of pro-version can be pulled only by [active sponsor](https://github.com/sponsors/budtmo). After donation, please send email [here](mailto:budtmo2.os@gmail.com) with following format on subject email: ```<github_id>-<date-when-donation-is-made>-<email>``` e.g. ```budtmo-30.01.2021-myemail@test.com```. The script will validate everything and it will send the access token to that email within 48 hours to be able to pull the pro version of docker-android image. Contact [@budtmo](https://github.com/budtmo) if you dont get access token after donation. The access token will be removed as soon as the user become inactive sponsor.
|
||||
|
||||
The differences between normal version and pro version are:
|
||||
|
||||
|Feature |Normal |Pro |Comment|
|
||||
|:---|:---|:---|:---|
|
||||
|user-behavior-analytics|Yes|No|-|
|
||||
|proxy|No|Yes|Set up company proxy on Android emulator on fly|
|
||||
|language|No|Yes|Set up language on Android emulator on fly|
|
||||
|root-privileged|No|Yes|Able to run command with security privileged|
|
||||
|headless-mode|No|Yes|Save resources by using headless mode|
|
||||
|Selenium 4.x integration|No|Yes|Running Appium UI-Tests againt one (Selenium Hub) endpoint for Android- and iOS emulator(s) / device(s)|
|
||||
|multiple Android-Simulators|No|Yes (soon)|Save resources by having multiple Android-Simulators on one docker-container|
|
||||
|Google Play Store|No|Yes (soon)|-|
|
||||
|Video Recording|No|Yes (soon)|Helpful for debugging|
|
||||
|
||||
|
||||
List of Docker-Images
|
||||
---------------------
|
||||
|Android |API |Type |Image with latest release version |Image with specific release version|
|
||||
|:---|:---|:---|:---|:---|
|
||||
|9.0|28|Normal|budtmo2/docker-android-pro:emulator_9.0|budtmo2/docker-android-pro:emulator_9.0_<release_version>|
|
||||
|10.0|29|Normal|budtmo2/docker-android-pro:emulator_10.0|budtmo2/docker-android-pro:emulator_10.0_<release_version>|
|
||||
|11.0|30|Normal|budtmo2/docker-android-pro:emulator_11.0|budtmo2/docker-android-pro:emulator_11.0_<release_version>|
|
||||
|12.0|32|Normal|budtmo2/docker-android-pro:emulator_12.0|budtmo2/docker-android-pro:emulator_12.0_<release_version>|
|
||||
|13.0|33|Normal|budtmo2/docker-android-pro:emulator_13.0|budtmo2/docker-android-pro:emulator_13.0_<release_version>|
|
||||
|9.0|28|Headless|budtmo2/docker-android-pro:emulator_headless_9.0|budtmo2/docker-android-pro:emulator_headless_9.0_<release_version>|
|
||||
|10.0|29|Headless|budtmo2/docker-android-pro:emulator_headless_10.0|budtmo2/docker-android-pro:emulator_headless_10.0_<release_version>|
|
||||
|11.0|30|Headless|budtmo2/docker-android-pro:emulator_headless_11.0|budtmo2/docker-android-pro:emulator_headless_11.0_<release_version>|
|
||||
|12.0|32|Headless|budtmo2/docker-android-pro:emulator_headless_12.0|budtmo2/docker-android-pro:emulator_headless_12.0_<release_version>|
|
||||
|13.0|33|Headless|budtmo2/docker-android-pro:emulator_headless_13.0|budtmo2/docker-android-pro:emulator_headless_13.0_<release_version>|
|
||||
|-|-|Selenium|budtmo2/docker-android-pro:selenium|budtmo2/docker-android-pro:selenium_<release_version>|
|
||||
|
||||
***Note: Headless mode does not have any Web-UI***
|
||||
|
||||
You can always pull the latest image tag. In case you want to see the release version that has been built with a changelog note and use that specific release version, the information will be sent to you as well.
|
||||
|
||||
|
||||
List of Devices
|
||||
---------------
|
||||
|
||||
Type | Device Name
|
||||
----- | -----
|
||||
Phone | Samsung Galaxy S10
|
||||
Phone | Samsung Galaxy S9
|
||||
Phone | Samsung Galaxy S8
|
||||
Phone | Samsung Galaxy S7 Edge
|
||||
Phone | Samsung Galaxy S7
|
||||
Phone | Samsung Galaxy S6
|
||||
Phone | Nexus 4
|
||||
Phone | Nexus 5
|
||||
Phone | Nexus One
|
||||
Phone | Nexus S
|
||||
Tablet | Nexus 7
|
||||
|
||||
|
||||
Proxy
|
||||
-----
|
||||
|
||||
You can enable proxy inside container and Android emulator by passing following environment variables:
|
||||
|
||||
- HTTP_PROXY="http://\<docker\_bridge\_ip>:<port>"
|
||||
- HTTPS_PROXY="http://\<docker\_bridge\_ip>:<port>"
|
||||
- NO_PROXY="localhost"
|
||||
- EMULATOR_PROXY_URL="http://\<docker\_bridge\_ip>:<port>"
|
||||
- EMULATOR_PROXY_USER="\<proxy_user>"
|
||||
- EMULATOR_PROXY_PASS="\<proxy_pass>"
|
||||
|
||||
|
||||
Language
|
||||
--------
|
||||
|
||||
You can change the language setting of Android Emulator on the fly by passing following environment variable:
|
||||
|
||||
- EMULATOR_LANGUAGE="\<language>"
|
||||
- EMULATOR_COUNTRY="\<country>"
|
||||
|
||||
|
||||
Selenium
|
||||
--------
|
||||
|
||||
Pull and run image that contains Selenium with Appium urls and its capabilities which is stored inside node.json file:
|
||||
|
||||
```
|
||||
docker run -t --rm --name selenium -p 4444:4444 -v $PWD/pro-example/node.json:/home/seleniumusr/selenium_node_config/node.json budtmo2/docker-android-pro:selenium
|
||||
```
|
||||
|
||||
[<- BACK TO README](../README.md)
|
||||