From b151a8f5735255a8299dfdf3af7138a0c26f14bc Mon Sep 17 00:00:00 2001 From: Monte Thakkar Date: Wed, 6 Sep 2017 18:03:09 -0700 Subject: [PATCH 1/2] Update Guide.RunningOnCI to include Bitrise --- docs/Guide.RunningOnCI.md | 98 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 96 insertions(+), 2 deletions(-) diff --git a/docs/Guide.RunningOnCI.md b/docs/Guide.RunningOnCI.md index 4abffb1cc0..930f440260 100644 --- a/docs/Guide.RunningOnCI.md +++ b/docs/Guide.RunningOnCI.md @@ -1,4 +1,4 @@ -# Running Tests on CI (like Travis) +# Running Tests on CI (Travis or Bitrise) > When your test suite is finally ready, it should be set up to run automatically on your CI server on every git push. This will alert you if new changes to the app break existing functionality. @@ -44,7 +44,9 @@ detox test --configuration ios.sim.release --cleanup
-## Appendix: Running Detox on Travis-CI +## Appendix + +### • Running Detox on [Travis CI](https://travis-ci.org/) Detox's own build is running on Travis, check out Detox's [.travis.yml](/.travis.yml) file to see how it's done. @@ -80,3 +82,95 @@ script: - detox test --configuration ios.sim.release --cleanup ``` + +### • Running Detox on [Bitrise](https://www.bitrise.io/) + +Bitrise is a popular CI service for automating React Native apps. If you are looking to get started with Bitrise, check out [this](http://blog.bitrise.io/2017/07/25/how-to-set-up-a-react-native-app-on-bitrise.html) guide. + +You can run Detox on Bitrise by adding a `tests` workflow. Here's what the Bitrise **.yml** file looks like for doing so: + +```yml +--- +format_version: 1.1.0 +default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git +workflows: + _tests_setup: + steps: + - activate-ssh-key: {} + - git-clone: + inputs: + - clone_depth: '' + - script@1.1.4: + inputs: + - content: |- + #!/bin/bash + npm cache verify + npm install + title: Install Packages + before_run: + after_run: + _detox_tests: + before_run: [] + after_run: [] + steps: + - npm: + inputs: + - command: install -g detox-cli + title: Install Detox CLI + - npm@0.9.0: + inputs: + - command: install -g react-native-cli + title: Install React Native CLI + - script: + inputs: + - content: |- + #!/bin/bash + brew tap facebook/fb + export CODE_SIGNING_REQUIRED=NO + brew install fbsimctl + brew tap wix/brew + brew install applesimutils --HEAD + title: Install Detox Utils + - script@1.1.4: + title: Start Packager in Background + inputs: + - content: |- + #!/bin/bash + npm run start & + - script: + inputs: + - content: |- + #!/bin/bash + detox build --configuration ios.sim.release + title: Build Detox app + - script: + inputs: + - content: |- + #!/bin/bash + detox test --configuration ios.sim.release + - is_debug: 'yes' + title: Run Detox Integration Tests + tests: + before_run: + - _tests_setup + - _detox_tests + steps: + - slack@2.6.2: + inputs: + - webhook_url: ##SLACK_WEBHOOK_URL + - channel: "#builds" + - from_username_on_error: Bitrise CI - Tests Shall Not Pass!! + - from_username: Bitrise CI - Integration & Unit Tests Passing + - message: |- + *Build succeeded*: $BITRISE_GIT_MESSAGE + *Branch*: $BITRISE_GIT_BRANCH + + Fuck it! Ship it! + - message_on_error: |- + *Build failed*: $BITRISE_GIT_MESSAGE + *Branch*: $BITRISE_GIT_BRANCH + + _I believe in you!! Please try again._ + - emoji: ":shipit:" + - emoji_on_error: ":bug:" +``` From 55775c7abafa7d76feca03556408ce776f5b6435 Mon Sep 17 00:00:00 2001 From: Monte Thakkar Date: Thu, 7 Sep 2017 11:39:54 -0700 Subject: [PATCH 2/2] addressing PR comments --- docs/Guide.RunningOnCI.md | 57 +++++++++++++++------------------------ 1 file changed, 22 insertions(+), 35 deletions(-) diff --git a/docs/Guide.RunningOnCI.md b/docs/Guide.RunningOnCI.md index 930f440260..ab15e7b9be 100644 --- a/docs/Guide.RunningOnCI.md +++ b/docs/Guide.RunningOnCI.md @@ -87,12 +87,17 @@ script: Bitrise is a popular CI service for automating React Native apps. If you are looking to get started with Bitrise, check out [this](http://blog.bitrise.io/2017/07/25/how-to-set-up-a-react-native-app-on-bitrise.html) guide. -You can run Detox on Bitrise by adding a `tests` workflow. Here's what the Bitrise **.yml** file looks like for doing so: +You can run Detox on Bitrise by creating a new workflow. Below is an example of the Bitrise **.yml** file for a workflow called `tests`. + +Additionally, you can use a [webhook](http://devcenter.bitrise.io/webhooks/) on Bitrise to post the build status directly into your Slack channel. ```yml --- format_version: 1.1.0 default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git +trigger_map: +- push_branch: "*" + workflow: tests workflows: _tests_setup: steps: @@ -100,15 +105,18 @@ workflows: - git-clone: inputs: - clone_depth: '' - - script@1.1.4: + title: Git Clone Repo + - script: inputs: - content: |- #!/bin/bash + npm cache verify + npm install - title: Install Packages - before_run: - after_run: + title: Install NPM Packages + before_run: + after_run: _detox_tests: before_run: [] after_run: [] @@ -117,7 +125,7 @@ workflows: inputs: - command: install -g detox-cli title: Install Detox CLI - - npm@0.9.0: + - npm: inputs: - command: install -g react-native-cli title: Install React Native CLI @@ -125,52 +133,31 @@ workflows: inputs: - content: |- #!/bin/bash + brew tap facebook/fb export CODE_SIGNING_REQUIRED=NO brew install fbsimctl + brew tap wix/brew brew install applesimutils --HEAD title: Install Detox Utils - - script@1.1.4: - title: Start Packager in Background - inputs: - - content: |- - #!/bin/bash - npm run start & - script: inputs: - content: |- #!/bin/bash + detox build --configuration ios.sim.release - title: Build Detox app + title: Detox - Build Release App - script: inputs: - content: |- #!/bin/bash - detox test --configuration ios.sim.release - - is_debug: 'yes' - title: Run Detox Integration Tests + + detox test --configuration ios.sim.release --cleanup + title: Detox - Run E2E Tests tests: before_run: - _tests_setup - _detox_tests - steps: - - slack@2.6.2: - inputs: - - webhook_url: ##SLACK_WEBHOOK_URL - - channel: "#builds" - - from_username_on_error: Bitrise CI - Tests Shall Not Pass!! - - from_username: Bitrise CI - Integration & Unit Tests Passing - - message: |- - *Build succeeded*: $BITRISE_GIT_MESSAGE - *Branch*: $BITRISE_GIT_BRANCH - - Fuck it! Ship it! - - message_on_error: |- - *Build failed*: $BITRISE_GIT_MESSAGE - *Branch*: $BITRISE_GIT_BRANCH - - _I believe in you!! Please try again._ - - emoji: ":shipit:" - - emoji_on_error: ":bug:" + after_run: [] ```