-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathentrypoint.sh
More file actions
91 lines (75 loc) · 2.74 KB
/
entrypoint.sh
File metadata and controls
91 lines (75 loc) · 2.74 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
#!/bin/bash
echo PACKAGE = $PACKAGE
set -e
PATH="$HOME/.local/bin:$PATH"
BOOTSTRAP_MARKER="$HOME/.cache/unittesting/bootstrap.done"
ensure_git_identity() {
# Align local container behavior with typical CI runners where git
# identity is configured for tests that create commits.
if ! git config --global user.name >/dev/null 2>&1; then
git config --global user.name "${UNITTESTING_GIT_USER_NAME:-UnitTesting CI}"
fi
if ! git config --global user.email >/dev/null 2>&1; then
git config --global user.email "${UNITTESTING_GIT_USER_EMAIL:-unittesting@example.invalid}"
fi
}
ensure_ci_platform_compat() {
# Some test suites key off Travis-style OS markers while others expect
# GitHub Actions' RUNNER_OS naming.
local travis_name=""
local runner_name=""
case "$(uname -s)" in
Linux*)
travis_name="linux"
runner_name="Linux"
;;
Darwin*)
travis_name="osx"
runner_name="macOS"
;;
CYGWIN*|MINGW*|MSYS*)
travis_name="windows"
runner_name="Windows"
;;
esac
if [ -n "$travis_name" ] && [ -z "$TRAVIS_OS_NAME" ]; then
export TRAVIS_OS_NAME="$travis_name"
fi
if [ -n "$runner_name" ] && [ -z "$RUNNER_OS" ]; then
export RUNNER_OS="$runner_name"
fi
}
sudo sh -e /etc/init.d/xvfb start
ensure_git_identity
ensure_ci_platform_compat
UNITTESTING_SOURCE=${UNITTESTING_SOURCE:-/unittesting}
SUBLIME_TEXT_VERSION=${SUBLIME_TEXT_VERSION:-4}
if [ "$SUBLIME_TEXT_VERSION" -ge 4 ]; then
ST_PACKAGES_DIR="$HOME/.config/sublime-text/Packages"
else
ST_PACKAGES_DIR="$HOME/.config/sublime-text-$SUBLIME_TEXT_VERSION/Packages"
fi
if [ -d "$UNITTESTING_SOURCE/sbin" ]; then
# Ensure UnitTesting comes from the local checkout running this script,
# so first runs do not depend on tagged upstream releases.
(cd "$UNITTESTING_SOURCE" && PACKAGE=UnitTesting /docker.sh copy_tested_package overwrite)
# Normalize CRLF in shell scripts copied from Windows workspaces.
if [ -d "$ST_PACKAGES_DIR/UnitTesting/sbin" ]; then
find "$ST_PACKAGES_DIR/UnitTesting/sbin" -type f -name "*.sh" -exec sed -i 's/\r$//' {} +
fi
fi
if [ ! -f "$BOOTSTRAP_MARKER" ]; then
# Bootstrap from a neutral cwd to avoid Windows worktree .git indirection
# paths breaking git commands inside the Linux container.
(cd /tmp && /docker.sh bootstrap skip_package_copy)
/docker.sh install_package_control
mkdir -p "$(dirname "$BOOTSTRAP_MARKER")"
touch "$BOOTSTRAP_MARKER"
fi
# Always refresh checked-out package into Packages/<PACKAGE>
/docker.sh copy_tested_package overwrite
if [ "$#" -gt 0 ]; then
/docker.sh "$@"
else
/docker.sh run_tests --coverage
fi