Skip to content

Commit f1bf62a

Browse files
committed
feat: setup circleCI
1 parent 87bda71 commit f1bf62a

File tree

2 files changed

+185
-2
lines changed

2 files changed

+185
-2
lines changed

.circleci/config.yml

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
# -------------------------
2+
# DEFAULTS
3+
# -------------------------
4+
defaults: &defaults
5+
working_directory: ~/react-native-progress-bar-android
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: "medium"
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: "medium"
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 lint
71+
72+
- &type-check
73+
name: TypeScript Checks
74+
command: yarn test:type-check
75+
76+
- &jest
77+
name: Jest Unit Tests
78+
command: yarn test
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-progress-bar-android
104+
- run: *eslint
105+
106+
# type-check:
107+
# <<: *linux_defaults
108+
# steps:
109+
# - attach_workspace:
110+
# at: ~/react-native-progress-bar-android
111+
# - run: *type-check
112+
113+
jest:
114+
<<: *linux_defaults
115+
steps:
116+
- attach_workspace:
117+
at: ~/react-native-progress-bar-android
118+
- run: *jest
119+
120+
android-compile:
121+
<<: *android_defaults
122+
steps:
123+
- attach_workspace:
124+
at: ~/react-native-progress-bar-android
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: yarn build:android
134+
- save-cache: *save-gradle-cache
135+
136+
# ios-checkout:
137+
# <<: *macos_defaults
138+
# steps:
139+
# - checkout
140+
# - restore-cache: *restore-yarn-cache
141+
# - run: rm -rf node_modules
142+
# - run: yarn cache clean
143+
# - run: *yarn
144+
# - save-cache: *save-yarn-cache
145+
# - persist_to_workspace:
146+
# root: .
147+
# paths: .
148+
149+
# ios-compile:
150+
# <<: *macos_defaults
151+
# steps:
152+
# - attach_workspace:
153+
# at: ~/react-native-progress-bar-android
154+
# - run:
155+
# name: Build example app
156+
# command: |-
157+
# react-native run-ios --project-path example/ios
158+
159+
# -------------------------
160+
# WORKFLOWS
161+
# -------------------------
162+
workflows:
163+
version: 2
164+
Test:
165+
jobs:
166+
- linux-checkout
167+
- eslint:
168+
requires:
169+
- linux-checkout
170+
# - type-check:
171+
# requires:
172+
# - linux-checkout
173+
- jest:
174+
requires:
175+
- linux-checkout
176+
- android-compile:
177+
requires:
178+
- linux-checkout
179+
# Disabled until we have macOS containers enabled
180+
# - ios-checkout
181+
# - ios-compile:
182+
# requires:
183+
# - ios-checkout

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
"scripts": {
77
"start": "node node_modules/react-native/local-cli/cli.js start",
88
"start:android": "adb shell am start -n com.androidprogressbar/.MainActivity",
9-
"build:android": "cd example/android && ./gradlew installDebug && cd ../.. && npm run start:android",
9+
"build:android": "cd example/android && ./gradlew clean assembleDebug",
1010
"test": "jest",
11-
"validate:eslint": "eslint 'js/**/*.js' && eslint 'example/**/*.js'"
11+
"lint": "eslint 'js/**/*.js' && eslint 'example/**/*.js'"
1212
},
1313
"keywords": [
1414
"react-native",

0 commit comments

Comments
 (0)