-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #266 from crossroads/master
#December2018Release1
- Loading branch information
Showing
12 changed files
with
137 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,28 +7,28 @@ aliases: | |
- image: circleci/node:carbon | ||
working_directory: ~/code | ||
- &restore-repo-cache | ||
key: admin-goodcity-repo-{{ .Environment.CIRCLE_SHA1 }} | ||
key: v1-admin-goodcity-repo-{{ .Environment.CIRCLE_SHA1 }} | ||
- &restore-yarn-cache | ||
keys: | ||
- admin-goodcity-yarn-packages-{{ checksum "yarn.lock" }} | ||
- v1-admin-goodcity-yarn-packages-{{ checksum "yarn.lock" }} | ||
- &save-yarn-cache | ||
key: admin-goodcity-yarn-packages-{{ checksum "yarn.lock" }} | ||
key: v1-admin-goodcity-yarn-packages-{{ checksum "yarn.lock" }} | ||
paths: | ||
- node_modules | ||
- ~/.cache/yarn | ||
- &yarn | ||
| | ||
yarn install --non-interactive --cache-folder ~/.cache/yarn --frozen-lockfile | ||
- &restore-bower-cache | ||
key: admin-goodcity-bower-components-{{ checksum "bower.json" }} | ||
key: v1-admin-goodcity-bower-components-{{ checksum "bower.json" }} | ||
- &save-bower-cache | ||
key: admin-goodcity-bower-components-{{ checksum "bower.json" }} | ||
key: v1-admin-goodcity-bower-components-{{ checksum "bower.json" }} | ||
paths: | ||
- bower_components | ||
- &restore-bundler-cache | ||
key: admin-goodcity-bundle-{{ checksum "Gemfile.lock" }} | ||
key: v1-admin-goodcity-bundle-{{ checksum "Gemfile.lock" }} | ||
- &save-bundler-cache | ||
key: admin-goodcity-bundle-{{ checksum "Gemfile.lock" }} | ||
key: v1-admin-goodcity-bundle-{{ checksum "Gemfile.lock" }} | ||
paths: | ||
- vendor/bundle | ||
|
||
|
@@ -38,7 +38,7 @@ jobs: | |
steps: | ||
- checkout | ||
- save_cache: | ||
key: admin-goodcity-repo-{{ .Environment.CIRCLE_SHA1 }} | ||
key: v1-admin-goodcity-repo-{{ .Environment.CIRCLE_SHA1 }} | ||
paths: | ||
- ~/code | ||
|
||
|
@@ -55,6 +55,8 @@ jobs: | |
|
||
tests: | ||
<<: *defaults | ||
docker: | ||
- image: circleci/node:8-browsers | ||
environment: | ||
JOBS: 1 | ||
steps: | ||
|
@@ -120,17 +122,30 @@ jobs: | |
- restore-cache: *restore-bundler-cache | ||
- run: bundle check --path=vendor/bundle || bundle install --deployment --jobs=4 --retry=3 | ||
- save-cache: *save-bundler-cache | ||
- run: | ||
name: Setup Environment variables | ||
command: | | ||
echo 'export ASSET_HOST_URL=$(if [ "$CIRCLE_BRANCH" == "live" ]; then echo "https://admin.goodcity.hk/assets"; else echo "https://admin-staging.goodcity.hk/assets"; fi)' >> $BASH_ENV | ||
echo 'export APP_VERSION=$(jq -r ".version" package.json)' >> $BASH_ENV | ||
- attach_workspace: | ||
at: ~/code | ||
- run: mv dist-www/ dist | ||
- run: | ||
name: Get source map url with grep | ||
command: echo 'export SOURCE_MAP_WITH_VARIABLE_NAME=$(grep sourceMappingURL dist/assets/goodcity-*.js)' >> $BASH_ENV | ||
- run: echo $SOURCE_MAP_WITH_VARIABLE_NAME | ||
- run: | ||
name: Remove unnecessary characters form source map | ||
command: echo 'export SOURCE_MAP=$(eval echo $SOURCE_MAP_WITH_VARIABLE_NAME | cut -c22-100)' >> $BASH_ENV | ||
- run: echo $SOURCE_MAP | ||
- run: | ||
name: Setup Environment | ||
command: echo 'export ENVIRONMENT=$(if [ "$CIRCLE_BRANCH" == "live" ]; then echo production; else echo staging; fi)' >> $BASH_ENV | ||
- run: bundle exec cap $ENVIRONMENT deploy:upload | ||
- run: | ||
name: Upload Source Map to Rollbar | ||
command: | | ||
curl https://api.rollbar.com/api/1/sourcemap/download -F access_token="${ROLLBAR_ACCESS_TOKEN}" -F version="${APP_VERSION}" -F minified_url=https://admin-staging.goodcity.hk/assets/goodcity.js | ||
curl https://api.rollbar.com/api/1/sourcemap/download -F access_token="${ROLLBAR_KEY}" -F version="${APP_VERSION}" -F minified_url=$ASSET_HOST_URL/$SOURCE_MAP | ||
ember_cordova_build: | ||
|
@@ -237,10 +252,10 @@ jobs: | |
name: Setup Environment variables | ||
command: | | ||
echo 'export PATH=$PATH:`yarn bin`' >> $BASH_ENV | ||
echo 'export ENVIRONMENT=$(if [ "$CIRCLE_BRANCH" == "live" ]; then echo production; else echo staging; fi)' >> $BASH_ENV | ||
echo 'export PROVISIONING_PROFILE=$(if [ "$CIRCLE_BRANCH" == "live" ]; then echo $PROD_PROVISIONING_PROFILE; else echo $STAGING_PROVISIONING_PROFILE; fi)' >> $BASH_ENV | ||
echo 'export CERTIFICATE=$(if [ "$CIRCLE_BRANCH" == "live" ]; then echo $PROD_CERT; else echo $STAGING_CERT; fi)' >> $BASH_ENV | ||
echo 'export STAGING=$(if [ "$CIRCLE_BRANCH" == "live" ]; then echo false; else echo true; fi)' >> $BASH_ENV | ||
echo 'export ENVIRONMENT=$(if [ "$CIRCLE_BRANCH" == "live" ]; then echo production; else echo staging; fi)' >> $BASH_ENV | ||
echo 'export PROVISIONING_PROFILE=$(if [ "$CIRCLE_BRANCH" == "live" ]; then echo 'GoodCity_Admin.mobileprovision'; else echo 'GoodCity_Admin_Staging.mobileprovision'; fi)' >> $BASH_ENV | ||
echo 'export CERTIFICATE=$(if [ "$CIRCLE_BRANCH" == "live" ]; then echo 'Goodcity_2019.p12'; else echo 'GoodCity_2018_Development.p12'; fi)' >> $BASH_ENV | ||
- run: | ||
command: | | ||
npm rebuild node-sass | ||
|
@@ -270,13 +285,13 @@ jobs: | |
working_directory: ~/code | ||
- run: pod setup | ||
- run: | ||
name: install cordova-update-config globally | ||
name: Install cordova-update-config globally | ||
command: npm i -g cordova-update-config | ||
- run: | ||
name: install cordova globally | ||
name: Install cordova globally | ||
command: npm i -g [email protected] | ||
- run: | ||
name: create keychain and import certificates | ||
name: Create keychain and import p12 certificate | ||
command: bundle exec fastlane ios prepare_certificates cert:$CERTIFICATE | ||
working_directory: ~/code | ||
- run: | ||
|
@@ -286,7 +301,7 @@ jobs: | |
- store_artifacts: | ||
path: cordova/platforms/ios/build/device | ||
- run: | ||
name: release ios build | ||
name: Release ios build | ||
command: bundle exec fastlane ios ${ENVIRONMENT} | ||
working_directory: ~/code | ||
|
||
|
@@ -334,9 +349,9 @@ workflows: | |
filters: | ||
branches: | ||
only: /^(master|live)$/ | ||
# - ios_build_and_deploy: | ||
# requires: | ||
# - ember_cordova_build | ||
# filters: | ||
# branches: | ||
# only: /^(master|live)$/ | ||
- ios_build_and_deploy: | ||
requires: | ||
- tests | ||
filters: | ||
branches: | ||
only: live |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -228,7 +228,8 @@ DEPENDENCIES | |
credentials_manager | ||
fastlane | ||
nokogiri | ||
plist | ||
rake | ||
|
||
BUNDLED WITH | ||
1.16.0 | ||
1.16.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,7 @@ | |
require "json" | ||
require "fileutils" | ||
require "rake/clean" | ||
require 'plist' | ||
|
||
ROOT_PATH = File.dirname(__FILE__) | ||
CORDOVA_PATH = "#{ROOT_PATH}/cordova" | ||
|
@@ -46,17 +47,6 @@ TESTFAIRY_PLUGIN_NAME = "com.testfairy.cordova-plugin" | |
SPLUNKMINT_PLUGIN_URL = "https://github.com/crossroads/cordova-plugin-splunkmint.git" | ||
KEYSTORE_FILE = "#{CORDOVA_PATH}/goodcity.keystore" | ||
BUILD_JSON_FILE = "#{CORDOVA_PATH}/build.json" | ||
IOS_SIGNING_STYLE = false | ||
IOS_DEBUGMODE_BUILDCONF = { | ||
code_signing: "\'iPhone Developer\'", | ||
package_type: 'development', | ||
icloud_container_environment: 'Development' | ||
}.freeze | ||
IOS_RELEASEMODE_BUILDCONF = { | ||
code_signing: "\'iPhone Distribution\'", | ||
package_type: 'app-store', | ||
icloud_container_environment: 'Production' | ||
}.freeze | ||
|
||
# Default task | ||
task default: %w(app:build) | ||
|
@@ -109,6 +99,12 @@ namespace :cordova do | |
desc "Cordova build {platform}" | ||
task build: :prepare do | ||
Dir.chdir(CORDOVA_PATH) do | ||
#Temporary fix for phonegap-plugin-push | ||
if platform == 'android' | ||
sh %{ cordova plugin add [email protected] } | ||
else | ||
sh %{ cordova plugin add [email protected] --variable SENDER_ID="XXXXXXX" } | ||
end | ||
build = (environment == "staging" && platform == 'android') ? "debug" : "release" | ||
extra_params = (platform === "android") ? '' : ios_build_config | ||
system({"ENVIRONMENT" => environment}, "cordova compile #{platform} --#{build} --device #{extra_params}") | ||
|
@@ -244,23 +240,45 @@ def app_version | |
end | ||
end | ||
|
||
def ios_build_config | ||
signing_style = IOS_SIGNING_STYLE | ||
team_id = ENV['IOS_DEVELOPMENT_TEAM_ID'] | ||
def mobile_provisioning_file | ||
prefix = ['~', 'Library', 'MobileDevice', 'Provisioning\ Profiles'] | ||
file = if production_env? | ||
"GoodCity_Admin.mobileprovision" | ||
else | ||
"GoodCity_Admin_Staging.mobileprovision" | ||
end | ||
File.join(prefix, file) | ||
end | ||
|
||
if(environment === 'production') | ||
provisioning_profile = ENV['PROVISIONING_PROFILE_ADMIN_PROD'] | ||
code_signing = IOS_RELEASEMODE_BUILDCONF[:code_signing] | ||
package_type = IOS_RELEASEMODE_BUILDCONF[:package_type] | ||
icloud_container_environment = IOS_RELEASEMODE_BUILDCONF[:icloud_container_environment] | ||
def mobile_provisioning_plist | ||
@mobile_provisioning_plist ||= begin | ||
profile = `openssl smime -inform der -verify -noverify -in #{mobile_provisioning_file}` | ||
Plist.parse_xml(profile) | ||
end | ||
end | ||
|
||
def ios_build_config | ||
opts = {} | ||
opts["developmentTeam"] = mobile_provisioning_plist["TeamIdentifier"].first | ||
opts["automaticProvisionin"] = false | ||
opts["provisioningProfile"] = mobile_provisioning_plist["UUID"] | ||
if production_env? | ||
opts["codeSignIdentity"] = "\'iPhone Distribution\'" | ||
opts["packageType"] = "app-store" | ||
opts["icloud_container_environment"] = "Production" | ||
else | ||
provisioning_profile = ENV['PROVISIONING_PROFILE_ADMIN_STAGING'] | ||
code_signing = IOS_DEBUGMODE_BUILDCONF[:code_signing] | ||
package_type = IOS_DEBUGMODE_BUILDCONF[:package_type] | ||
icloud_container_environment = IOS_DEBUGMODE_BUILDCONF[:icloud_container_environment] | ||
opts["codeSignIdentity"] = "\'iPhone Developer\'" | ||
opts["packageType"] = 'development' | ||
opts["icloud_container_environment"] = "Development" | ||
end | ||
opts.map do |key, value| | ||
"--#{key}=#{value}" | ||
end.join(" ") | ||
#" --codeSignIdentity=#{code_signing} --developmentTeam=#{team_id} --packageType=#{package_type} --provisioningProfile=\'#{provisioning_profile}\' --automaticProvisionin=#{signing_style} --icloud_container_environment=#{icloud_container_environment}" | ||
end | ||
|
||
" --codeSignIdentity=#{code_signing} --developmentTeam=#{team_id} --packageType=#{package_type} --provisioningProfile=\'#{provisioning_profile}\' --automaticProvisionin=#{signing_style} --icloud_container_environment=#{icloud_container_environment}" | ||
def production_env? | ||
environment == 'production' | ||
end | ||
|
||
def testfairy_upload_script | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.