Skip to content

Commit a8f70b4

Browse files
committed
ci: build_policy and CI detection support added to check_all.sh
1 parent f3a3867 commit a8f70b4

File tree

2 files changed

+43
-23
lines changed

2 files changed

+43
-23
lines changed

.devcontainer/check_all.sh

Lines changed: 42 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,20 @@
66

77
set -e
88

9-
while getopts :hd opt
9+
# Auto-detect CI environment and use "never" build policy
10+
if [[ -n "${CI:-}" ]]; then
11+
build_policy="never"
12+
else
13+
build_policy="missing"
14+
fi
15+
16+
while getopts :hdn opt
1017
do
1118
case $opt in
1219
h)
13-
echo "Usage: $0 [-d] [install|build|create]"
20+
echo "Usage: $0 [-d] [-n] [install|build|create]"
1421
echo " -d Run debug builds in addition to release builds"
22+
echo " -n Never build: require all dependencies to be pre-built (fail if build from source is needed)"
1523
echo "Commands:"
1624
echo " install Install dependencies only"
1725
echo " build Build the project with all compiler configurations"
@@ -21,6 +29,9 @@ do
2129
d)
2230
run_debug=true
2331
;;
32+
n)
33+
build_policy="never"
34+
;;
2435
esac
2536
done
2637

@@ -41,6 +52,9 @@ echo "🔧 Operation: $1"
4152
if [[ $run_debug ]]; then
4253
echo "🐛 Debug builds: enabled"
4354
fi
55+
if [[ $build_policy == "never" ]]; then
56+
echo "⚙️ Never build mode: requiring pre-built dependencies only"
57+
fi
4458
echo ""
4559

4660
if [[ $1 != "install" ]]; then
@@ -54,34 +68,42 @@ echo "🏗️ Starting compiler matrix testing..."
5468
# GCC configurations
5569
echo "🚀 Starting release build configurations..."
5670
echo "⚙️ Testing GCC configurations..."
57-
conan $1 . -pr gcc12 -c user.mp-units.build:all=True -o '&:cxx_modules=False' -o '&:import_std=False' -o '&:std_format=False' -o '&:contracts=gsl-lite' -s compiler.cppstd=20 -b missing
58-
conan $1 . -pr gcc13 -c user.mp-units.build:all=True -o '&:cxx_modules=False' -o '&:import_std=False' -o '&:std_format=True' -o '&:contracts=none' -s compiler.cppstd=23 -b missing
59-
conan $1 . -pr gcc14 -c user.mp-units.build:all=True -o '&:cxx_modules=False' -o '&:import_std=False' -o '&:std_format=False' -o '&:contracts=ms-gsl' -s compiler.cppstd=23 -b missing
60-
conan $1 . -pr gcc15 -c user.mp-units.build:all=True -o '&:cxx_modules=False' -o '&:import_std=False' -o '&:std_format=True' -o '&:contracts=gsl-lite' -s compiler.cppstd=26 -b missing
71+
set -x
72+
conan $1 . -pr gcc12 -c user.mp-units.build:all=True -o '&:cxx_modules=False' -o '&:import_std=False' -o '&:std_format=False' -o '&:contracts=gsl-lite' -s compiler.cppstd=20 -b "$build_policy"
73+
conan $1 . -pr gcc13 -c user.mp-units.build:all=True -o '&:cxx_modules=False' -o '&:import_std=False' -o '&:std_format=True' -o '&:contracts=none' -s compiler.cppstd=23 -b "$build_policy"
74+
conan $1 . -pr gcc14 -c user.mp-units.build:all=True -o '&:cxx_modules=False' -o '&:import_std=False' -o '&:std_format=False' -o '&:contracts=ms-gsl' -s compiler.cppstd=23 -b "$build_policy"
75+
conan $1 . -pr gcc15 -c user.mp-units.build:all=True -o '&:cxx_modules=False' -o '&:import_std=False' -o '&:std_format=True' -o '&:contracts=gsl-lite' -s compiler.cppstd=26 -b "$build_policy"
76+
set +x
6177

6278
echo "⚙️ Testing Clang configurations..."
63-
conan $1 . -pr clang16 -c user.mp-units.build:all=True -o '&:cxx_modules=False' -o '&:import_std=False' -o '&:std_format=False' -o '&:contracts=gsl-lite' -s compiler.cppstd=20 -b missing
64-
conan $1 . -pr clang17 -c user.mp-units.build:all=True -o '&:cxx_modules=True' -o '&:import_std=False' -o '&:std_format=True' -o '&:contracts=ms-gsl' -s compiler.cppstd=26 -b missing
65-
conan $1 . -pr clang18 -c user.mp-units.build:all=True -o '&:cxx_modules=True' -o '&:import_std=True' -o '&:std_format=True' -o '&:contracts=none' -s compiler.cppstd=26 -b missing
79+
set -x
80+
conan $1 . -pr clang16 -c user.mp-units.build:all=True -o '&:cxx_modules=False' -o '&:import_std=False' -o '&:std_format=False' -o '&:contracts=gsl-lite' -s compiler.cppstd=20 -b "$build_policy"
81+
conan $1 . -pr clang17 -c user.mp-units.build:all=True -o '&:cxx_modules=True' -o '&:import_std=False' -o '&:std_format=True' -o '&:contracts=ms-gsl' -s compiler.cppstd=26 -b "$build_policy"
82+
conan $1 . -pr clang18 -c user.mp-units.build:all=True -o '&:cxx_modules=True' -o '&:import_std=True' -o '&:std_format=True' -o '&:contracts=none' -s compiler.cppstd=26 -b "$build_policy"
6683
# clang-19 will never compile mp-units due to https://github.com/llvm/llvm-project/pull/118288
67-
conan $1 . -pr clang20 -c user.mp-units.build:all=True -o '&:cxx_modules=True' -o '&:import_std=True' -o '&:std_format=True' -o '&:contracts=none' -s compiler.cppstd=26 -b missing
68-
conan $1 . -pr clang21 -c user.mp-units.build:all=True -o '&:cxx_modules=True' -o '&:import_std=True' -o '&:std_format=True' -o '&:contracts=none' -s compiler.cppstd=26 -b missing
84+
conan $1 . -pr clang20 -c user.mp-units.build:all=True -o '&:cxx_modules=True' -o '&:import_std=True' -o '&:std_format=True' -o '&:contracts=none' -s compiler.cppstd=26 -b "$build_policy"
85+
conan $1 . -pr clang21 -c user.mp-units.build:all=True -o '&:cxx_modules=True' -o '&:import_std=True' -o '&:std_format=True' -o '&:contracts=none' -s compiler.cppstd=26 -b "$build_policy"
86+
set +x
6987

7088
if [[ $run_debug ]]; then
7189
echo "🐛 Starting debug build configurations..."
7290
echo "⚙️ Testing GCC debug configurations..."
73-
conan $1 . -pr gcc12 -c user.mp-units.build:all=True -o '&:cxx_modules=False' -o '&:import_std=False' -o '&:std_format=False' -o '&:contracts=gsl-lite' -s compiler.cppstd=20 -b missing -s build_type=Debug
74-
conan $1 . -pr gcc13 -c user.mp-units.build:all=True -o '&:cxx_modules=False' -o '&:import_std=False' -o '&:std_format=True' -o '&:contracts=none' -s compiler.cppstd=23 -b missing -s build_type=Debug
75-
conan $1 . -pr gcc14 -c user.mp-units.build:all=True -o '&:cxx_modules=False' -o '&:import_std=False' -o '&:std_format=False' -o '&:contracts=ms-gsl' -s compiler.cppstd=23 -b missing -s build_type=Debug
76-
conan $1 . -pr gcc15 -c user.mp-units.build:all=True -o '&:cxx_modules=False' -o '&:import_std=False' -o '&:std_format=True' -o '&:contracts=gsl-lite' -s compiler.cppstd=26 -b missing -s build_type=Debug
91+
set -x
92+
conan $1 . -pr gcc12 -c user.mp-units.build:all=True -o '&:cxx_modules=False' -o '&:import_std=False' -o '&:std_format=False' -o '&:contracts=gsl-lite' -s compiler.cppstd=20 -b "$build_policy" -s build_type=Debug
93+
conan $1 . -pr gcc13 -c user.mp-units.build:all=True -o '&:cxx_modules=False' -o '&:import_std=False' -o '&:std_format=True' -o '&:contracts=none' -s compiler.cppstd=23 -b "$build_policy" -s build_type=Debug
94+
conan $1 . -pr gcc14 -c user.mp-units.build:all=True -o '&:cxx_modules=False' -o '&:import_std=False' -o '&:std_format=False' -o '&:contracts=ms-gsl' -s compiler.cppstd=23 -b "$build_policy" -s build_type=Debug
95+
conan $1 . -pr gcc15 -c user.mp-units.build:all=True -o '&:cxx_modules=False' -o '&:import_std=False' -o '&:std_format=True' -o '&:contracts=gsl-lite' -s compiler.cppstd=26 -b "$build_policy" -s build_type=Debug
96+
set +x
7797

