Skip to content

Commit 80e114c

Browse files
troZeePiotr Trocki
andcommitted
chore: configure release-it (#201)
Co-authored-by: Piotr Trocki <[email protected]>
1 parent 4a843fe commit 80e114c

File tree

5 files changed

+3105
-2539
lines changed

5 files changed

+3105
-2539
lines changed

.circleci/config.yml

Lines changed: 32 additions & 166 deletions
Original file line numberDiff line numberDiff line change
@@ -1,183 +1,49 @@
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
1+
# Orb support is from version >= 2.1
2+
version: 2.1
83

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"
4+
# Make sure you use the latest version of the Orb!
5+
orbs:
6+
rn: react-native-community/[email protected]
167

17-
# ANDROID
18-
android_defaults: &android_defaults
19-
<<: *defaults
20-
docker:
21-
- image: circleci/android:api-27-node8-alpha
22-
environment:
23-
- TERM: "dumb"
24-
- ADB_INSTALL_TIMEOUT: 10
25-
- _JAVA_OPTIONS: "-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap"
26-
- GRADLE_OPTS: '-Dorg.gradle.daemon=false -Dorg.gradle.jvmargs="-XX:+HeapDumpOnOutOfMemoryError"'
27-
- BUILD_THREADS: 2
28-
29-
# MACOS
30-
macos_defaults: &macos_defaults
31-
<<: *defaults
32-
macos:
33-
xcode: "10.1.0"
34-
35-
# -------------------------
36-
# ALIASES
37-
# -------------------------
38-
39-
aliases:
40-
# CACHE
41-
- &restore-yarn-cache
42-
keys:
43-
- yarn-cache-{{ arch }}-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
44-
- yarn-cache-{{ arch }}
45-
- &save-yarn-cache
46-
paths:
47-
- ~/.cache/yarn
48-
- ~/Library/Detox/ios
49-
key: yarn-cache-{{ arch }}-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
50-
51-
- &restore-gradle-cache
52-
keys:
53-
- gradle-cache-{{ checksum "android/build.gradle" }}-{{ checksum "example/android/build.gradle" }}-{{ checksum "example/android/app/build.gradle" }}
54-
- &save-gradle-cache
55-
paths:
56-
- ~/.gradle
57-
key: gradle-cache-{{ checksum "android/build.gradle" }}-{{ checksum "example/android/build.gradle" }}-{{ checksum "example/android/app/build.gradle" }}
58-
59-
# INSTALLATION
60-
- &yarn
61-
name: Yarn Install
62-
command: |
63-
yarn install --network-concurrency 1 --non-interactive --cache-folder ~/.cache/yarn & wait
64-
65-
# ANALYSE
66-
- &eslint
67-
name: ESLint Checks
68-
command: yarn lint
69-
70-
- &flow
71-
name: Flow Checks
72-
command: yarn flow check
73-
74-
# - &jest
75-
# name: Jest Unit Tests
76-
# command: yarn test:jest
77-
78-
# -------------------------
79-
# JOBS
80-
# -------------------------
81-
version: 2
8+
# Custom jobs which are not part of the Orb
829
jobs:
83-
# Set up a Linux environment for downstream jobs
84-
linux-checkout:
85-
<<: *linux_defaults
10+
checkout_code:
11+
executor: rn/linux_js
8612
steps:
8713
- checkout
88-
- restore-cache: *restore-yarn-cache
89-
- run: rm -rf node_modules
90-
- run: yarn cache clean
91-
- run: *yarn
92-
- save-cache: *save-yarn-cache
9314
- persist_to_workspace:
9415
root: .
9516
paths: .
96-
97-
eslint:
98-
<<: *linux_defaults
99-
steps:
100-
- attach_workspace:
101-
at: ~/react-native-viewpager
102-
- run: *eslint
103-
104-
flow:
105-
<<: *linux_defaults
17+
analyse_js:
18+
executor: rn/linux_js
10619
steps:
10720
- attach_workspace:
108-
at: ~/react-native-viewpager
109-
- run: *flow
110-
111-
# jest:
112-
# <<: *linux_defaults
113-
# steps:
114-
# - attach_workspace:
115-
# at: ~/react-native-viewpager
116-
# - run: *jest
117-
118-
android-compile:
119-
<<: *android_defaults
120-
steps:
121-
- attach_workspace:
122-
at: ~/react-native-viewpager
123-
- restore-cache: *restore-gradle-cache
124-
- run:
125-
name: Accept Android licences
126-
command: |-
127-
yes | sdkmanager --licenses || exit 0
128-
yes | sdkmanager --update || exit 0
21+
at: .
22+
- rn/yarn_install
12923
- run:
130-
name: Build Android Example App and Library
131-
command: |-
132-
cd example/android
133-
./gradlew clean assembleDebug
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-viewpager
24+
name: Run ESLint
25+
command: yarn lint
15426
- run:
155-
name: Build example app
156-
command: |-
157-
react-native run-ios --project-path example/ios
27+
name: Flow
28+
command: yarn flow
15829

159-
# -------------------------
160-
# WORKFLOWS
161-
# -------------------------
16230
workflows:
163-
version: 2
164-
Test:
31+
test:
16532
jobs:
166-
- linux-checkout
167-
- eslint:
168-
requires:
169-
- linux-checkout
170-
- flow:
33+
# Checkout the code and persist to the Workspace
34+
# Note: This is a job which is defined above and not part of the Orb
35+
- checkout_code
36+
37+
# Analyze the Javascript using ESLint, Flow, and Jest
38+
# Note: This is a job which is defined above and not part of the Orb
39+
- analyse_js:
17140
requires:
172-
- linux-checkout
173-
# - jest:
174-
# requires:
175-
# - linux-checkout
176-
- android-compile:
41+
- checkout_code
42+
43+
# Build the Android app in debug mode
44+
- rn/android_build:
45+
name: build_android
46+
project_path: "example/android"
47+
build_type: debug
17748
requires:
178-
- linux-checkout
179-
# Disabled until we have macOS containers enabled
180-
# - ios-checkout
181-
# - ios-compile:
182-
# requires:
183-
# - ios-checkout
49+
- analyse_js

example/android/app/build.gradle

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,18 @@ dependencies {
210210
implementation jscFlavor
211211
}
212212
}
213+
task downloadDependencies() {
214+
description 'Download all dependencies to the Gradle cache'
215+
doLast {
216+
configurations.findAll().each { config ->
217+
if (config.name.contains("minReactNative") && config.canBeResolved) {
218+
print config.name
219+
print '\n'
220+
config.files
221+
}
222+
}
223+
}
224+
}
213225

