-
Notifications
You must be signed in to change notification settings - Fork 32
/
report-download-github
executable file
·60 lines (49 loc) · 1.15 KB
/
report-download-github
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/sh -ef
# Downloads previous CI results from ci_artifacts repo at GitHub
print_usage()
{
echo "Usage: $0 <target> <subtarget> <implementation> <os> <arch>"
}
if [ "$#" -ne 5 ]; then
print_usage
exit 1
fi
TARGET=$1
SUBTARGET=$2
IMPLEMENTATION=$3
OS=$4
ARCH=$5
if [ -z "$TARGET" ]; then
echo '<target> must not be empty'; echo
print_usage
exit 1
fi
if [ -z "$IMPLEMENTATION" ]; then
echo '<implementation> must not be empty'; echo
print_usage
exit 1
fi
if [ -z "$OS" ]; then
echo '<os> must not be empty'; echo
print_usage
exit 1
fi
if [ -z "$ARCH" ]; then
echo '<arch> must not be empty'; echo
print_usage
exit 1
fi
FULL_TARGET_NAME=${TARGET}${SUBTARGET}/${IMPLEMENTATION}-${OS}-${ARCH}
PREV_CI_FILE="ci_results/${FULL_TARGET_NAME}/ci.json"
if [ -r "$PREV_CI_FILE" ]; then
exit 0
fi
mkdir -p "$(dirname "$PREV_CI_FILE")"
REPO_URL=https://github.com/kaitai-io/ci_artifacts
FILE_PATH=test_out/${TARGET}${SUBTARGET}/ci.json
curl_ex=0
curl -fsSL "${REPO_URL}/raw/${FULL_TARGET_NAME}/${FILE_PATH}" -o "$PREV_CI_FILE" || curl_ex=$?
if [ "$curl_ex" -ne 0 ]; then
echo "Check ${REPO_URL}/blob/${FULL_TARGET_NAME}/${FILE_PATH}"
exit "$curl_ex"
fi