Travis-CI 提供免费版的持续集成服务,本文以它为例子,讲一下 Macaca 如何配置持续集成。
我们直接用之前提供的例子 macaca-test-sample 配置下。
PC 的 .travis.yml
:
language: node_js
sudo: false
node_js:
- "4"
addons:
apt:
packages:
- xvfb
install:
- export DISPLAY=':99.0'
- Xvfb :99 -screen 0 1366x768x24 > /dev/null 2>&1 &
script: make travis
after_script: "npm install coveralls@2 && cat ./coverage/lcov.info | coveralls"
iOS 的 .travis.yml
:
os: osx
osx_image: xcode7.3
before_install:
- source $(brew --prefix nvm)/nvm.sh
- nvm install 4.4.3
- brew update
- brew install ios-webkit-debug-proxy
script:
- make test
Android 的 .travis.yml
:
language: android
sudo: false
addons:
apt:
packages:
- xvfb
jdk:
- openjdk7
android:
components:
- build-tools-23.0.2
- android-23
- extra-android-m2repository
- extra-android-support
before_install:
- export CHROME_BIN=chromium-browser
- export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
- export ANDROID_HOME=/usr/local/android-sdk
- echo yes | android update sdk --all --filter build-tools-23.0.2 --no-ui --force
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
before_script:
- . $HOME/.nvm/nvm.sh
- nvm install 4
- nvm use 4
- npm install
- echo no | android create avd --force -n test -t android-19 --abi armeabi-v7a
- emulator -avd test -no-audio -no-window &
- android-wait-for-emulator
- adb shell input keyevent 82 &
script: "make test"
after_script: "npm install coveralls@2 && cat ./coverage/lcov.info | coveralls"
另外,最近很多用户在讨论 React-Native 类的 Native 渲染框架的测试问题,下篇文章会分享一下。
欢迎讨论,互相学习。
微博: http://weibo.com/xudafeng
Github: https://github.com/xudafeng