Compare commits

...
11 Commits
Author SHA1 Message Date
budi f2a418d712 Updated base image 2025-08-28 11:25:11 +02:00
budi 44dcc5b166 Updated novnc and websockify 2025-08-25 15:42:55 +02:00
budi 2e88c06124 Updated base image 2025-08-25 15:42:20 +02:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
6b34c74a25 [pip] Bump coverage from 7.10.4 to 7.10.5 (#530)
Bumps [coverage](https://github.com/nedbat/coveragepy) from 7.10.4 to 7.10.5.
- [Release notes](https://github.com/nedbat/coveragepy/releases)
- [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst)
- [Commits](https://github.com/nedbat/coveragepy/compare/7.10.4...7.10.5)

---
updated-dependencies:
- dependency-name: coverage
  dependency-version: 7.10.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-25 02:06:36 +02:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1fc2c74d8c [pip] Bump requests from 2.32.3 to 2.32.5 (#528)
Bumps [requests](https://github.com/psf/requests) from 2.32.3 to 2.32.5.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md)
- [Commits](https://github.com/psf/requests/compare/v2.32.3...v2.32.5)

---
updated-dependencies:
- dependency-name: requests
  dependency-version: 2.32.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-20 08:21:10 +02:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
ffbafe87e8 [github-action] Bump actions/checkout from 4 to 5 (#523)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-19 10:53:54 +02:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
62fa6a05c8 [pip] Bump coverage from 7.10.3 to 7.10.4 (#527)
Bumps [coverage](https://github.com/nedbat/coveragepy) from 7.10.3 to 7.10.4.
- [Release notes](https://github.com/nedbat/coveragepy/releases)
- [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst)
- [Commits](https://github.com/nedbat/coveragepy/compare/7.10.3...7.10.4)

---
updated-dependencies:
- dependency-name: coverage
  dependency-version: 7.10.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-19 10:42:11 +02:00
lilinorandGitHub 77542f5b45 Start and stop SaaS devices in parallel (#524) 2025-08-19 09:57:05 +02:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
39df955c26 [pip] Bump coverage from 7.10.2 to 7.10.3 (#522)
Bumps [coverage](https://github.com/nedbat/coveragepy) from 7.10.2 to 7.10.3.
- [Release notes](https://github.com/nedbat/coveragepy/releases)
- [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst)
- [Commits](https://github.com/nedbat/coveragepy/compare/7.10.2...7.10.3)

---
updated-dependencies:
- dependency-name: coverage
  dependency-version: 7.10.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-13 06:13:47 +02:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
8da596a8f1 [pip] Bump coverage from 7.10.1 to 7.10.2 (#521)
Bumps [coverage](https://github.com/nedbat/coveragepy) from 7.10.1 to 7.10.2.
- [Release notes](https://github.com/nedbat/coveragepy/releases)
- [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst)
- [Commits](https://github.com/nedbat/coveragepy/compare/7.10.1...7.10.2)

---
updated-dependencies:
- dependency-name: coverage
  dependency-version: 7.10.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-10 10:20:17 +02:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
7f55b248fd [pip] Bump coverage from 7.10.0 to 7.10.1 (#520)
Bumps [coverage](https://github.com/nedbat/coveragepy) from 7.10.0 to 7.10.1.
- [Release notes](https://github.com/nedbat/coveragepy/releases)
- [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst)
- [Commits](https://github.com/nedbat/coveragepy/compare/7.10.0...7.10.1)

---
updated-dependencies:
- dependency-name: coverage
  dependency-version: 7.10.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-01 00:46:37 +02:00
7 changed files with 100 additions and 39 deletions
+4 -4
View File
@@ -13,7 +13,7 @@ jobs:
python-version: ["3.8"]
steps:
- name: Checkout the repo
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Run unit-test
run: script -e -c "./app.sh test emulator test 11.0 && sudo mv tmp/* ."
@@ -23,7 +23,7 @@ jobs:
needs: run_test
steps:
- name: Checkout the repo
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Get release version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
@@ -42,7 +42,7 @@ jobs:
android: ["9.0", "10.0", "11.0", "12.0", "13.0", "14.0"]
steps:
- name: Checkout the repo
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
@@ -67,7 +67,7 @@ jobs:
needs: release_base
steps:
- name: Checkout the repo
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
+1 -1
View File
@@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Checkout the repo
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
+1 -1
View File
@@ -11,7 +11,7 @@ jobs:
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.actor == 'budtmo'
steps:
- name: Checkout the repo
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
+2 -2
View File
@@ -1,9 +1,9 @@
autopep8==2.3.2
click==8.2.1
coverage==7.10.0
coverage==7.10.5
mock==5.2.0
pytest==8.4.1
pytest-cov==6.2.1
pytest-xdist==3.8.0
requests==2.32.3
requests==2.32.5
setuptools==80.9.0
+89 -28
View File
@@ -1,19 +1,20 @@
import logging
import os
import subprocess
import concurrent.futures
import uuid
from device import Genymotion, DeviceType
from helper import get_env_value_or_raise
from 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:
if os.getenv(ENV.GENY_AUTH_TOKEN):
auth_token = get_env_value_or_raise(ENV.GENY_AUTH_TOKEN)
@@ -23,14 +24,16 @@ class GenySAAS(Genymotion):
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()
# Collect all items first
items = []
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":
@@ -41,40 +44,98 @@ class GenySAAS(Genymotion):
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)
items.append({
'name': name,
'template': template,
'local_port': local_port
})
# Start all devices in parallel
with concurrent.futures.ThreadPoolExecutor(max_workers=100) as executor:
try:
# Submit all tasks
future_to_item = {executor.submit(self.create_instance, item): item for item in items}
# Collect results as they complete
for future in concurrent.futures.as_completed(future_to_item):
item = future_to_item[future]
try:
created_device = future.result()
self.created_devices.append(created_device)
self.logger.info(f"Successfully created device: {created_device}")
except Exception as e:
self.logger.error(f"Instance creation failed for {item['name']}: {e}")
self.shutdown_and_logout()
exit(1)
except Exception as e:
self.shutdown_and_logout()
self.logger.error(f"Parallel execution failed: {e}")
exit(1)
def create_instance(self, item_data):
"""Create a single instance and return the result"""
name = item_data['name']
template = item_data['template']
local_port = item_data['local_port']
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", "")
# Connect to ADB
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)
return {f"{name}": instance_id}
except Exception as e:
self.logger.error(f"Failed to create instance {name}: {e}")
raise e
def stop_instance(self, device_info):
"""Stop a single instance"""
for name, instance_id in device_info.items():
try:
subprocess.check_call(f"gmsaas instances stop {instance_id}", shell=True)
self.logger.info(f"device '{name}' is successfully removed!")
return True
except Exception as e:
self.logger.error(f"Failed to stop device '{name}': {e}")
return False
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!")
# Stop all devices in parallel
with concurrent.futures.ThreadPoolExecutor(max_workers=100) as executor:
# Submit all stop tasks
futures = [executor.submit(self.stop_instance, device) for device in self.created_devices]
# Wait for all to complete
for future in concurrent.futures.as_completed(futures):
try:
future.result()
except Exception as e:
self.logger.error(f"Error during device shutdown: {e}")
# Logout after all devices are stopped
if os.getenv(ENV.GENY_AUTH_TOKEN):
subprocess.check_call("gmsaas auth reset", shell=True)
else:
subprocess.check_call("gmsaas auth logout", shell=True)
self.logger.info("successfully logged out!")
self.logger.info("successfully logged out!")
+1 -1
View File
@@ -1,4 +1,4 @@
FROM appium/appium:v2.19.0-p3
FROM appium/appium:v3.0.1-p0
ARG AUTHORS="Budi Utomo"
LABEL author="${AUTHORS} <budtmo.os@gmail.com>"
+2 -2
View File
@@ -50,8 +50,8 @@ RUN apt-get -qqy update && apt-get -qqy install --no-install-recommends \
#=======
# noVNC
#=======
ENV NOVNC_VERSION="1.4.0" \
WEBSOCKIFY_VERSION="0.11.0" \
ENV NOVNC_VERSION="1.6.0" \
WEBSOCKIFY_VERSION="0.13.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 \