Skip to content

Commit

Permalink
chore: add CircleCI config (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
ferrannp authored Feb 12, 2019
1 parent 6e1fc37 commit 42ab6cb
Show file tree
Hide file tree
Showing 2 changed files with 187 additions and 0 deletions.
185 changes: 185 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
# -------------------------
# DEFAULTS
# -------------------------
defaults: &defaults
working_directory: ~/react-native-viewpager
environment:
- GIT_COMMIT_DESC: git log --format=oneline -n 1 $CIRCLE_SHA1

# LINUX
linux_defaults: &linux_defaults
<<: *defaults
docker:
- image: circleci/node:8
environment:
- PATH: "/opt/yarn/yarn-v1.5.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

# ANDROID
android_defaults: &android_defaults
<<: *defaults
docker:
- image: circleci/android:api-27-node8-alpha
resource_class: "large"
environment:
- TERM: "dumb"
- ADB_INSTALL_TIMEOUT: 10
- _JAVA_OPTIONS: "-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap"
- GRADLE_OPTS: '-Dorg.gradle.daemon=false -Dorg.gradle.jvmargs="-XX:+HeapDumpOnOutOfMemoryError"'
- BUILD_THREADS: 2

# MACOS
macos_defaults: &macos_defaults
<<: *defaults
resource_class: "large"
macos:
xcode: "10.1.0"

# -------------------------
# ALIASES
# -------------------------

aliases:
# CACHE
- &restore-yarn-cache
keys:
- yarn-cache-{{ arch }}-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
- yarn-cache-{{ arch }}
- &save-yarn-cache
paths:
- ~/.cache/yarn
- ~/Library/Detox/ios
key: yarn-cache-{{ arch }}-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}

- &restore-gradle-cache
keys:
- gradle-cache-{{ checksum "android/build.gradle" }}-{{ checksum "example/android/build.gradle" }}-{{ checksum "example/android/app/build.gradle" }}
- &save-gradle-cache
paths:
- ~/.gradle
key: gradle-cache-{{ checksum "android/build.gradle" }}-{{ checksum "example/android/build.gradle" }}-{{ checksum "example/android/app/build.gradle" }}

# INSTALLATION
- &yarn
name: Yarn Install
command: |
yarn install --network-concurrency 1 --non-interactive --cache-folder ~/.cache/yarn & wait
# ANALYSE
# - &eslint
# name: ESLint Checks
# command: yarn test:eslint

- &flow
name: Flow Checks
command: yarn flow check

# - &jest
# name: Jest Unit Tests
# command: yarn test:jest

# -------------------------
# JOBS
# -------------------------
version: 2
jobs:
# Set up a Linux environment for downstream jobs
linux-checkout:
<<: *linux_defaults
steps:
- checkout
- restore-cache: *restore-yarn-cache
- run: rm -rf node_modules
- run: yarn cache clean
- run: *yarn
- save-cache: *save-yarn-cache
- persist_to_workspace:
root: .
paths: .

# eslint:
# <<: *linux_defaults
# steps:
# - attach_workspace:
# at: ~/react-native-viewpager
# - run: *eslint

flow:
<<: *linux_defaults
steps:
- attach_workspace:
at: ~/react-native-viewpager
- run: *flow

# jest:
# <<: *linux_defaults
# steps:
# - attach_workspace:
# at: ~/react-native-viewpager
# - run: *jest

android-compile:
<<: *android_defaults
steps:
- attach_workspace:
at: ~/react-native-viewpager
- restore-cache: *restore-gradle-cache
- run:
name: Accept Android licences
command: |-
yes | sdkmanager --licenses || exit 0
yes | sdkmanager --update || exit 0
- run:
name: Build Android Example App and Library
command: |-
cd example/android
./gradlew clean assembleDebug
- save-cache: *save-gradle-cache

ios-checkout:
<<: *macos_defaults
steps:
- checkout
- restore-cache: *restore-yarn-cache
- run: rm -rf node_modules
- run: yarn cache clean
- run: *yarn
- save-cache: *save-yarn-cache
- persist_to_workspace:
root: .
paths: .

ios-compile:
<<: *macos_defaults
steps:
- attach_workspace:
at: ~/react-native-viewpager
- run:
name: Build example app
command: |-
react-native run-ios --project-path example/ios
# -------------------------
# WORKFLOWS
# -------------------------
workflows:
version: 2
Test:
jobs:
- linux-checkout
# - eslint:
# requires:
# - linux-checkout
- flow:
requires:
- linux-checkout
# - jest:
# requires:
# - linux-checkout
- android-compile:
requires:
- linux-checkout
# Disabled until we have macOS containers enabled
# - ios-checkout
# - ios-compile:
# requires:
# - ios-checkout
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# react-native-viewpager

[![CircleCI branch](https://img.shields.io/circleci/project/github/react-native-community/react-native-viewpager/master.svg)](https://circleci.com/gh/react-native-community/react-native-viewpager/tree/master)

At the moment, this module only works for Android. Under the hood is using the native Android
[ViewPager](https://developer.android.com/reference/android/support/v4/view/ViewPager).

Expand Down

0 comments on commit 42ab6cb

Please sign in to comment.