summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAlbin <albin@mullvad.net>2024-02-13 16:01:21 +0100
committerAlbin <albin@mullvad.net>2024-02-14 15:37:35 +0100
commit1e1e4fa92144defc332349871b2a1b84ff699c1a (patch)
treefefa99a6ae62b8765234c28688fcba289270213c
parent5c29187dbc4104d2f81f5c8e2cd53299a78c53fe (diff)
downloadmullvadvpn-1e1e4fa92144defc332349871b2a1b84ff699c1a.tar.xz
mullvadvpn-1e1e4fa92144defc332349871b2a1b84ff699c1a.zip
Fix actions report upload
-rw-r--r--.github/workflows/android-app.yml10
-rwxr-xr-xandroid/scripts/run-instrumented-tests.sh32
2 files changed, 27 insertions, 15 deletions
diff --git a/.github/workflows/android-app.yml b/.github/workflows/android-app.yml
index ed7ea45366..7413b94c50 100644
--- a/.github/workflows/android-app.yml
+++ b/.github/workflows/android-app.yml
@@ -312,6 +312,12 @@ jobs:
matrix:
test-type: [app] # Temporarily disabled: mockapi
steps:
+ - name: Set report path variable
+ id: determine-report-path
+ env:
+ UNIQUE_RUN_ID: ${{ matrix.test-type }}-${{ github.run_id }}-${{ github.run_attempt }}
+ run: echo "report_path=/tmp/$UNIQUE_RUN_ID" >> $GITHUB_OUTPUT
+
- name: Checkout repository
uses: actions/checkout@v3
@@ -327,7 +333,9 @@ jobs:
TEST_TYPE: ${{ matrix.test-type }}
BILLING_FLAVOR: oss
INFRA_FLAVOR: prod
+ REPORT_DIR: ${{ steps.determine-report-path.outputs.report_path }}
run: |
+ mkdir -p $REPORT_DIR
./android/scripts/run-instrumented-tests.sh
- name: Upload instrumentation report (${{ matrix.test-type }})
@@ -335,7 +343,7 @@ jobs:
if: always()
with:
name: ${{ matrix.test-type }}-instrumentation-report
- path: /tmp/mullvad-${{ matrix.test-type }}-instrumentation-report
+ path: ${{ steps.determine-report-path.outputs.report_path }}
if-no-files-found: ignore
retention-days: 7
diff --git a/android/scripts/run-instrumented-tests.sh b/android/scripts/run-instrumented-tests.sh
index 0288439f56..e0c2a6239a 100755
--- a/android/scripts/run-instrumented-tests.sh
+++ b/android/scripts/run-instrumented-tests.sh
@@ -10,17 +10,13 @@ AUTO_FETCH_TEST_HELPER_APKS=${AUTO_FETCH_TEST_HELPER_APKS:-"false"}
APK_BASE_DIR=${APK_BASE_DIR:-"$SCRIPT_DIR/.."}
LOG_FAILURE_MESSAGE="FAILURES!!!"
-TEMP_DIR=$(mktemp -d -t test-run-XXXX)
-
-DEFAULT_ORCHESTRATOR_APK_PATH=$TEMP_DIR/orchestrator.apk
-DEFAULT_TEST_SERVICES_APK_PATH=$TEMP_DIR/test-services.apk
-
ORCHESTRATOR_URL=https://dl.google.com/android/maven2/androidx/test/orchestrator/1.4.2/orchestrator-1.4.2.apk
TEST_SERVICES_URL=https://dl.google.com/android/maven2/androidx/test/services/test-services/1.4.2/test-services-1.4.2.apk
PARTNER_AUTH="${PARTNER_AUTH:-}"
VALID_TEST_ACCOUNT_TOKEN="${VALID_TEST_ACCOUNT_TOKEN:-}"
INVALID_TEST_ACCOUNT_TOKEN="${INVALID_TEST_ACCOUNT_TOKEN:-}"
+REPORT_DIR="${REPORT_DIR:-}"
while [[ "$#" -gt 0 ]]; do
case $1 in
@@ -74,6 +70,7 @@ if [[ -z ${BILLING_FLAVOR-} ]]; then
fi
echo "### Configuration ###"
+echo "Report dir: $REPORT_DIR"
echo "Test type: $TEST_TYPE"
echo "Infra flavor: $INFRA_FLAVOR"
echo "Billing flavor: $BILLING_FLAVOR"
@@ -143,25 +140,30 @@ case "$TEST_TYPE" in
;;
esac
-LOCAL_TMP_REPORT_PATH="$TEMP_DIR/mullvad-$TEST_TYPE-instrumentation-report"
-INSTRUMENTATION_LOG_FILE_PATH="$LOCAL_TMP_REPORT_PATH/instrumentation-log.txt"
-LOGCAT_FILE_PATH="$LOCAL_TMP_REPORT_PATH/logcat.txt"
-LOCAL_SCREENSHOT_PATH="$LOCAL_TMP_REPORT_PATH/screenshots"
+if [[ -z $REPORT_DIR || ! -d $REPORT_DIR ]]; then
+ echo ""
+ echo "Error: The variable REPORT_DIR must be set and the directory must exist."
+ exit 1
+fi
+
+INSTRUMENTATION_LOG_FILE_PATH="$REPORT_DIR/instrumentation-log.txt"
+LOGCAT_FILE_PATH="$REPORT_DIR/logcat.txt"
+LOCAL_SCREENSHOT_PATH="$REPORT_DIR/screenshots"
DEVICE_SCREENSHOT_PATH="/sdcard/Pictures/mullvad-$TEST_TYPE"
echo ""
echo "### Ensure clean report structure ###"
-rm -rf "$LOCAL_TMP_REPORT_PATH" || echo "No report path"
+rm -rf "${REPORT_DIR:?}/*"
adb logcat --clear
adb shell rm -rf "$DEVICE_SCREENSHOT_PATH"
-mkdir "$LOCAL_TMP_REPORT_PATH"
echo ""
if [[ "${USE_ORCHESTRATOR-}" == "true" ]]; then
if [[ "${AUTO_FETCH_TEST_HELPER_APKS-}" == "true" ]]; then
echo "### Fetching orchestrator and test services apks ###"
- ORCHESTRATOR_APK_PATH=$DEFAULT_ORCHESTRATOR_APK_PATH
- TEST_SERVICES_APK_PATH=$DEFAULT_TEST_SERVICES_APK_PATH
+ TEMP_DOWNLOAD_DIR=$(mktemp -d)
+ ORCHESTRATOR_APK_PATH=$TEMP_DOWNLOAD_DIR/orchestrator.apk
+ TEST_SERVICES_APK_PATH=$TEMP_DOWNLOAD_DIR/test-services.apk
curl -sL "$ORCHESTRATOR_URL" -o "$ORCHESTRATOR_APK_PATH"
curl -sL "$TEST_SERVICES_URL" -o "$TEST_SERVICES_APK_PATH"
echo ""
@@ -235,4 +237,6 @@ else
echo "No failures!"
fi
-rm -rf "$TEMP_DIR"
+if [[ -n ${TEMP_DOWNLOAD_DIR-} ]]; then
+ rm -rf "$TEMP_DOWNLOAD_DIR"
+fi