From ffb5edd2e4ef0ac22ab215bc02d7638b7a6d7fe6 Mon Sep 17 00:00:00 2001
From: Jorge Martin Espinosa <jorgem@element.io>
Date: Thu, 24 Nov 2022 09:46:11 +0100
Subject: [PATCH] Set timeout for test CI jobs (#7598)

* Set timeout for test CI jobs

* Increase timeout to 1.5h: some Test jobs successfully finish > 1h
---
 .github/workflows/post-pr.yml |  5 +++--
 .github/workflows/tests.yml   | 37 ++++++++++++++++++-----------------
 2 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/.github/workflows/post-pr.yml b/.github/workflows/post-pr.yml
index aac4fffa4e..af854bf371 100644
--- a/.github/workflows/post-pr.yml
+++ b/.github/workflows/post-pr.yml
@@ -16,7 +16,7 @@ env:
 jobs:
 
   # More info on should-i-run:
-  # If this fails to run (the IF doesn't complete) then the needs will not be satisfied for any of the 
+  # If this fails to run (the IF doesn't complete) then the needs will not be satisfied for any of the
   # other jobs below, so none will run.
   # except for the notification job at the bottom which will run all the time, unless should-i-run isn't
   # successful, or all the other jobs have succeeded
@@ -27,11 +27,12 @@ jobs:
     if: github.event.pull_request.merged # Additionally require PR to have been completely merged.
     steps:
       - run: echo "Run those tests!" # no-op success
-        
+
   ui-tests:
     name: UI Tests (Synapse)
     needs: should-i-run
     runs-on: buildjet-4vcpu-ubuntu-2204
+    timeout-minutes: 90 # We might need to increase it if the time for tests grows
     strategy:
       fail-fast: false
       matrix:
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index bb16d8abe8..931ec2da45 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -14,6 +14,7 @@ jobs:
   tests:
     name: Runs all tests
     runs-on: buildjet-4vcpu-ubuntu-2204
+    timeout-minutes: 90 # We might need to increase it if the time for tests grows
     strategy:
       matrix:
         api-level: [28]
@@ -126,26 +127,26 @@ jobs:
 # Unneeded as part of the test suite above, kept around in case we want to re-enable them.
 #
 #  # Build Android Tests
-#  build-android-tests: 
-#    name: Build Android Tests 
-#    runs-on: ubuntu-latest 
+#  build-android-tests:
+#    name: Build Android Tests
+#    runs-on: ubuntu-latest
 #    concurrency:
 #      group: ${{ github.ref == 'refs/heads/main' && format('unit-tests-main-{0}', github.sha) || github.ref == 'refs/heads/develop' && format('unit-tests-develop-{0}', github.sha) || format('build-android-tests-{0}', github.ref) }}
 #      cancel-in-progress: true
-#    steps: 
-#      - uses: actions/checkout@v3 
-#      - uses: actions/setup-java@v3 
-#        with: 
-#          distribution: 'adopt' 
-#          java-version: 11 
-#      - uses: actions/cache@v3 
-#        with: 
-#          path: | 
-#            ~/.gradle/caches 
-#            ~/.gradle/wrapper 
-#          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} 
-#          restore-keys: | 
-#            ${{ runner.os }}-gradle- 
-#      - name: Build Android Tests  
+#    steps:
+#      - uses: actions/checkout@v3
+#      - uses: actions/setup-java@v3
+#        with:
+#          distribution: 'adopt'
+#          java-version: 11
+#      - uses: actions/cache@v3
+#        with:
+#          path: |
+#            ~/.gradle/caches
+#            ~/.gradle/wrapper
+#          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
+#          restore-keys: |
+#            ${{ runner.os }}-gradle-
+#      - name: Build Android Tests
 #        run: ./gradlew clean assembleAndroidTest $CI_GRADLE_ARG_PROPERTIES