Repository: wix/Detox
Pull request #3969 (2023-03-03 18:02:22)

ci(github): update and optimize flows
Internal task to optimize run time on Windows and Linux.


Patch:
diff --git a/.github/workflows/broken-links-scan.yml b/.github/workflows/broken-links-scan.yml
index 2188207ab..f8081700d 100644
--- a/.github/workflows/broken-links-scan.yml
+++ b/.github/workflows/broken-links-scan.yml
@@ -10,8 +10,8 @@ jobs:
     name: Remark
     runs-on: ubuntu-latest
     steps:
-      - uses: actions/checkout@v2
-      - uses: actions/setup-node@v2
+      - uses: actions/checkout@v3
+      - uses: actions/setup-node@v3
         with:
           node-version: 14
       - uses: bahmutov/npm-install@v1
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index 11b8e1cb6..81a875ff2 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -29,8 +29,8 @@ jobs:
     name: Markdown
     runs-on: ubuntu-latest
     steps:
-      - uses: actions/checkout@v2
-      - uses: actions/setup-node@v2
+      - uses: actions/checkout@v3
+      - uses: actions/setup-node@v3
         with:
           node-version: 14
       - uses: bahmutov/npm-install@v1
diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml
index 13df06fc4..e3d010aa2 100644
--- a/.github/workflows/website.yml
+++ b/.github/workflows/website.yml
@@ -19,8 +19,8 @@ jobs:
     if: github.event_name != 'push'
     runs-on: ubuntu-latest
     steps:
-      - uses: actions/checkout@v1
-      - uses: actions/setup-node@v1
+      - uses: actions/checkout@v3
+      - uses: actions/setup-node@v3
         with:
           node-version: '16.x'
       - uses: dorny/paths-filter@v2
@@ -46,8 +46,8 @@ jobs:
       contents: write
     runs-on: ubuntu-latest
     steps:
-      - uses: actions/checkout@v1
-      - uses: actions/setup-node@v1
+      - uses: actions/checkout@v3
+      - uses: actions/setup-node@v3
         with:
           node-version: '16.x'
       - uses: webfactory/ssh-agent@v0.5.0
diff --git a/scripts/ci.android.sh b/scripts/ci.android.sh
index 0be1c2045..1bb01db7d 100755
--- a/scripts/ci.android.sh
+++ b/scripts/ci.android.sh
@@ -31,11 +31,9 @@ mkdir -p coverage
 pushd detox/test
 
 run_f "npm run build:android"
-cp ../coverage/lcov.info ../../coverage/unit.lcov
 
 run_f "npm run e2e:android:genycloud"
 cp coverage/lcov.info ../../coverage/e2e-genycloud-ci.lcov
-allure generate || echo "Allure is not installed"
 
 run_f "npm run e2e:android -- e2e/01* e2e/02* e2e/03.actions*"
 cp coverage/lcov.info ../../coverage/e2e-emulator-ci.lcov
diff --git a/scripts/ci.ios.sh b/scripts/ci.ios.sh
index b929e97eb..30bbf85c4 100755
--- a/scripts/ci.ios.sh
+++ b/scripts/ci.ios.sh
@@ -10,11 +10,8 @@ mkdir -p coverage
 pushd detox/test
 
 run_f "npm run build:ios"
-cp ../coverage/lcov.info ../../coverage/unit.lcov
-
 run_f "npm run e2e:ios"
 cp coverage/lcov.info ../../coverage/e2e-ios-ci.lcov
-allure generate || echo "Allure is not installed"
 
 run_f "scripts/ci_unhappy.sh ios"
 
diff --git a/scripts/ci.sh b/scripts/ci.sh
index 67b9dfce4..52907fec8 100755
--- a/scripts/ci.sh
+++ b/scripts/ci.sh
@@ -10,13 +10,3 @@ fi
 
 run_f "lerna bootstrap --no-ci"
 run_f "lerna run build"
