|
1 | | -#!/bin/bash |
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +# |
| 4 | +# © 2016-present FlowCrypt a.s. Limitations apply. Contact human@flowcrypt.com |
| 5 | +# Contributors: denbond7 |
| 6 | +# |
| 7 | + |
| 8 | +set -euo pipefail |
2 | 9 |
|
3 | 10 | if [[ "$SEMAPHORE_JOB_NAME" =~ ^Lint.* ]]; then |
4 | | - # don't do any things for 'Lint(structural quality)' job |
5 | | - exit 0 |
| 11 | + # Do nothing for 'Lint(structural quality)' job. |
| 12 | + exit 0 |
6 | 13 | fi |
7 | 14 |
|
8 | | -echo "Store tests results for $SEMAPHORE_JOB_NAME" |
9 | | -artifact push job FlowCrypt/build/reports/ |
| 15 | +reports_dir="FlowCrypt/build/reports/" |
| 16 | +if [[ -d "$reports_dir" ]]; then |
| 17 | + echo "Store test reports for $SEMAPHORE_JOB_NAME" |
| 18 | + artifact push job "$reports_dir" |
| 19 | +else |
| 20 | + echo "Reports directory does not exist: $reports_dir" |
| 21 | +fi |
10 | 22 |
|
11 | 23 | if [[ "$SEMAPHORE_JOB_NAME" =~ ^Instrumentation.* ]]; then |
12 | | - # store full logcat log |
13 | | - echo "Collect logcat logs as logcat.txt.gz for $SEMAPHORE_JOB_NAME" |
14 | | - adb logcat -d | gzip > ~/logcat.txt.gz |
15 | | - artifact push job ~/logcat.txt.gz |
| 24 | + # store full logcat log |
| 25 | + echo "Collect logcat logs as logcat.txt.gz for $SEMAPHORE_JOB_NAME" |
| 26 | + adb logcat -d | gzip > "$HOME/logcat.txt.gz" |
| 27 | + artifact push job "$HOME/logcat.txt.gz" |
16 | 28 |
|
17 | | - # store the device's screenshot. it may help to debug a failure |
18 | | - echo "Store the device's screenshot for $SEMAPHORE_JOB_NAME" |
19 | | - adb shell screencap -p /sdcard/screencap.png |
20 | | - adb pull "/sdcard/screencap.png" |
21 | | - artifact push job screencap.png |
| 29 | + echo "Store the device's screenshot for $SEMAPHORE_JOB_NAME" |
| 30 | + if adb shell screencap -p /sdcard/screencap.png; then |
| 31 | + if adb pull "/sdcard/screencap.png"; then |
| 32 | + artifact push job screencap.png |
| 33 | + else |
| 34 | + echo "Could not pull screencap.png" |
| 35 | + fi |
| 36 | + else |
| 37 | + echo "Could not create screencap.png" |
| 38 | + fi |
22 | 39 | fi |
23 | | - |
|
0 commit comments