Skip to content

Commit

Permalink
Circle CI and sample in repo (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
vegaro authored Jan 10, 2019
1 parent dd8f11c commit 4b1864f
Show file tree
Hide file tree
Showing 71 changed files with 9,399 additions and 344 deletions.
211 changes: 62 additions & 149 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,155 +1,68 @@
version: 2
jobs:
node:
working_directory: ~/react-native-purchases
docker:
- image: circleci/node:8
steps:
- checkout

- restore_cache:
key: yarn-v1-{{ checksum "yarn.lock" }}-{{ arch }}

- restore_cache:
key: node-v1-{{ checksum "package.json" }}-{{ arch }}

- run: yarn install

- save_cache:
key: yarn-v1-{{ checksum "yarn.lock" }}-{{ arch }}
paths:
- ~/.cache/yarn

- save_cache:
key: node-v1-{{ checksum "package.json" }}-{{ arch }}
paths:
- node_modules

- run:
name: jest tests
command: |
mkdir -p test-results/jest
yarn run test
environment:
JEST_JUNIT_OUTPUT: test-results/jest/junit.xml

- persist_to_workspace:
root: ~/demo-react-native
paths:
- node_modules

- store_test_results:
path: test-results

- store_artifacts:
path: test-results

android:
working_directory: ~/react-native-purchases/android
docker:
- image: circleci/android:api-27-node8-alpha
steps:
- checkout:
path: ~/react-native-purchases

- attach_workspace:
at: ~/react-native-purchases

- restore_cache:
key: bundle-v1-{{ checksum "Gemfile.lock" }}-{{ arch }}

- run: bundle install

- save_cache:
key: bundle-v1-{{ checksum "Gemfile.lock" }}-{{ arch }}
paths:
- vendor/bundle

- run:
name: fastlane tests
command: |
mkdir -p test-results/fastlane
bundle exec fastlane test
mv fastlane/report.xml test-results/fastlane
- store_test_results:
path: test-results

- store_artifacts:
path: test-results

ios:
macos:
xcode: "9.0"
working_directory: ~/react-native-purchases

# use a --login shell so our "set Ruby version" command gets picked up for later steps
shell: /bin/bash --login -o pipefail

steps:
- checkout

- run:
name: set Ruby version
command: echo "ruby-2.4" > ~/.ruby-version

- restore_cache:
key: yarn-v1-{{ checksum "yarn.lock" }}-{{ arch }}

- restore_cache:
key: node-v1-{{ checksum "package.json" }}-{{ arch }}

# not using a workspace here as Node and Yarn versions
# differ between our macOS executor image and the Docker containers above
- run: yarn install

- save_cache:
key: yarn-v1-{{ checksum "yarn.lock" }}-{{ arch }}
paths:
- ~/.cache/yarn

- save_cache:
key: node-v1-{{ checksum "package.json" }}-{{ arch }}
paths:
- node_modules

- restore_cache:
key: bundle-v1-{{ checksum "ios/Gemfile.lock" }}-{{ arch }}

- run:
command: bundle install
working_directory: ios

- save_cache:
key: bundle-v1-{{ checksum "ios/Gemfile.lock" }}-{{ arch }}
paths:
- vendor/bundle

- run:
command: bundle exec fastlane test
working_directory: ios

- run:
name: set up test results
working_directory: ios
when: always
command: |
mkdir -p test-results/fastlane test-results/xcode
mv fastlane/report.xml test-results/fastlane
mv fastlane/test_output/report.junit test-results/xcode/junit.xml
- store_test_results:
path: ios/test-results

- store_artifacts:
path: ios/test-results

setup:
working_directory: ~/react-native-purchases
docker:
- image: circleci/node:8
steps:
- checkout
- run: yarn run setup
android:
working_directory: ~/react-native-purchases
docker:
- image: circleci/android:api-27-node8-alpha
steps:
- checkout
- run:
name: yarn run setup
command: yarn run setup
- run:
name: Android compiles
command: ./gradlew build
working_directory: example/android
ios:
macos:
xcode: "9.0"
working_directory: ~/react-native-purchases
# use a --login shell so our "set Ruby version" command gets picked up for later steps
shell: /bin/bash --login -o pipefail
steps:
- checkout
- run:
name: set Ruby version
command: echo "ruby-2.4" > ~/.ruby-version
- run: yarn run setup
- restore_cache:
key: bundle-v1-{{ checksum "example/ios/Gemfile.lock" }}-{{ arch }}
- run:
command: bundle install
working_directory: example/ios

- save_cache:
key: bundle-v1-{{ checksum "example/ios/Gemfile.lock" }}-{{ arch }}
paths:
- vendor/bundle

- run:
command: bundle exec fastlane scan --scheme ReactNativeSample
working_directory: example/ios

- run:
name: set up test results
working_directory: example/ios
when: always
command: |
mkdir -p test-results/fastlane test-results/xcode
mv fastlane/report.xml test-results/fastlane
mv fastlane/test_output/report.junit test-results/xcode/junit.xml
- store_test_results:
path: example/ios/test-results

- store_artifacts:
path: example/ios/test-results
workflows:
version: 2
node-android-ios:
jobs:
- node
- android:
requires:
- node
- ios:
requires:
- node
- android
- ios
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
example
8 changes: 5 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
buildscript {
repositories {
google()
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.android.tools.build:gradle:3.1.4'
}
}

apply plugin: 'com.android.library'

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
compileSdkVersion 28
buildToolsVersion "28.0.3"

defaultConfig {
minSdkVersion 16
Expand All @@ -23,6 +24,7 @@ android {
}

repositories {
google()
mavenCentral()
jcenter()
}
Expand Down
2 changes: 0 additions & 2 deletions android/fastlane/Appfile

This file was deleted.

3 changes: 3 additions & 0 deletions example/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["module:metro-react-native-babel-preset"]
}
6 changes: 6 additions & 0 deletions example/.buckconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

[android]
target = Google Inc.:Google APIs:23

[maven_repositories]
central = https://repo1.maven.org/maven2
70 changes: 70 additions & 0 deletions example/.flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
[ignore]
; We fork some components by platform
.*/*[.]android.js

; Ignore "BUCK" generated dirs
<PROJECT_ROOT>/\.buckd/

; Ignore unexpected extra "@providesModule"
.*/node_modules/.*/node_modules/fbjs/.*

; Ignore duplicate module providers
; For RN Apps installed via npm, "Libraries" folder is inside
; "node_modules/react-native" but in the source repo it is in the root
.*/Libraries/react-native/React.js

; Ignore polyfills
.*/Libraries/polyfills/.*

; Ignore metro
.*/node_modules/metro/.*

[include]

[libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js
node_modules/react-native/flow/
node_modules/react-native/flow-github/

[options]
emoji=true

esproposal.optional_chaining=enable
esproposal.nullish_coalescing=enable

module.system=haste
module.system.haste.use_name_reducers=true
# get basename
module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1'
# strip .js or .js.flow suffix
module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1'
# strip .ios suffix
module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1'
module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
module.system.haste.paths.blacklist=.*/__tests__/.*
module.system.haste.paths.blacklist=.*/__mocks__/.*
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*

munge_underscores=true

module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'

module.file_ext=.js
module.file_ext=.jsx
module.file_ext=.json
module.file_ext=.native.js

suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FlowFixMeProps
suppress_type=$FlowFixMeState

suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError

[version]
^0.78.0
1 change: 1 addition & 0 deletions example/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.pbxproj -text
57 changes: 57 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# OSX
#
.DS_Store

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace

# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml

# node.js
#
node_modules/
npm-debug.log
yarn-error.log

# BUCK
buck-out/
\.buckd/
*.keystore

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/

*/fastlane/report.xml
*/fastlane/Preview.html
*/fastlane/screenshots

# Bundle artifact
*.jsbundle
ios/Pods
Loading

0 comments on commit 4b1864f

Please sign in to comment.