-
Notifications
You must be signed in to change notification settings - Fork 232
Expand file tree
/
Copy pathbootstrap.sh
More file actions
executable file
·138 lines (120 loc) · 5.49 KB
/
Copy pathbootstrap.sh
File metadata and controls
executable file
·138 lines (120 loc) · 5.49 KB
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#!/usr/bin/env bash
# shellcheck source=/dev/null
# Usage: ./bootstrap.sh
# This script will:
# - install SwiftLint, SwiftFormat, SwiftGen
# - link git hooks
# - install allure dependencies if `INSTALL_ALLURE` environment variable is provided
# - install sonar-scanner if `INSTALL_SONAR` environment variable is provided
# If you get `zsh: permission denied: ./bootstrap.sh` error, please run `chmod +x bootstrap.sh` first
function puts {
echo
echo -e "👉 ${1}"
}
# Set bash to Strict Mode (http://redsymbol.net/articles/unofficial-bash-strict-mode/)
set -Eeuo pipefail
trap "echo ; echo ❌ The Bootstrap script failed to finish without error. See the log above to debug. ; echo" ERR
source ./Githubfile
if [ "${GITHUB_ACTIONS:-}" != "true" ]; then
puts "Set up git hooks"
bundle install
bundle exec lefthook install
fi
if [ "${SKIP_SWIFT_BOOTSTRAP:-}" != true ]; then
puts "Install SwiftLint v${SWIFT_LINT_VERSION}"
DOWNLOAD_URL="https://github.com/realm/SwiftLint/releases/download/${SWIFT_LINT_VERSION}/SwiftLint.pkg"
DOWNLOAD_PATH="/tmp/SwiftLint-${SWIFT_LINT_VERSION}.pkg"
wget "$DOWNLOAD_URL" -O "$DOWNLOAD_PATH"
sudo installer -pkg "$DOWNLOAD_PATH" -target /
swiftlint version
puts "Install SwiftFormat v${SWIFT_FORMAT_VERSION}"
DOWNLOAD_URL="https://github.com/nicklockwood/SwiftFormat/releases/download/${SWIFT_FORMAT_VERSION}/swiftformat.zip"
DOWNLOAD_PATH="/tmp/swiftformat-${SWIFT_FORMAT_VERSION}.zip"
BIN_PATH="/usr/local/bin/swiftformat"
brew uninstall swiftformat || true
wget "$DOWNLOAD_URL" -O "$DOWNLOAD_PATH"
unzip -o "$DOWNLOAD_PATH" -d /tmp/swiftformat-${SWIFT_FORMAT_VERSION}
sudo mv /tmp/swiftformat-${SWIFT_FORMAT_VERSION}/swiftformat "$BIN_PATH"
sudo chmod +x "$BIN_PATH"
swiftformat --version
puts "Install SwiftGen v${SWIFT_GEN_VERSION}"
DOWNLOAD_URL="https://github.com/SwiftGen/SwiftGen/releases/download/${SWIFT_GEN_VERSION}/swiftgen-${SWIFT_GEN_VERSION}.zip"
DOWNLOAD_PATH="/tmp/swiftgen-${SWIFT_GEN_VERSION}.zip"
INSTALL_DIR="/usr/local/lib/swiftgen"
BIN_PATH="/usr/local/bin/swiftgen"
wget "$DOWNLOAD_URL" -O "$DOWNLOAD_PATH"
sudo rm -rf "$INSTALL_DIR"
sudo mkdir -p "$INSTALL_DIR"
sudo unzip -o "$DOWNLOAD_PATH" -d "$INSTALL_DIR"
sudo sudo rm -f "$BIN_PATH"
sudo sudo ln -s "$INSTALL_DIR/bin/swiftgen" "$BIN_PATH"
swiftgen --version
puts "Install Sourcery v${SOURCERY_VERSION}"
DOWNLOAD_URL="https://github.com/krzysztofzablocki/Sourcery/releases/download/${SOURCERY_VERSION}/sourcery-${SOURCERY_VERSION}.zip"
DOWNLOAD_PATH="/tmp/sourcery-${SOURCERY_VERSION}.zip"
INSTALL_DIR="/usr/local/lib/sourcery"
BIN_PATH="/usr/local/bin/sourcery"
wget "$DOWNLOAD_URL" -O "$DOWNLOAD_PATH"
sudo rm -rf "$INSTALL_DIR"
sudo mkdir -p "$INSTALL_DIR"
sudo unzip -o "$DOWNLOAD_PATH" -d "$INSTALL_DIR"
sudo rm -f "$BIN_PATH"
sudo ln -s "$INSTALL_DIR/bin/sourcery" "$BIN_PATH"
sourcery --version
fi
if [[ ${INSTALL_SONAR-default} == true ]]; then
puts "Install sonar scanner v${SONAR_VERSION}"
DOWNLOAD_URL="https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_VERSION}-macosx-x64.zip"
wget "${DOWNLOAD_URL}" -O ./fastlane/sonar.zip
cd fastlane
unzip sonar.zip
rm sonar.zip
cd ..
mv "fastlane/sonar-scanner-${SONAR_VERSION}-macosx-x64/" fastlane/sonar/
chmod +x ./fastlane/sonar/bin/sonar-scanner
fi
# Copy internal Xcode scheme to the right folder for
puts "Adding DemoApp-StreamDevelopers.xcscheme to the Xcode project"
cp Scripts/DemoApp-StreamDevelopers.xcscheme StreamChat.xcodeproj/xcshareddata/xcschemes/DemoApp-StreamDevelopers.xcscheme
if [[ ${INSTALL_ALLURE-default} == true ]]; then
puts "Install allurectl v${ALLURECTL_VERSION}"
DOWNLOAD_URL="https://github.com/allure-framework/allurectl/releases/download/${ALLURECTL_VERSION}/allurectl_darwin_amd64"
wget "${DOWNLOAD_URL}" -O ./fastlane/allurectl
chmod +x ./fastlane/allurectl
puts "Install xcresults v${XCRESULTS_VERSION}"
DOWNLOAD_URL="https://github.com/eroshenkoam/xcresults/releases/download/${XCRESULTS_VERSION}/xcresults"
wget "${DOWNLOAD_URL}" -O ./fastlane/xcresults
chmod +x ./fastlane/xcresults
fi
if [[ ${INSTALL_YEETD-default} == true ]]; then
PACKAGE="yeetd-normal.pkg"
puts "Install yeetd v${YEETD_VERSION}"
wget "https://github.com/biscuitehh/yeetd/releases/download/${YEETD_VERSION}/${PACKAGE}" -O "${PACKAGE}"
sudo installer -pkg ${PACKAGE} -target /
puts "Running yeetd daemon"
yeetd &
fi
if [[ ${INSTALL_GCLOUD-default} == true ]]; then
puts "Install gcloud"
brew install --cask google-cloud-sdk
# Editor access required: https://console.cloud.google.com/iam-admin/iam
printf "%s" "$GOOGLE_APPLICATION_CREDENTIALS" > ./fastlane/gcloud-service-account-key.json
gcloud auth activate-service-account --key-file="./fastlane/gcloud-service-account-key.json"
gcloud config set project stream-chat-swift
gcloud services enable toolresults.googleapis.com
fi
if [[ ${INSTALL_IPSW-default} == true ]]; then
puts "Install ipsw v${IPSW_VERSION}"
FILE="ipsw_${IPSW_VERSION}_macOS_universal.tar.gz"
wget "https://github.com/blacktop/ipsw/releases/download/v${IPSW_VERSION}/${FILE}" -O "${FILE}"
tar -xzf "$FILE"
chmod +x ipsw
sudo mv ipsw /usr/local/bin/
fi
if [[ ${INSTALL_INTERFACE_ANALYZER-default} == true ]]; then
puts "Install interface-analyser v${INTERFACE_ANALYZER_VERSION}"
FILE="interface-analyser"
wget "https://github.com/GetStream/stream-module-interface-analyser/releases/download/v${INTERFACE_ANALYZER_VERSION}/${FILE}" -O "${FILE}"
chmod +x ${FILE}
sudo mv ${FILE} /usr/local/bin/
fi