Skip to content

Commit 3e4f641

Browse files
committed
[ci] Bump release runners to latest/24.04
Bump the Linux runners used for release to either latest (if the version should have no effect on the job) or 24.04 (if tool versions may matter). Signed-off-by: Schuyler Eldridge <[email protected]>
1 parent 0ae25e2 commit 3e4f641

File tree

4 files changed

+557
-143
lines changed

4 files changed

+557
-143
lines changed

.github/bin/uploadReleaseArtifacts.sh

+283
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,283 @@
1+
#!/usr/bin/env bash
2+
3+
set -eo pipefail
4+
5+
usage() {
6+
cat << EOF
7+
USAGE: $0 -o <os> -e <github-event> -b <build-type> [-t -a]
8+
9+
Generate a JSON payload to drive unifiedBuildAndTest* scripts.
10+
11+
OPTIONS:
12+
-a Enable assertions
13+
-b The CMAKE build type: [release, relwithdebinfo, debug]
14+
-e GitHub event name: [workflow_dispatch, schedule]
15+
-h Display available options
16+
-o OS to target: [linux, macos, windows]
17+
-t Run tests
18+
EOF
19+
}
20+
21+
#-------------------------------------------------------------------------------
22+
# Option parsing
23+
#-------------------------------------------------------------------------------
24+
25+
OPT_ASSERTIONS=OFF
26+
OPT_CMAKE_BUILD_TYPE=
27+
OPT_GITHUB_EVENT_NAME=
28+
OPT_OS=()
29+
OPT_RUN_TESTS=false
30+
while getopts "ab:e:ho:t" option; do
31+
case $option in
32+
a)
33+
OPT_ASSERTIONS=ON
34+
;;
35+
b)
36+
case "$OPTARG" in
37+
"release" | "relwithdebinfo" | "debug")
38+
OPT_CMAKE_BUILD_TYPE=$OPTARG
39+
;;
40+
*)
41+
echo "unknown argument '$OPTARG' for '-b', must be one of ['release', 'relwithdebinfo', 'debug']"
42+
exit 1
43+
;;
44+
esac
45+
;;
46+
e)
47+
case "$OPTARG" in
48+
"release" | "schedule" | "workflow_dispatch")
49+
OPT_GITHUB_EVENT_NAME=$OPTARG
50+
;;
51+
*)
52+
echo "unsupported GitHub event '$OPTARG', must be one of ['release', 'schedule', 'workflow_dispatch']"
53+
exit 1
54+
;;
55+
esac
56+
;;
57+
h)
58+
usage
59+
exit 0
60+
;;
61+
o)
62+
case "$OPTARG" in
63+
"linux" | "macos" | "windows")
64+
OPT_OS+=("$OPTARG")
65+
;;
66+
*)
67+
echo "unknown argument '$OPTARG' for '-o', must be one of ['linux', 'macos', 'windows']"
68+
exit 1
69+
;;
70+
esac
71+
;;
72+
t)
73+
OPT_RUN_TESTS=true
74+
;;
75+
*)
76+
echo "uknown option"
77+
usage
78+
exit 1
79+
;;
80+
esac
81+
done
82+
83+
#-------------------------------------------------------------------------------
84+
# Option validation, default handling
85+
#-------------------------------------------------------------------------------
86+
87+
# A GitHub event name is mandatory.
88+
if [[ ! $OPT_GITHUB_EVENT_NAME ]] ; then
89+
echo "missing mandatory '-e <github-event>' option"
90+
usage
91+
exit 1
92+
fi
93+
94+
# Certain GitHub events have pre-programmed options. For "release", these are
95+
# the settings used for the artifacts we will publish and intend for every
96+
# downstream project to use. For "schedule", these artifacts will be used by
97+
# nightly testing. For "workflow_dispatch", everything is in the user's
98+
# control and _not_ defaults are set.
99+
case "$OPT_GITHUB_EVENT_NAME" in
100+
"release")
101+
OPT_ASSERTIONS=OFF
102+
OPT_CMAKE_BUILD_TYPE=release
103+
OPT_OS=("linux" "macos" "windows")
104+
OPT_RUN_TESTS=true
105+
;;
106+
"schedule")
107+
OPT_ASSERTIONS=ON
108+
OPT_CMAKE_BUILD_TYPE=release
109+
OPT_OS=("linux")
110+
;;
111+
"workflow_dispatch")
112+
;;
113+
esac
114+
115+
# After defaults have been applied, do a final check of options.
116+
if [[ ! $OPT_CMAKE_BUILD_TYPE ]]; then
117+
echo "missing mandatory '-b <build-type>' option"
118+
usage
119+
exit 1
120+
fi
121+
if [[ "${#OPT_OS[@]}" == 0 ]] ; then
122+
echo "at least one '-o <os>' options must be specified"
123+
usage
124+
exit 1
125+
fi
126+
127+
# Unique the OS arguments.
128+
mapfile -t OPT_OS < <(echo "${OPT_OS[@]}" | tr ' ' '\n' | sort -u)
129+
130+
#-------------------------------------------------------------------------------
131+
# JSON snippets used to configure downstream workflows
132+
#-------------------------------------------------------------------------------
133+
134+
# Configuration for a run of the static UBTI script.
135+
configStatic=$(cat <<EOF
136+
[
137+
{
138+
"cmake_build_type": "$OPT_CMAKE_BUILD_TYPE",
139+
"llvm_enable_assertions": "$OPT_ASSERTIONS",
140+
"llvm_force_enable_stats": "ON",
141+
"run_tests": $OPT_RUN_TESTS,
142+
"install_target": "install-firtool install-om-linker",
143+
"package_name_prefix": "firrtl-bin"
144+
}
145+
]
146+
EOF
147+
)
148+
149+
# Configuration snippets for a run of the native runner UBTI script.
150+
configLinuxRunner=$(cat <<EOF
151+
[
152+
{
153+
"runner": "ubuntu-22.04",
154+
"cmake_c_compiler": "clang",
155+
"cmake_cxx_compiler": "clang++"
156+
}
157+
]
158+
EOF
159+
)
160+
configMacOsRunner=$(cat <<EOF
161+
[
162+
{
163+
"runner": "macos-13",
164+
"cmake_c_compiler": "clang",
165+
"cmake_cxx_compiler": "clang++"
166+
}
167+
]
168+
EOF
169+
)
170+
configWindowsRunner=$(cat <<EOF
171+
[
172+
{
173+
"runner": "windows-2022",
174+
"cmake_c_compiler": "cl",
175+
"cmake_cxx_compiler": "cl"
176+
}
177+
]
178+
EOF
179+
)
180+
181+
# Configuration snippets for building something on the native UBTI workflow.
182+
configNativeFullShared=$(cat <<EOF
183+
[
184+
{
185+
"name":"CIRCT-full shared",
186+
"install_target":"install",
187+
"package_name_prefix":"circt-full-shared",
188+
"cmake_build_type":"$OPT_CMAKE_BUILD_TYPE",
189+
"llvm_enable_assertions":"$OPT_ASSERTIONS",
190+
"build_shared_libs":"ON",
191+
"llvm_force_enable_stats":"ON",
192+
"run_tests": $OPT_RUN_TESTS
193+
}
194+
]
195+
EOF
196+
)
197+
configNativeFullStatic=$(cat <<EOF
198+
[
199+
{
200+
"name":"CIRCT-full static",
201+
"install_target":"install",
202+
"package_name_prefix":"circt-full-static",
203+
"cmake_build_type":"$OPT_CMAKE_BUILD_TYPE",
204+
"llvm_enable_assertions":"$OPT_ASSERTIONS",
205+
"build_shared_libs":"OFF",
206+
"llvm_force_enable_stats":"ON",
207+
"run_tests": $OPT_RUN_TESTS
208+
}
209+
]
210+
EOF
211+
)
212+
configNativeFirtool=$(cat <<EOF
213+
[
214+
{
215+
"name": "firtool",
216+
"install_target": "install-firtool install-om-linker",
217+
"package_name_prefix": "firrtl-bin",
218+
"cmake_build_type":"$OPT_CMAKE_BUILD_TYPE",
219+
"llvm_enable_assertions":"$OPT_ASSERTIONS",
220+
"build_shared_libs":"OFF",
221+
"llvm_force_enable_stats":"ON",
222+
"run_tests": $OPT_RUN_TESTS
223+
}
224+
]
225+
EOF
226+
)
227+
228+
#-------------------------------------------------------------------------------
229+
# Build the JSON payload the will be used to configure UBTI and UBTI-static.
230+
#-------------------------------------------------------------------------------
231+
232+
# This is the shape of the JSON payload. This is a dictionary with two keys:
233+
# static and native. Static will be used to configure the UBTI-static workflow.
234+
# Native will be used to configure the UBTI workflow.
235+
config=$(cat <<EOF
236+
{
237+
"static": [],
238+
"native": []
239+
}
240+
EOF
241+
)
242+
for os in "${OPT_OS[@]}"; do
243+
case "$os" in
244+
# Linux gets:
245+
# 1. Static firtool binary
246+
# 2. Native full shared
247+
# 3. Native full static
248+
"linux")
249+
# Static:
250+
config=$(echo "$config" | jq '.static += $a' --argjson a "$configStatic")
251+
# Native:
252+
native=$(echo "$configNativeFullShared" "$configNativeFullStatic" | jq -s 'add')
253+
native=$(echo "$native" "$configLinuxRunner" | jq -s '[combinations | add]')
254+
config=$(echo "$config" | jq '.native += $a' --argjson a "$native")
255+
;;
256+
# MacOS gets:
257+
# 1. Native firtool binary
258+
# 2. Native full shared
259+
# 3. Native full static
260+
"macos")
261+
native=$(echo "$configNativeFullShared" "$configNativeFullStatic" "$configNativeFirtool" | jq -s 'add')
262+
native=$(echo "$native" "$configMacOsRunner" | jq -s '[combinations | add]')
263+
config=$(echo "$config" | jq '.native += $a' --argjson a "$native")
264+
;;
265+
# Windows gets:
266+
# 1. Native firtool binary
267+
# 2. Native full static
268+
#
269+
# Note: Windows cannot handle full shared.
270+
"windows")
271+
native=$(echo "$configNativeFullStatic" "$configNativeFirtool" | jq -s 'add')
272+
native=$(echo "$native" "$configWindowsRunner" | jq -s '[combinations | add]')
273+
config=$(echo "$config" | jq '.native += $a' --argjson a "$native")
274+
;;
275+
*)
276+
echo "unknown os '$os'"
277+
exit 1
278+
;;
279+
esac
280+
done
281+
282+
# Return the final `config` JSON.
283+
echo "$config"

0 commit comments

Comments
 (0)