Skip to content

Instantly share code, notes, and snippets.

@taras
Created June 10, 2019 16:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taras/cd923834a41e9bba4161d1f8c0d014ea to your computer and use it in GitHub Desktop.
Save taras/cd923834a41e9bba4161d1f8c0d014ea to your computer and use it in GitHub Desktop.
version: 2.1
executors:
ios:
macos:
xcode: "10.1.0"
environment:
NS_SKIP_ENV_CHECK: "true"
android:
docker:
- image: cowboyd/nativescript-fastlane
environment:
_JAVA_OPTIONS: -Xmx1g
commands:
yarn:
steps:
- restore_cache:
name: "Restore Yarn cache"
key: yarn-cache-v3-{{ arch }}-{{ checksum "yarn.lock" }}
- run:
name: "yarn install"
command: yarn install --pure-lockfile
- save_cache:
name: "Save Yarn cache"
key: yarn-cache-v3-{{ arch }}-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
- node_modules
- hooks
bundler:
steps:
- restore_cache:
name: "Restore Bundler cache"
key: gem-cache-v1-{{ arch }}-{{ checksum "Gemfile.lock" }}
- run:
name: "bundle install"
command: bundle install --path "bundler/gems"
- save_cache:
name: "Save Bundler cache"
key: gem-cache-v1-{{ arch }}-{{ checksum "Gemfile.lock" }}
paths:
- ~/.bundle
- bundler/gems
attach_current_workspace:
steps:
- attach_workspace:
at: "."
install_nativescript_settings:
steps:
- run:
name: "Install NativeScript project settings"
command: |
mkdir -p ~/.local/share/.nativescript-cli
cp user-settings.json ~/.local/share/.nativescript-cli
jobs:
eslint:
executor: android
steps:
- checkout
- yarn
- run:
name: "Lint JavaScript"
command:
yarn lint
--max-warnings=0
--format junit
--output-file ./artifacts/eslint/eslint.xml
- store_test_results:
path: ./artifacts
- store_artifacts:
path: ./artifacts
ios-build-for-test:
executor: ios
steps:
- checkout
- yarn
- bundler
- install_nativescript_settings
- run:
name: "iOS Test Build"
command: yarn tns build ios
- run:
name: "Create test ipa"
command: zip -r app.test.ipa ./platforms/ios/build/Debug-iphonesimulator/project.app
- persist_to_workspace:
root: "."
paths:
- ./platforms/ios
- ./app.test.ipa
- store_artifacts:
path: ./app.test.ipa
ios-test:
executor: ios
parameters:
device:
description: "Device and iOS version spec"
type: string
steps:
- run:
name: "Pre-launch iOS Simulator"
command: xcrun instruments -w "<< parameters.device >>" || true
background: true
- checkout
- yarn
- bundler
- install_nativescript_settings
- attach_current_workspace
- run:
name: "Wait for iOS Simulator"
command: xcrun instruments -w "<< parameters.device >>" || true
- run: yarn test ios --justlaunch
ios-beta:
executor: ios
steps:
- checkout
- yarn
- bundler
- install_nativescript_settings
- run: bundle exec fastlane ios setup_ci
- run: yarn ios:pkg:release
- store_artifacts:
path: ./app.release.ipa
- run: bundle exec fastlane ios upload_beta
ios-upload-demo:
executor: ios
steps:
- checkout
- bundler
- attach_current_workspace
- run: bundle exec fastlane ios upload_to_appetize path:./app.test.ipa
- persist_to_workspace:
root: "."
paths:
- ./IOS_DEMO_URL
android-build-for-test:
executor: android
steps:
- checkout
- yarn
- bundler
- install_nativescript_settings
- run: yarn tns build android --copy-to ./app.test.apk
- persist_to_workspace:
root: "."
paths:
- ./platforms/android
- ./app.test.apk
- store_artifacts:
path: ./app.test.apk
android-test:
executor: android
parameters:
version:
description: "Version of Android against which to test"
type: string
steps:
- checkout
- yarn
- bundler
- install_nativescript_settings
- attach_current_workspace
android-beta:
executor: android
steps:
- checkout
- yarn
- bundler
- install_nativescript_settings
- run: bundle exec fastlane android setup_ci
- run: yarn android:pkg:release
- store_artifacts:
path: ./app.release.aab
- run: bundle exec fastlane android upload_alpha
android-upload-demo:
executor: android
steps:
- checkout
- bundler
- attach_current_workspace
- run: bundle exec fastlane android upload_to_appetize path:./app.test.apk
- persist_to_workspace:
root: "."
paths:
- ./ANDROID_DEMO_URL
danger:
executor: android
steps:
- checkout
- bundler
- attach_current_workspace
- run: bundle exec danger
workflows:
build:
jobs:
- eslint:
name: "ESLint"
- ios-build-for-test:
name: "iOS Test Build"
- ios-test:
name: "iOS Test 10"
device: "iPhone 7 (10.3.1) ["
requires:
- "iOS Test Build"
- ios-test:
name: "iOS Test 11"
device: "iPhone 7 (11.2) ["
requires:
- "iOS Test Build"
- ios-test:
name: "iOS Test 12"
device: "iPhone 7 (12.1) ["
requires:
- "iOS Test Build"
- ios-beta:
name: "iOS Beta"
requires:
- "iOS Test 10"
- "iOS Test 11"
- "iOS Test 12"
filters:
branches:
only: master
- ios-upload-demo:
name: "iOS Upload Demo"
requires:
- "iOS Test Build"
filters:
branches:
ignore: master
- android-build-for-test:
name: "Android Test Build"
- android-test:
name: "Android Test 7"
version: "7"
requires:
- "Android Test Build"
- android-test:
name: "Android Test 8"
version: "8"
requires:
- "Android Test Build"
- android-test:
name: "Android Test 9"
version: "9"
requires:
- "Android Test Build"
- android-beta:
name: "Android Beta"
requires:
- "Android Test 7"
- "Android Test 8"
- "Android Test 9"
filters:
branches:
only: master
- android-upload-demo:
name: "Android Upload Demo"
requires:
- "Android Test Build"
filters:
branches:
ignore: master
- danger:
name: "Post PR comment"
requires:
- "iOS Upload Demo"
- "Android Upload Demo"
filters:
branches:
ignore: master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment