-
Notifications
You must be signed in to change notification settings - Fork 21
/
before_install.sh
executable file
·111 lines (93 loc) · 3.98 KB
/
before_install.sh
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
#!/usr/bin/env bash
# NAME
# before_install.sh - Prepare the environment.
#
# SYNOPSIS
# before_install.sh
#
# DESCRIPTION
# Configures the CI environment, installs ORCA, and prepares the SUT.
cd "$(dirname "$0")" || exit; source _includes.sh
# The remaining before_install commands should only be run on CI.
[[ "$CI" ]] || exit 0
# Display the Google Chrome version.
#google-chrome-stable --version
# Display the Yarn version.
yarn --version
# Disable Xdebug except on code coverage jobs.
if [[ ! "$ORCA_ANY_COVERAGE_IS_ENABLED" == TRUE ]]; then
if [[ "$GITHUB_ACTIONS" ]]; then
# phpdismod would be simpler but flaky
# @see https://github.com/shivammathur/setup-php/issues/350#issuecomment-735370872
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
pecl_file="$scan_dir"/99-pecl.ini
sudo sed -Ei "/xdebug/d" "${ini_file:?}"
sudo sed -Ei "/xdebug/d" "${pecl_file:?}"
sudo rm -rf "$scan_dir"/*xdebug*
fi
fi
if [[ "$JENKINS_HOME" ]]; then
LINUX_VERSION_STRING="$( cat /etc/os-release )"
echo "$LINUX_VERSION_STRING"
if echo "$LINUX_VERSION_STRING" | grep -q "alpine"
then
echo "This is Alpine Linux, ChromeDriver installation not required."
else
echo "Installing chromedriver."
# Install ChromeDriver.
# @see https://chromedriver.chromium.org/downloads/version-selection
# @see https://groups.google.com/g/chromedriver-users/c/clpipqvOGjE/m/5NxzS_SRAgAJ
# Get Google Chrome version.
CHROMEDRIVER="$( google-chrome-stable --version)"
echo "$CHROMEDRIVER"
CHROMEDRIVER_VERSION="$(echo "$CHROMEDRIVER" | awk '{print $3}')"
echo "CHROMEDRIVER_VERSION=$CHROMEDRIVER_VERSION"
# Cut off last part from google chrome version.
CHROMEDRIVER_VERSION_FAMILY="$(echo "$CHROMEDRIVER_VERSION" | awk -F'.' '{print $1,$2,$3}' OFS='.' )"
MAJOR="$(echo "$CHROMEDRIVER_VERSION_FAMILY" | awk -F'.' '{print $1}' )"
if (( $MAJOR < 115 ))
then
echo "VERSION_FAMILY=$CHROMEDRIVER_VERSION_FAMILY"
# check latest_release
VERSION=$(curl -f --silent https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROMEDRIVER_VERSION_FAMILY})
echo "FINAL_VERSION=$VERSION"
# Download driver
wget -N https://chromedriver.storage.googleapis.com/${VERSION}/chromedriver_linux64.zip -P ~/
unzip ~/chromedriver_linux64.zip -d ~/
rm ~/chromedriver_linux64.zip
mv -f ~/chromedriver /usr/local/share/
chmod +x /usr/local/share/chromedriver
ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver
else
# Download driver
wget -N https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/${CHROMEDRIVER_VERSION}/linux64/chromedriver-linux64.zip -P ~/
unzip ~/chromedriver-linux64.zip -d ~/
rm ~/chromedriver-linux64.zip
mv -f ~/chromedriver-linux64/chromedriver /usr/local/share/
chmod +x /usr/local/share/chromedriver
ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver
fi
fi
fi
# Display PHP information.
which php
php -i
# Download and install ORCA libraries if necessary. This provides compatibility
# with the old method of installing ORCA via `git clone` rather than the newer
# `composer create-project` approach.
[[ -d "$ORCA_ROOT/vendor" ]] || composer -d"$ORCA_ROOT" install
# Display ORCA version and configuration values.
orca --version
orca debug:env-vars
# Silence the "You are in 'detached HEAD' state" warning from Git.
git config --global advice.detachedHead false
# Ensure the checked out branch is named after the nearest Git version branch.
git -C "$ORCA_SUT_DIR" rev-parse --abbrev-ref HEAD
if [[ $(git -C "$ORCA_SUT_DIR" rev-parse --abbrev-ref HEAD) != "$ORCA_SUT_BRANCH" ]]; then
git -C "$ORCA_SUT_DIR" branch -f "$ORCA_SUT_BRANCH" HEAD
git -C "$ORCA_SUT_DIR" checkout "$ORCA_SUT_BRANCH"
fi
if [[ "$ORCA_JOB" ]]; then
eval "orca ci:run $ORCA_JOB before_install $ORCA_SUT_NAME"
fi