Skip to content

Instantly share code, notes, and snippets.

@tsainte
Last active December 5, 2018 09:45
Show Gist options
  • Save tsainte/ac7e45884f28cb9e265e4bb888e45bf3 to your computer and use it in GitHub Desktop.
Save tsainte/ac7e45884f28cb9e265e4bb888e45bf3 to your computer and use it in GitHub Desktop.
This is a bootstrap for helping create a pipeline for react native and Jenkins
###################### Jenkins Bootstrap ######################
# This script will configure your brand new macOS to support Jenkins running react native projects.
# If you need help to configure dependencies on a React Native proejct, check this script:
# https://gist.github.com/tsainte/8e2aab30e81bf54a2523fa552a37932c
# It works on my machine - macOS Mojave
###################### SSH ######################
# Configure Jenkins machine to be access via SSH
echo "Enable ssh remote access"
sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist
###################### Homebrew ######################
# https://brew.sh/
# Package manager for macOS - it's like apt-get for Debian
echo "Install Homebrew"
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
###################### Node utilities ######################
# NPM: packager manager for javascript (https://www.npmjs.com/)
# Watchman: Watch files - it's the reload machine for react-native (https://facebook.github.io/watchman/)
echo "Install brew packages"
brew install npm
brew install watchman
###################### Tools ######################
# Atom: it's a text editor (https://atom.io/)
# VSCode: it's another text editor (https://code.visualstudio.com/)
echo "Instal brew casks - a.k.a. utilities"
brew cask install atom
brew cask install visual-studio-code
###################### Android ######################
# Android studio: it's the main IDE for Android native development
# Android platform: installs the SDK, emulator and other tools
# We need to accept the sdkmanager licenses - If you are not comfortable with, you can remove the 'yes'
echo "Android"
brew cask install android-studio
brew cask install android-platform-tools
yes | ~/Library/Android/sdk/tools/bin/sdkmanager --licenses
###################### iOS ######################
# To install the iOS SDK, we need Xcode - The recommended way is to download via Mac App Store
# Once downloaded, make sure the selected one on command line is Xcode.app, as we will use xcodebuild under the hood
echo "There's no cask for Xcode - install it via Mac App Store app"
sudo xcode-select -s /Applications/Xcode.app
###################### NPM Packages ######################
# Appium: Test automation framework (http://appium.io/)
# react-native-cli: Shell for accessing the CLI embedded on each React Native project (https://facebook.github.io/react-native/docs/understanding-cli)
echo "Install global npm packages"
npm install -g appium
npm install -g react-native-cli
###################### Ruby ######################
# To use with Fastlane, Coocoapods and eventual gem dependencies
# RVM is a ruby version manager - at this time the most recent stable one is ruby 2.5.1
# Install Bundler as ruby package manager per application
echo "Install ruby version control"
curl -L https://get.rvm.io | bash -s stable --autolibs=enabled --ruby
echo "Install ruby package manager"
gem install bundler
###################### Jenkins ######################
# Java 8 is a dependency for Jenkins
# After install Jenkins, make sure you change HttpListen from 127.0.0.1 to 0.0.0.0
# on ~/Library/LaunchAgents/homebrew.mxcl.jenkins.plist
# Complete instalation at <your local ip>:8080
echo "Install Jenkins"
brew cask install homebrew/cask-versions/java8
brew install jenkins
###################### Optional steps ######################
echo "Create AVD - alternatively, you can create via Android Studio"
# 1. List system images
~/Library/Android/sdk/tools/bin/sdkmanager --list
# 2. Install/create one of the system images
~/Library/Android/sdk/tools/bin/sdkmanager "system-images;android-28;google_apis;x86_64"
@tsainte
Copy link
Author

tsainte commented Dec 5, 2018

What about Fastlane? Well, I'd recommend install fastlane via bundler, so you would ensure to always use the correct version for each project according to your .gemfile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment