浏览代码

Split to two detox setups

Jamon Holmgren 4 年前
父节点
当前提交
384d3b646d
共有 4 个文件被更改,包括 41 次插入10 次删除
  1. 3
    7
      .github/workflows/detox-android.yml
  2. 32
    0
      .github/workflows/detox-ios.yml
  3. 2
    2
      bin/detox-setup
  4. 4
    1
      package.json

.github/workflows/detox.yml → .github/workflows/detox-android.yml 查看文件

@@ -1,9 +1,9 @@
1
-name: 'Detox CI Tests'
1
+name: 'Detox CI Tests - Android'
2 2
 on: [push]
3 3
 
4 4
 jobs:
5 5
   tests:
6
-    name: 'Running tests'
6
+    name: 'Running Android detox tests'
7 7
     runs-on: 'macOS-latest'
8 8
     steps:
9 9
       - name: Setup - Install Android SDK
@@ -22,8 +22,6 @@ jobs:
22 22
         run: avdmanager create avd -n test -k "system-images;android-28;google_apis;x86"
23 23
       - name: List Android Emulators
24 24
         run: emulator -list-avds
25
-      - name: List iOS Simulators
26
-        run: xcrun simctl list
27 25
       - uses: actions/checkout@master
28 26
       - uses: actions/setup-node@master
29 27
         with:
@@ -34,8 +32,6 @@ jobs:
34 32
         run: brew install yarn --ignore-dependencies
35 33
       - name: Setup - Install NPM Dependencies
36 34
         run: yarn
37
-      - name: Setup - Install CocoaPods CLI
38
-        run: sudo gem install cocoapods
39 35
       - name: Setup - Install Detox and deps
40 36
         run: |
41 37
           brew tap wix/brew
@@ -43,4 +39,4 @@ jobs:
43 39
           yarn global add react-native-cli
44 40
           yarn global add detox-cli
45 41
       - name: Run tests
46
-        run: yarn ci
42
+        run: yarn ci:android

+ 32
- 0
.github/workflows/detox-ios.yml 查看文件

@@ -0,0 +1,32 @@
1
+name: 'Detox CI Tests - iOS'
2
+on: [push]
3
+
4
+jobs:
5
+  tests:
6
+    name: 'Running iOS Detox tests'
7
+    runs-on: 'macOS-latest'
8
+    steps:
9
+      - uses: actions/checkout@master
10
+      - uses: actions/setup-node@master
11
+        with:
12
+          node-version: 12.6
13
+      - name: Setup - Install Homebrew
14
+        run: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
15
+      - name: Setup - Install Yarn
16
+        run: brew install yarn --ignore-dependencies
17
+      - name: Setup - Install NPM Dependencies
18
+        run: yarn
19
+      - name: Setup - Install CocoaPods CLI
20
+        run: sudo gem install cocoapods
21
+      - name: Setup - Install Detox and deps
22
+        run: |
23
+          brew tap wix/brew
24
+          brew install applesimutils
25
+          yarn global add react-native-cli
26
+          yarn global add detox-cli
27
+      - name: List iOS Simulators
28
+        run: xcrun simctl list
29
+      - name: Prepare Example App
30
+        run: yarn ci:setup
31
+      - name: Run tests
32
+        run: yarn ci:ios

bin/detox → bin/detox-setup 查看文件

@@ -17,5 +17,5 @@ cd ios
17 17
 pod install
18 18
 cd ..
19 19
 
20
-# Run tests
21
-yarn detox
20
+# Return to root
21
+cd ../..

+ 4
- 1
package.json 查看文件

@@ -11,7 +11,10 @@
11 11
   "version": "7.0.3",
12 12
   "homepage": "https://github.com/react-native-community/react-native-webview#readme",
13 13
   "scripts": {
14
-    "ci": "CI=true && yarn lint && yarn test && ./bin/detox",
14
+    "ci": "CI=true && yarn lint && yarn test",
15
+    "ci:setup": "./bin/detox-setup",
16
+    "ci:ios": "CI=true && cd examples/WebTest && yarn detox-ios && cd -",
17
+    "ci:android": "CI=true && cd examples/WebTest && yarn detox-android && cd -",
15 18
     "ci:publish": "yarn semantic-release",
16 19
     "lint": "yarn tsc --noEmit && yarn eslint ./src --ext .ts,.tsx",
17 20
     "build": "yarn tsc",