Browse Source

try fix travis by recording and uploading video

Daniel Zlotin 6 years ago
parent
commit
459cb003d9
3 changed files with 38 additions and 22 deletions
  1. 17
    17
      .travis.yml
  2. 3
    3
      package.json
  3. 18
    2
      scripts/test.e2e.ios.js

+ 17
- 17
.travis.yml View File

12
     #   script:
12
     #   script:
13
     #     - ./scripts/travis-fold.sh "npm run test-js"
13
     #     - ./scripts/travis-fold.sh "npm run test-js"
14
 
14
 
15
-    # - stage: test
16
-    #   env: TYPE=iOS
17
-    #   os: osx
18
-    #   osx_image: xcode9
19
-    #   language: objective-c
20
-    #   before_install:
21
-    #     - source ./scripts/env/env.ios.sh
22
-    #   script:
23
-    #     - ./scripts/travis-fold.sh "npm run test-unit-ios -- --release"
24
-    #     - ./scripts/travis-fold.sh "npm run test-e2e-ios -- --release"
15
+    - stage: test
16
+      env: TYPE=iOS
17
+      os: osx
18
+      osx_image: xcode9
19
+      language: objective-c
20
+      before_install:
21
+        - source ./scripts/env/env.ios.sh
22
+      script:
23
+        - ./scripts/travis-fold.sh "npm run test-unit-ios -- --release"
24
+        - ./scripts/travis-fold.sh "npm run test-e2e-ios -- --release"
25
 
25
 
26
     # - stage: test
26
     # - stage: test
27
     #   env: TYPE=Android
27
     #   env: TYPE=Android
43
     #       - $HOME/.gradle/wrapper/
43
     #       - $HOME/.gradle/wrapper/
44
     #       - $HOME/.android/build-cache
44
     #       - $HOME/.android/build-cache
45
 
45
 
46
-    - stage: deploy
47
-      if: NOT type = pull_request
48
-      env: TYPE=deploy
49
-      os: linux
50
-      language: generic
51
-      script:
52
-          - ./scripts/travis-fold.sh "npm run release"
46
+    # - stage: deploy
47
+    #   if: NOT type = pull_request
48
+    #   env: TYPE=deploy
49
+    #   os: linux
50
+    #   language: generic
51
+    #   script:
52
+    #       - ./scripts/travis-fold.sh "npm run release"
53
 
53
 
54
 branches:
54
 branches:
55
   only:
55
   only:

+ 3
- 3
package.json View File

1
 {
1
 {
2
   "name": "fix-travis-react-native-navigation",
2
   "name": "fix-travis-react-native-navigation",
3
-  "version": "0.0.1",
3
+  "version": "0.0.2",
4
   "description": "React Native Navigation - truly native navigation for iOS and Android",
4
   "description": "React Native Navigation - truly native navigation for iOS and Android",
5
   "license": "MIT",
5
   "license": "MIT",
6
   "nativePackage": true,
6
   "nativePackage": true,
111
         "binaryPath": "playground/ios/DerivedData/playground/Build/Products/Debug-iphonesimulator/playground.app",
111
         "binaryPath": "playground/ios/DerivedData/playground/Build/Products/Debug-iphonesimulator/playground.app",
112
         "build": "RCT_NO_LAUNCH_PACKAGER=true xcodebuild build -scheme playground -project playground/ios/playground.xcodeproj -sdk iphonesimulator -configuration Debug -derivedDataPath playground/ios/DerivedData/playground ONLY_ACTIVE_ARCH=YES -quiet",
112
         "build": "RCT_NO_LAUNCH_PACKAGER=true xcodebuild build -scheme playground -project playground/ios/playground.xcodeproj -sdk iphonesimulator -configuration Debug -derivedDataPath playground/ios/DerivedData/playground ONLY_ACTIVE_ARCH=YES -quiet",
113
         "type": "ios.simulator",
113
         "type": "ios.simulator",
114
-        "name": "iPhone 7"
114
+        "name": "iPhone SE"
115
       },
115
       },
116
       "ios.sim.release": {
116
       "ios.sim.release": {
117
         "binaryPath": "playground/ios/DerivedData/playground/Build/Products/Release-iphonesimulator/playground.app",
117
         "binaryPath": "playground/ios/DerivedData/playground/Build/Products/Release-iphonesimulator/playground.app",
118
         "build": "RCT_NO_LAUNCH_PACKAGER=true xcodebuild build -scheme playground_release -project playground/ios/playground.xcodeproj -sdk iphonesimulator -configuration Release -derivedDataPath playground/ios/DerivedData/playground ONLY_ACTIVE_ARCH=YES -quiet",
118
         "build": "RCT_NO_LAUNCH_PACKAGER=true xcodebuild build -scheme playground_release -project playground/ios/playground.xcodeproj -sdk iphonesimulator -configuration Release -derivedDataPath playground/ios/DerivedData/playground ONLY_ACTIVE_ARCH=YES -quiet",
119
         "type": "ios.simulator",
119
         "type": "ios.simulator",
120
-        "name": "iPhone 7"
120
+        "name": "iPhone SE"
121
       }
121
       }
122
     }
122
     }
123
   },
123
   },

+ 18
- 2
scripts/test.e2e.ios.js View File

6
 run();
6
 run();
7
 
7
 
8
 function run() {
8
 function run() {
9
-  const conf = release ? `release` : `debug`;
10
-  exec.execSync(`detox build --configuration ios.sim.${conf} && detox test --configuration ios.sim.${conf} ${process.env.CI ? '--cleanup' : ''}`);
9
+  try {
10
+    startRecording();
11
+    const conf = release ? `release` : `debug`;
12
+    exec.execSync(`detox build --configuration ios.sim.${conf} && detox test --configuration ios.sim.${conf} ${process.env.CI ? '--cleanup' : ''}`);
13
+  } catch (err) {
14
+    stopRecording();
15
+  }
11
 }
16
 }
12
 
17
 
18
+function startRecording() {
19
+  const json = JSON.parse(exec.execSyncRead(`applesimutils --list --byName "iPhone SE"`));
20
+  const deviceId = json[0].udid;
21
+  exec.execAsync(`xcrun simctl bootstatus ${deviceId} && xcrun simctl io booted recordVideo --type=mp4 video.mp4`);
22
+}
23
+
24
+function stopRecording() {
25
+  const pid = exec.execSyncRead(`pgrep simctl`);
26
+  exec.execSync(`kill -sigint ${pid}`);
27
+  exec.execSync(`npm run release`);
28
+}