Skip to content

Commit c17fa8b

Browse files
authored
remove unused code (#42)
1 parent 422a730 commit c17fa8b

File tree

1 file changed

+0
-93
lines changed

1 file changed

+0
-93
lines changed

ci/common/common.sh

Lines changed: 0 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,6 @@ require_environment_variable() {
1717
fi
1818
}
1919

20-
# Fail if an environment variable does not exist.
21-
# ${1}: Actual arg count.
22-
# ${2}: Expected arg count.
23-
# ${3}: Script file.
24-
# ${4}: Line number.
25-
require_args() {
26-
[ "${1}" -eq "${2}" ] || { log_error "${3}:${4}: expected ${2} args, got ${1}"; exit 1; }
27-
}
28-
29-
# Checks if a program is in $PATH and is executable.
30-
check_executable() {
31-
test -x "$(command -v "${1}")"
32-
}
33-
3420
log_info() {
3521
printf "ci: %s\n" "$@"
3622
}
@@ -39,41 +25,13 @@ log_error() {
3925
>&2 printf "ci: error: %s\n" "$@"
4026
}
4127

42-
# Output the current OS.
43-
# Possible values are "osx" and "linux".
44-
get_os() {
45-
local os
46-
os="$(uname -s)"
47-
if [[ "${os}" == "Darwin" ]]; then
48-
echo "osx"
49-
else
50-
echo "linux"
51-
fi
52-
}
53-
5428
require_environment_variable BUILD_DIR "${BASH_SOURCE[0]}" ${LINENO}
5529

5630
CI_TARGET=${CI_TARGET:-$(basename "${0%.sh}")}
57-
CI_OS=${TRAVIS_OS_NAME:-$(get_os)}
5831
MAKE_CMD=${MAKE_CMD:-"make -j2"}
5932
GIT_NAME=${GIT_NAME:-marvim}
6033
GIT_EMAIL=${GIT_EMAIL:-marvim@users.noreply.github.com}
6134

62-
# Check if currently performing CI or local build.
63-
# ${1}: Task that is NOT executed if building locally.
64-
# Default: "installing dependencies". Not reported if equal to --silent.
65-
# Return 0 if CI build, 1 otherwise.
66-
is_ci_build() {
67-
local msg="${1:-installing dependencies}"
68-
if test "${CI:-}" != "true" ; then
69-
if test "$msg" != "--silent" ; then
70-
log_info "Local build, skip $msg"
71-
fi
72-
return 1
73-
fi
74-
return 0
75-
}
76-
7735
git_truncate() {
7836
local branch="${1}"
7937
local new_root
@@ -94,54 +52,3 @@ git_truncate() {
9452
log_info "git_truncate: old HEAD: $old_head"
9553
log_info "git_truncate: new HEAD: $(git rev-parse HEAD)"
9654
}
97-
98-
git_last_tag() {
99-
local tag
100-
if ! tag=$(git describe --abbrev=0 --exclude=nightly) ; then
101-
log_error "git_last_tag: 'git describe' failed"
102-
exit 1
103-
fi
104-
echo "$tag"
105-
}
106-
107-
git_commits_since_tag() {
108-
local tag="${1}"
109-
local ref="${2}"
110-
local commits_since
111-
if ! commits_since=$(git rev-list "${tag}..${ref}" --count) ; then
112-
log_error "git_commits_since_tag: 'git rev-list' failed"
113-
exit 1
114-
fi
115-
log_info "git_commits_since_tag: tag=$tag commits_since=$commits_since"
116-
echo "$commits_since"
117-
}
118-
119-
# Prompt the user to press a key to continue for local builds.
120-
# ${1}: Shown message.
121-
prompt_key_local() {
122-
if ! is_ci_build --silent ; then
123-
log_info "${1}"
124-
log_info "Press a key to continue, CTRL-C to abort..."
125-
read -r -n 1 -s
126-
fi
127-
}
128-
129-
# Check whether absence of private (i.e. encrypted) data should fail the build.
130-
# Echoes 0 in case of pull requests, 1 otherwise.
131-
# Usage examples:
132-
# - `exit $(can_fail_without_private)`
133-
# - `return $(can_fail_without_private)`
134-
can_fail_without_private() {
135-
if [ "${GITHUB_EVENT_NAME:-}" = pull_request ]; then
136-
echo 0
137-
else
138-
echo 1
139-
fi
140-
}
141-
142-
has_gh_token() {
143-
(
144-
set +o xtrace
145-
>/dev/null 2>&1 test -n "${GH_TOKEN:-}"
146-
)
147-
}

0 commit comments

Comments
 (0)