Skip to content

Commit f6703b1

Browse files
authored
feat: setup circleCI (#13)
feat: setup circleCI
2 parents d8ab60e + ed8baf8 commit f6703b1

File tree

5 files changed

+203
-10
lines changed

5 files changed

+203
-10
lines changed

.circleci/config.yml

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
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: |-
134+
cd example
135+
yarn install
136+
cd android
137+
./gradlew clean assembleDebug
138+
- save-cache: *save-gradle-cache
139+
140+
ios-checkout:
141+
<<: *macos_defaults
142+
steps:
143+
- checkout
144+
- restore-cache: *restore-yarn-cache
145+
- run: rm -rf node_modules
146+
- run: yarn cache clean
147+
- run: *yarn
148+
- save-cache: *save-yarn-cache
149+
- persist_to_workspace:
150+
root: .
151+
paths: .
152+
153+
ios-compile:
154+
<<: *macos_defaults
155+
steps:
156+
- attach_workspace:
157+
at: ~/react-native-progress-bar-android
158+
- run:
159+
name: Build example app
160+
command: |-
161+
react-native run-ios --project-path example/ios
162+
163+
# -------------------------
164+
# WORKFLOWS
165+
# -------------------------
166+
workflows:
167+
version: 2
168+
Test:
169+
jobs:
170+
- linux-checkout
171+
- eslint:
172+
requires:
173+
- linux-checkout
174+
# TODO: uncomment when files are written in typescript
175+
# - type-check:
176+
# requires:
177+
# - linux-checkout
178+
# TODO: uncomment after tests are fixed
179+
# - jest:
180+
# requires:
181+
# - linux-checkout
182+
- android-compile:
183+
requires:
184+
- linux-checkout
185+
# Disabled until we have macOS containers enabled
186+
# - ios-checkout
187+
# - ios-compile:
188+
# requires:
189+
# - ios-checkout

example/android/app/build.gradle

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,6 @@ android {
142142
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
143143
}
144144
}
145-
signingConfigs {
146-
debug {
147-
storeFile file('debug.keystore')
148-
storePassword 'android'
149-
keyAlias 'androiddebugkey'
150-
keyPassword 'android'
151-
}
152-
}
153145
buildTypes {
154146
debug {
155147
signingConfig signingConfigs.debug

example/android/app/keystores/BUCK

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
keystore(
2+
name = "debug",
3+
properties = "debug.keystore.properties",
4+
store = "debug.keystore",
5+
visibility = [
6+
"PUBLIC",
7+
],
8+
)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
key.store=debug.keystore
2+
key.alias=androiddebugkey
3+
key.store.password=android
4+
key.alias.password=android

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)