7898
echo "⚙️ Testing Clang debug configurations..."
79-
conan $1 . -pr clang16 -c user.mp-units.build:all=True -o '&:cxx_modules=False' -o '&:import_std=False' -o '&:std_format=False' -o '&:contracts=gsl-lite' -s compiler.cppstd=20 -b missing -s build_type=Debug
80-
conan $1 . -pr clang17 -c user.mp-units.build:all=True -o '&:cxx_modules=True' -o '&:import_std=False' -o '&:std_format=True' -o '&:contracts=ms-gsl' -s compiler.cppstd=26 -b missing -s build_type=Debug
81-
conan $1 . -pr clang18 -c user.mp-units.build:all=True -o '&:cxx_modules=True' -o '&:import_std=True' -o '&:std_format=True' -o '&:contracts=none' -s compiler.cppstd=26 -b missing -s build_type=Debug
99+
set -x
100+
conan $1 . -pr clang16 -c user.mp-units.build:all=True -o '&:cxx_modules=False' -o '&:import_std=False' -o '&:std_format=False' -o '&:contracts=gsl-lite' -s compiler.cppstd=20 -b "$build_policy" -s build_type=Debug
101+
conan $1 . -pr clang17 -c user.mp-units.build:all=True -o '&:cxx_modules=True' -o '&:import_std=False' -o '&:std_format=True' -o '&:contracts=ms-gsl' -s compiler.cppstd=26 -b "$build_policy" -s build_type=Debug
102+
conan $1 . -pr clang18 -c user.mp-units.build:all=True -o '&:cxx_modules=True' -o '&:import_std=True' -o '&:std_format=True' -o '&:contracts=none' -s compiler.cppstd=26 -b "$build_policy" -s build_type=Debug
82103
# clang-19 will never compile mp-units due to https://github.com/llvm/llvm-project/pull/118288
83-
conan $1 . -pr clang20 -c user.mp-units.build:all=True -o '&:cxx_modules=True' -o '&:import_std=True' -o '&:std_format=True' -o '&:contracts=none' -s compiler.cppstd=26 -b missing -s build_type=Debug
84-
conan $1 . -pr clang21 -c user.mp-units.build:all=True -o '&:cxx_modules=True' -o '&:import_std=True' -o '&:std_format=True' -o '&:contracts=none' -s compiler.cppstd=26 -b missing -s build_type=Debug
104+
conan $1 . -pr clang20 -c user.mp-units.build:all=True -o '&:cxx_modules=True' -o '&:import_std=True' -o '&:std_format=True' -o '&:contracts=none' -s compiler.cppstd=26 -b "$build_policy" -s build_type=Debug
105+
conan $1 . -pr clang21 -c user.mp-units.build:all=True -o '&:cxx_modules=True' -o '&:import_std=True' -o '&:std_format=True' -o '&:contracts=none' -s compiler.cppstd=26 -b "$build_policy" -s build_type=Debug
106+
set +x
85107
echo "✅ Debug builds completed!"
86108
fi
87109

.github/workflows/codespaces-test.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,4 @@ jobs:
5353
imageName: mp-units-dev
5454
cacheFrom: mp-units-dev
5555
push: never
56-
runCmd: |
57-
echo "✅ Devcontainer build and setup completed successfully"
58-
echo "Validation was performed during postCreateCommand"
56+
runCmd: echo "✅ Devcontainer build and setup completed successfully with pre-built packages only"

0 commit comments

Comments
 (0)