Skip to content

Commit 42ab6cb

Browse files
authored
chore: add CircleCI config (#3)
1 parent 6e1fc37 commit 42ab6cb

File tree

2 files changed

+187
-0
lines changed

2 files changed

+187
-0
lines changed

.circleci/config.yml

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
# -------------------------
2+
# DEFAULTS
3+
# -------------------------
4+
defaults: &defaults
5+
working_directory: ~/react-native-viewpager
6+
environment:
7+
- GIT_COMMIT_DESC: git log --format=oneline -n 1 $CIRCLE_SHA1
8+
9+
# LINUX
10+
linux_defaults: &linux_defaults
11+
<<: *defaults
12+
docker:
13+
- image: circleci/node:8
14+
environment:
15+
- PATH: "/opt/yarn/yarn-v1.5.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
16+
17+
# ANDROID
18+
android_defaults: &android_defaults
19+
<<: *defaults
20+
docker:
21+
- image: circleci/android:api-27-node8-alpha
22+
resource_class: "large"
23+
environment:
24+
- TERM: "dumb"
25+
- ADB_INSTALL_TIMEOUT: 10
26+
- _JAVA_OPTIONS: "-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap"
27+
- GRADLE_OPTS: '-Dorg.gradle.daemon=false -Dorg.gradle.jvmargs="-XX:+HeapDumpOnOutOfMemoryError"'
28+
- BUILD_THREADS: 2
29+
30+
# MACOS
31+
macos_defaults: &macos_defaults
32+
<<: *defaults
33+
resource_class: "large"
34+
macos:
35+
xcode: "10.1.0"
36+
37+
# -------------------------
38+
# ALIASES
39+
# -------------------------
40+
41+
aliases:
42+
# CACHE
43+
- &restore-yarn-cache
44+
keys:
45+
- yarn-cache-{{ arch }}-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
46+
- yarn-cache-{{ arch }}
47+
- &save-yarn-cache
48+
paths:
49+
- ~/.cache/yarn
50+
- ~/Library/Detox/ios
51+
key: yarn-cache-{{ arch }}-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
52+
53+
- &restore-gradle-cache
54+
keys:
55+
- gradle-cache-{{ checksum "android/build.gradle" }}-{{ checksum "example/android/build.gradle" }}-{{ checksum "example/android/app/build.gradle" }}
56+
- &save-gradle-cache
57+
paths:
58+
- ~/.gradle
59+
key: gradle-cache-{{ checksum "android/build.gradle" }}-{{ checksum "example/android/build.gradle" }}-{{ checksum "example/android/app/build.gradle" }}
60+
61+
# INSTALLATION
62+
- &yarn
63+
name: Yarn Install
64+
command: |
65+
yarn install --network-concurrency 1 --non-interactive --cache-folder ~/.cache/yarn & wait
66+
67+
# ANALYSE
68+
# - &eslint
69+
# name: ESLint Checks
70+
# command: yarn test:eslint
71+
72+
- &flow
73+
name: Flow Checks
74+
command: yarn flow check
75+
76+
# - &jest
77+
# name: Jest Unit Tests
78+
# command: yarn test:jest
79+
80+
# -------------------------
81+
# JOBS
82+
# -------------------------
83+
version: 2
84+
jobs:
85+
# Set up a Linux environment for downstream jobs
86+
linux-checkout:
87+
<<: *linux_defaults
88+
steps:
89+
- checkout
90+
- restore-cache: *restore-yarn-cache
91+
- run: rm -rf node_modules
92+
- run: yarn cache clean
93+
- run: *yarn
94+
- save-cache: *save-yarn-cache
95+
- persist_to_workspace:
96+
root: .
97+
paths: .
98+
99+
# eslint:
100+
# <<: *linux_defaults
101+
# steps:
102+
# - attach_workspace:
103+
# at: ~/react-native-viewpager
104+
# - run: *eslint
105+
106+
flow:
107+
<<: *linux_defaults
108+
steps:
109+
- attach_workspace:
110+
at: ~/react-native-viewpager
111+
- run: *flow
112+
113+
# jest:
114+
# <<: *linux_defaults
115+
# steps:
116+
# - attach_workspace:
117+
# at: ~/react-native-viewpager
118+
# - run: *jest
119+
120+
android-compile:
121+
<<: *android_defaults
122+
steps:
123+
- attach_workspace:
124+
at: ~/react-native-viewpager
125+
- restore-cache: *restore-gradle-cache
126+
- run:
127+
name: Accept Android licences
128+
command: |-
129+
yes | sdkmanager --licenses || exit 0
130+
yes | sdkmanager --update || exit 0
131+
- run:
132+
name: Build Android Example App and Library
133+
command: |-
134+
cd example/android
135+
./gradlew clean assembleDebug
136+
- save-cache: *save-gradle-cache
137+
138+
ios-checkout:
139+
<<: *macos_defaults
140+
steps:
141+
- checkout
142+
- restore-cache: *restore-yarn-cache
143+
- run: rm -rf node_modules
144+
- run: yarn cache clean
145+
- run: *yarn
146+
- save-cache: *save-yarn-cache
147+
- persist_to_workspace:
148+
root: .
149+
paths: .
150+
151+
ios-compile:
152+
<<: *macos_defaults
153+
steps:
154+
- attach_workspace:
155+
at: ~/react-native-viewpager
156+
- run:
157+
name: Build example app
158+
command: |-
159+
react-native run-ios --project-path example/ios
160+
161+
# -------------------------
162+
# WORKFLOWS
163+
# -------------------------
164+
workflows:
165+
version: 2
166+
Test:
167+
jobs:
168+
- linux-checkout
169+
# - eslint:
170+
# requires:
171+
# - linux-checkout
172+
- flow:
173+
requires:
174+
- linux-checkout
175+
# - jest:
176+
# requires:
177+
# - linux-checkout
178+
- android-compile:
179+
requires:
180+
- linux-checkout
181+
# Disabled until we have macOS containers enabled
182+
# - ios-checkout
183+
# - ios-compile:
184+
# requires:
185+
# - ios-checkout

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# react-native-viewpager
22

3+
[![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)
4+
35
At the moment, this module only works for Android. Under the hood is using the native Android
46
[ViewPager](https://developer.android.com/reference/android/support/v4/view/ViewPager).
57

0 commit comments

Comments
 (0)