-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
executable file
·61 lines (48 loc) · 1.57 KB
/
entrypoint.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
#!/bin/bash
set -e
printf "Found files in workspace:\n"
ls
printf "Input abidiff: ${INPUT_ABIDIFF}\n"
printf "Input abidw: ${INPUT_ABIDW}\n"
printf "Input allow fail: ${INPUT_ALLOW_FAIL}\n"
printf "Looking for Libabigail abidiff install...\n"
which abidiff
# One of abidiff or abidw needs to be defined
if [ -z "$INPUT_ABIDIFF" ] && [ -z "$INPUT_ABIDW" ]; then
echo "You need to define input for one of abidw or abidiff"
exit 1
fi
# Shared function to run command and capture error for each
function run_command() {
COMMAND=$@
echo $COMMAND
# Capture error code and respond appropriately
${COMMAND} || (
retval=$?
printf "Return value: $retval\n"
echo "::set-output name=retval::${retval}"
# Failure, but we are allowing it
if [[ ${retval} -ne 0 ]] && [[ "${INPUT_ALLOW_FAIL}" == "true" ]]; then
printf "abidiff returned error code, but we are allowing failure. 😅️\n"
exit 0
fi
# Failure and don't allow it
if [[ ${retval} -ne 0 ]] && [[ "${INPUT_ALLOW_FAIL}" == "false" ]]; then
printf "abidiff returned returned error code, there are detected ABI changes. 😭️\n"
exit $retval
fi
if [[ ${retval} -eq 0 ]]; then
printf "abidiff returned exit code 0, there are no detected ABI changes. 😁️\n"
exit $retval
fi
)
printf "Return value: $?\n"
}
if [ ! -z "$INPUT_ABIDIFF" ]; then
COMMAND="abidiff ${INPUT_ABIDIFF}"
run_command $COMMAND
fi
if [ ! -z "$INPUT_ABIDW" ]; then
COMMAND="abidw ${INPUT_ABIDW}"
run_command $COMMAND
fi