214226
// Run this once to be able to run the application with BUCK
215227
// puts all compile dependencies into folder libs for BUCK to use

package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"test": "echo \"Error: no test specified\" && exit 1",
1212
"flow": "flow",
1313
"lint": "eslint .",
14-
"lint:fix": "eslint . --fix --ext .js"
14+
"lint:fix": "eslint . --fix",
15+
"release": "release-it"
1516
},
1617
"keywords": [
1718
"react-native",
@@ -26,6 +27,9 @@
2627
"type": "git",
2728
"url": "https://github.com/react-native-community/react-native-viewpager.git"
2829
},
30+
"publishConfig": {
31+
"registry": "https://registry.npmjs.org/"
32+
},
2933
"peerDependencies": {
3034
"react": "^16.0",
3135
"react-native": ">=0.57"
@@ -41,7 +45,8 @@
4145
"metro-react-native-babel-preset": "^0.58.0",
4246
"react": "16.11.0",
4347
"react-native": "0.62.2",
44-
"react-test-renderer": "16.11.0"
48+
"react-test-renderer": "16.11.0",
49+
"release-it": "^13.6.5"
4550
},
4651
"jest": {
4752
"preset": "react-native"

release-it.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"git": {
3+
"commitMessage": "chore: release v${version}",
4+
"tagName": "v${version}"
5+
},
6+
"npm": {
7+
"publish": true
8+
},
9+
"github": {
10+
"release": true,
11+
"releaseName": "v${version}"
12+
},
13+
"plugins": {
14+
"@release-it/conventional-changelog": {
15+
"preset": "angular"
16+
}
17+
}
18+
}

0 commit comments

Comments
 (0)