-
-if [ "$1" == 'noGenerate' ]; then
-  run_f "lerna run test --ignore=generation"
-else
-  run_f "lerna run test"
-fi
-
-pushd detox
-allure generate || echo "Allure is not installed"
-popd
diff --git a/scripts/upload_artifact.sh b/scripts/upload_artifact.sh
index 39657bb75..dd7dd6e34 100755
--- a/scripts/upload_artifact.sh
+++ b/scripts/upload_artifact.sh
@@ -3,9 +3,9 @@
 DATE=`date '+%Y-%m-%d_%H-%M-%S'`
 
 pack() {
-  BASE_NAME=$1
-  ARTIFACTS_DIR=$2
-  CONTEXT=$3
+  local BASE_NAME=$1
+  local ARTIFACTS_DIR=$2
+  local CONTEXT=$3
 
   if [ $CI ]; then
     ARTIFACTS_NAME="${BASE_NAME}_${BUILDKITE_BUILD_NUMBER}_${CONTEXT}_${DATE}.tar.gz"
@@ -19,7 +19,17 @@ pack() {
   fi
 }
 
+generate_allure_report() {
+  local ROOT_DIR=$1
+
+  cd $ROOT_DIR
+  [ -d "allure-results" ] && allure generate || echo "No allure-results found."
+  cd -
+}
+
 cd "$(dirname "$0")/.."
+generate_allure_report detox
+generate_allure_report detox/test
 pack artifacts "detox/test/artifacts" "detoxtest"
 pack artifacts "examples/demo-react-native/artifacts" "rnexample"
 pack artifacts "examples/demo-react-native-jest/artifacts" "rnexamplejest"


Test patch:
diff --git a/.github/workflows/rapid-test.yml b/.github/workflows/rapid-test.yml
index c5b26f83a..ba75fd129 100644
--- a/.github/workflows/rapid-test.yml
+++ b/.github/workflows/rapid-test.yml
@@ -3,58 +3,67 @@ name: Rapid Test
 on:
   push:
     branches: [master]
-    paths-ignore:
-      - '.github/workflows/docs.yml'
-      - '.markdownlintrc'
-      - '.remarkignore'
-      - '.remarkrc.mjs'
-      - '.retext-spell.dic'
-      - 'docs/**'
-      - '**.md'
+    paths:
+        - '.github/workflows/rapid-test.yml'
+        - 'detox/**'
+        - 'generation/**'
   pull_request:
     branches: [master]
-    paths-ignore:
-      - '.github/workflows/docs.yml'
-      - '.markdownlintrc'
-      - '.remarkignore'
-      - '.remarkrc.mjs'
-      - '.retext-spell.dic'
-      - 'docs/**'
-      - '**.md'
+    paths:
+        - '.github/workflows/rapid-test.yml'
+        - 'detox/**'
+        - 'generation/**'
 
 jobs:
 
-  js:
-    name: JS & TS
-    strategy:
-      matrix:
-        os: [ubuntu-latest, windows-latest]
-        node: [14]
-    runs-on: ${{ matrix.os }}
+  linux:
+    name: Linux
+    runs-on: ubuntu-latest
     steps:
-      - uses: actions/checkout@v2
-      - uses: actions/setup-node@v2
+      - uses: actions/checkout@v3
+      - uses: actions/setup-node@v3
         with:
-          node-version: ${{ matrix.node }}
+          node-version: 14
       - name: Bootstrap Lerna
         run: npx lerna bootstrap --no-ci
         env:
           DETOX_DISABLE_POD_INSTALL: true
           DETOX_DISABLE_POSTINSTALL: true
-      - name: Lint
+      - name: Lint source project
         run: npm run lint
         working-directory: detox
+      - name: Lint test project
+        run: npm run lint
+        working-directory: detox/test
       - name: Typings
         run: npm test
         working-directory: detox/test
-      - name: Unit tests (Linux)
-        if: matrix.os == 'ubuntu-latest'
+      - name: Unit tests
         run: npm run unit
         working-directory: detox
-      - name: Unit tests (Windows)
-        if: matrix.os == 'windows-latest'
-        run: npm run unit -- --coverageThreshold "{}"
-        working-directory: detox
       - name: Integration tests
         run: npm run integration
         working-directory: detox/test
+      - name: Generation tests
+        run: npm test
+        working-directory: generation
+
+  windows:
+      name: Windows
+      runs-on: windows-latest
+      steps:
+          - uses: actions/checkout@v3
+          - uses: actions/setup-node@v3
+            with:
+                node-version: 14
+          - name: Bootstrap Lerna (Light)
+            run: npx lerna bootstrap --no-ci --include-dependents --include-dependencies --scope=detox-test
+            env:
+                DETOX_DISABLE_POD_INSTALL: true
+                DETOX_DISABLE_POSTINSTALL: true
+          - name: Unit tests
+            run: npm run unit -- --coverageThreshold "{}"
+            working-directory: detox
+          - name: Integration tests
+            run: npm run integration
+            working-directory: detox/test
diff --git a/detox/test/.eslintignore b/detox/test/.eslintignore
index 94e09c392..9eb4976c6 100644
--- a/detox/test/.eslintignore
+++ b/detox/test/.eslintignore
@@ -1,3 +1,5 @@
+allure-report
+artifacts
 coverage
 ios
 android