forked from rakutentech/ios-miniapp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
100 lines (93 loc) · 3.12 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
language: swift
xcode_workspace: MiniApp.xcworkspace
xcode_scheme: Tests
osx_image: xcode12.2
os: osx
cache:
- bundler
before_install:
# update necessary pods only instead of running `pod repo update`
# https://github.com/travis-ci/travis-ci/issues/6473
- pod outdated | awk '{ if ( $1 ~ /^-/ ) { print $0 } }' | awk '{ if ( $3 != $5 ) { pod update $2 } else { print "No updated needed it for" $2 } }'
# First check if this is a build from master or a release and setup ENV variables
- |
if [[ "$TRAVIS_PULL_REQUEST" == "false" && "$TRAVIS_BRANCH" == "master" ]]; then
export IS_MASTER=true
elif [[ "$TRAVIS_PULL_REQUEST" == "false" && "$TRAVIS_TAG" == "v"* ]]; then
export IS_RELEASE=true;
fi
if [[ $IS_RELEASE ]]; then
export RAS_APPLICATION_IDENTIFIER=$RAS_APPLICATION_IDENTIFIER_PROD
export RAS_PROJECT_SUBSCRIPTION_KEY=$RAS_PROJECT_SUBSCRIPTION_KEY_PROD
export RMA_API_ENDPOINT=$RMA_API_ENDPOINT_PROD
elif [[ $IS_MASTER ]]; then
export RAS_APPLICATION_IDENTIFIER=$RAS_APPLICATION_IDENTIFIER_STG
export RAS_PROJECT_SUBSCRIPTION_KEY=$RAS_PROJECT_SUBSCRIPTION_KEY_STG
export RMA_API_ENDPOINT=$RMA_API_ENDPOINT_STG
fi
script:
- travis_wait bundle exec fastlane ci
- travis_wait bundle exec fastlane build_simulator
- bundle exec danger
after_success:
- bash <(curl -s https://codecov.io/bash) -J '^MiniApp$' -X gcov
# Upload code coverage
- bundle exec jazzy
--xcodebuild-arguments -scheme,Tests
--module MiniApp
--source-directory MiniApp
--podspec MiniApp.podspec
--theme fullwidth
--readme USERGUIDE.md
# Deploy Simulator build to App Center when merged to master (this script doesn't work from the `deploy` section)
# Deploys to STG group if merging to master or deploys to prod group if this is a release
- |
set -e
zip -r artifacts/miniapp.app.zip artifacts/MiniApp_Example.app/*
npm install -g appcenter-cli
if [[ $IS_RELEASE ]]; then
appcenter distribute release \
--token $APP_CENTER_TOKEN \
--app $APP_CENTER_APP_NAME \
--group $APP_CENTER_GROUP_PROD \
--build-version $TRAVIS_TAG \
--file ./artifacts/miniapp.app.zip \
--quiet
elif [[ $IS_MASTER ]]; then
appcenter distribute release \
--token $APP_CENTER_TOKEN \
--app $APP_CENTER_APP_NAME \
--group $APP_CENTER_GROUP \
--build-version $TRAVIS_BUILD_NUMBER \
--file ./artifacts/miniapp.app.zip \
--quiet
fi
# Merge master into prod branch to trigger production build on App Center
- |
if [[ $IS_RELEASE ]]; then
set -e
git remote add github https://${GITHUB_TOKEN}@github.com/rakutentech/ios-miniapp.git
git fetch github $TRAVIS_TAG:prod
git push github prod --force
fi
# Deploy Pod spec when tagged as release
- |
if [[ $IS_RELEASE ]]; then
set -e
pod spec lint --allow-warnings
pod trunk push --allow-warnings
fi
deploy:
# Deploy Docs to Github Pages when tagged as release
provider: pages
skip_cleanup: true
github_token: $GITHUB_TOKEN
keep_history: true
local_dir: docs
on:
tags: true
condition: $TRAVIS_TAG =~ ^v
notifications:
slack:
rooms:
secure: $SLACK_TOKEN