-
Notifications
You must be signed in to change notification settings - Fork 25
/
ci-bootstrap.sh
115 lines (91 loc) · 2.78 KB
/
ci-bootstrap.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
112
113
114
115
#!/bin/bash
abort() {
echo "ERROR: $1!"
exit 1
}
unamer() {
NAME="$(uname)"
if [ "$(echo "${NAME}" | grep MINGW)" != "" ] || [ "$(echo "${NAME}" | grep MSYS)" != "" ]; then
echo "Windows"
else
echo "${NAME}"
fi
}
if [ "$(unamer)" = "Darwin" ]; then
XCODE_DIR="/Applications/Xcode_VERSION.app/Contents/Developer"
# In GitHub Actions:
# env:
# PROJECT_TYPE: "UEFI"
# TODO: Get rid of 13.4.1 after fully migrating to macOS 13 workers.
if [ "$(uname -r | cut -f1 -d'.')" = "21" ]; then
XCODE_VERSION="13.4.1"
else
XCODE_VERSION="14.3.1"
fi
case "${PROJECT_TYPE}" in
UEFI)
BUILD_DEVELOPER_DIR="${XCODE_DIR/VERSION/${XCODE_VERSION}}"
ANALYZE_DEVELOPER_DIR="${XCODE_DIR/VERSION/${XCODE_VERSION}}"
COVERITY_DEVELOPER_DIR="${XCODE_DIR/VERSION/${XCODE_VERSION}}"
;;
KEXT | TOOL)
BUILD_DEVELOPER_DIR="${XCODE_DIR/VERSION/${XCODE_VERSION}}"
ANALYZE_DEVELOPER_DIR="${XCODE_DIR/VERSION/${XCODE_VERSION}}"
COVERITY_DEVELOPER_DIR="${XCODE_DIR/VERSION/${XCODE_VERSION}}"
;;
*)
abort "Invalid project type"
;;
esac
SELECTED_DEVELOPER_DIR="${JOB_TYPE}_DEVELOPER_DIR"
export BUILD_DEVELOPER_DIR
export ANALYZE_DEVELOPER_DIR
export COVERITY_DEVELOPER_DIR
export SELECTED_DEVELOPER_DIR
if [ -z "${!SELECTED_DEVELOPER_DIR}" ]; then
abort "Invalid or missing job type"
fi
echo "DEVELOPER_DIR=${!SELECTED_DEVELOPER_DIR}" >> "$GITHUB_ENV"
# Since GITHUB_ENV doesn't affect the current step, need to export DEVELOPER_DIR for subsequent commands.
export DEVELOPER_DIR="${!SELECTED_DEVELOPER_DIR}"
if [ -n "${ACID32}" ]; then
echo "OVERRIDE_PYTHON3=${DEVELOPER_DIR}/usr/bin/python3" >> "$GITHUB_ENV"
export OVERRIDE_PYTHON3="${DEVELOPER_DIR}/usr/bin/python3"
src=$(curl -Lfs https://raw.githubusercontent.com/acidanthera/ocbuild/master/clang32-bootstrap.sh) && eval "$src" || exit 1
fi
fi
colored_text() {
echo -e "\033[0;36m${1}\033[0m"
}
# Print runner details
colored_text "OS version"
if [ "$(unamer)" = "Darwin" ]; then
sw_vers
elif [ "$(unamer)" = "Windows" ]; then
wmic os get caption, version
else
lsb_release -a
fi
colored_text "git version"
git --version
colored_text "bash version"
bash --version
colored_text "curl version"
curl --version
if [ "$(unamer)" = "Darwin" ]; then
colored_text "clang version"
clang --version
if [ -n "${ACID32}" ]; then
colored_text "clang32 version"
./clang32/clang-12 --version
fi
colored_text "Xcode version"
xcode-select --print-path
else
colored_text "gcc version"
gcc --version
fi
if [ "$(unamer)" = "Windows" ]; then
colored_text "VS latest version"
echo "$(vswhere -latest -products '*' -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property catalog_productSemanticVersion)"
fi