ci: upload ui tests fixtures

pull/784/head
Tomas Susanka 4 years ago
parent edcd4f9ccc
commit 3dfbe7aa98

@ -194,3 +194,18 @@ upgrade tests legacy deploy:
- branches # run for tags only
tags:
- deploy
# UI tests
ui tests core fixtures deploy:
stage: deploy
variables:
DEPLOY_PATH: "${DEPLOY_BASE_DIR}/ui_tests/"
before_script: [] # no pipenv
dependencies:
- core unix device ui test
script:
- echo "Deploying to $DEPLOY_PATH"
- rsync --delete -va ci/tmp/* "$DEPLOY_PATH"
tags:
- deploy

@ -0,0 +1,30 @@
import hashlib
import shutil
from pathlib import Path
def _hash_files(files):
hasher = hashlib.sha256()
for file in sorted(files):
with open(file, "rb") as f:
content = f.read()
hasher.update(content)
return hasher.digest().hex()
def _compare_hash(test_dir, hash):
with open(test_dir / "hash.txt", "r") as f:
content = f.read()
assert hash == content
fixture_root = Path().cwd() / "../tests/ui_tests/fixtures"
for test_dir in fixture_root.iterdir():
if test_dir.is_dir():
recorded_dir = test_dir / "recorded"
if recorded_dir.exists():
hash = _hash_files(recorded_dir.iterdir())
_compare_hash(test_dir, hash)
shutil.make_archive("tmp/" + hash, "zip", recorded_dir)

@ -47,10 +47,13 @@ core unix device ui test:
- cd core
- pipenv run make test_emu_ui
- cp /var/tmp/trezor.log ${CI_PROJECT_DIR}
- cd ../ci
- pipenv run python prepare_ui_artifacts.py
artifacts:
name: core-unix-device-test.log
name: core-unix-device-test
paths:
- trezor.log
- ci/tmp/
expire_in: 1 week
core unix device test:

2
ci/tmp/.gitignore vendored

@ -0,0 +1,2 @@
*
!.gitignore

@ -4,3 +4,4 @@
^\./legacy/
^\./storage/
^\./tests/
^\./ci/

Loading…
Cancel
Save