Skip to content

Commit b684463

Browse files
committed
Add BSD variants
1 parent 1337457 commit b684463

File tree

1 file changed

+270
-0
lines changed

1 file changed

+270
-0
lines changed

.github/workflows/ci.yml

Lines changed: 270 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -857,3 +857,273 @@ jobs:
857857
fi
858858
B2_ARGS+=("libs/$LIBRARY/test")
859859
./b2 "${B2_ARGS[@]}"
860+
861+
bsd:
862+
strategy:
863+
fail-fast: false
864+
matrix:
865+
include:
866+
- toolset: clang
867+
vm: freebsd
868+
cxxflags: -pipe
869+
os: ubuntu-latest
870+
bsd_version: "13.5"
871+
872+
- toolset: clang
873+
vm: freebsd
874+
cxxflags: -pipe
875+
os: ubuntu-latest
876+
bsd_version: "14.0"
877+
878+
- toolset: clang
879+
vm: freebsd
880+
cxxflags: -pipe
881+
os: ubuntu-latest
882+
bsd_version: "14.1"
883+
884+
- toolset: clang
885+
vm: freebsd
886+
cxxflags: -pipe
887+
os: ubuntu-latest
888+
bsd_version: "14.2"
889+
890+
- toolset: clang
891+
vm: freebsd
892+
cxxflags: -pipe
893+
os: ubuntu-latest
894+
bsd_version: "14.3"
895+
896+
- toolset: clang
897+
vm: openbsd
898+
cxxflags: -pipe
899+
os: ubuntu-latest
900+
bsd_version: "7.3"
901+
902+
- toolset: clang
903+
vm: openbsd
904+
cxxflags: -pipe
905+
os: ubuntu-latest
906+
bsd_version: "7.4"
907+
908+
- toolset: clang
909+
vm: openbsd
910+
cxxflags: -pipe
911+
os: ubuntu-latest
912+
bsd_version: "7.5"
913+
914+
- toolset: clang
915+
vm: openbsd
916+
cxxflags: -pipe
917+
os: ubuntu-latest
918+
bsd_version: "7.6"
919+
920+
- toolset: clang
921+
vm: openbsd
922+
cxxflags: -pipe
923+
os: ubuntu-latest
924+
bsd_version: "7.7"
925+
926+
- toolset: clang
927+
vm: openbsd
928+
cxxflags: -pipe
929+
os: ubuntu-latest
930+
bsd_version: "7.8"
931+
932+
- toolset: gcc
933+
vm: netbsd
934+
cxxflags: -pipe
935+
os: ubuntu-latest
936+
bsd_version: "9.2"
937+
938+
- toolset: gcc
939+
vm: netbsd
940+
cxxflags: -pipe
941+
os: ubuntu-latest
942+
bsd_version: "9.3"
943+
944+
- toolset: gcc
945+
vm: netbsd
946+
cxxflags: -pipe
947+
os: ubuntu-latest
948+
bsd_version: "9.4"
949+
950+
- toolset: gcc
951+
vm: netbsd
952+
cxxflags: -pipe
953+
os: ubuntu-latest
954+
bsd_version: "10.0"
955+
956+
- toolset: gcc
957+
vm: netbsd
958+
cxxflags: -pipe
959+
os: ubuntu-latest
960+
bsd_version: "10.1"
961+
962+
timeout-minutes: 240
963+
runs-on: ${{matrix.os}}
964+
965+
steps:
966+
- uses: actions/checkout@v4
967+
- name: Test on ${{matrix.vm}}
968+
uses: cross-platform-actions/[email protected]
969+
with:
970+
operating_system: ${{matrix.vm}}
971+
version: ${{matrix.bsd_version}}
972+
environment_variables: GIT_FETCH_JOBS NET_RETRY_COUNT DEFAULT_BUILD_VARIANT
973+
sync_files: false
974+
shell: bash
975+
run: |
976+
export PATH=/usr/pkg/bin:/sbin:/usr/local/bin:$PATH >> ~/.profile
977+
export PATH=/usr/pkg/bin:/sbin:/usr/local/bin:$PATH
978+
uname -mrs
979+
sysctl hw.model
980+
sysctl hw.ncpu
981+
sysctl hw.physmem
982+
sysctl hw.usermem
983+
pwd
984+
ls -la
985+
set -e
986+
987+
# Install required packages
988+
echo "Installing packages..."
989+
if [ "${{matrix.vm}}" == "freebsd" ]
990+
then
991+
echo "Executing: sudo pkg git bash python3 curl"
992+
sudo pkg install -y git bash python3 curl
993+
fi
994+
if [ "${{matrix.vm}}" == "openbsd" ]
995+
then
996+
pkg_info -Q python
997+
echo "Executing: sudo pkg_add git bash python%3.11 curl"
998+
sudo pkg_add -v git bash python%3.11 curl
999+
# Check if python3 binary exists
1000+
if ! command -v python3 >/dev/null 2>&1; then
1001+
echo "python3 not found, creating symlink..."
1002+
sudo ln -sf /usr/local/bin/python3.11 /usr/local/bin/python3
1003+
echo "Symlink created: /usr/local/bin/python3 -> /usr/local/bin/python3.11"
1004+
else
1005+
echo "python3 is already available at: $(which python3)"
1006+
fi
1007+
fi
1008+
if [ "${{matrix.vm}}" == "netbsd" ]
1009+
then
1010+
echo "Executing: pkgin -y install git-base bash python311 curl ca-certificates mozilla-rootcerts mozilla-rootcerts-openssl"
1011+
sudo sh -c '
1012+
export PKG_PATH="http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/$(uname -p)/$(uname -r | cut -d_ -f1)/All/"
1013+
echo "$PKG_PATH" > /usr/pkg/etc/pkgin/repositories.conf
1014+
pkgin update
1015+
pkgin -V -y install git-base bash python311 curl ca-certificates mozilla-rootcerts mozilla-rootcerts-openssl
1016+
ln -s /usr/pkg/bin/python3.11 /usr/pkg/bin/python3
1017+
'
1018+
fi
1019+
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
1020+
LIBRARY=${GITHUB_REPOSITORY#*/}
1021+
echo LIBRARY: $LIBRARY
1022+
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
1023+
echo GITHUB_REF: $GITHUB_REF
1024+
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
1025+
REF=${REF#refs/heads/}
1026+
echo REF: $REF
1027+
BOOST_BRANCH=develop && [ "$REF" = "master" ] && BOOST_BRANCH=master || true
1028+
echo BOOST_BRANCH: $BOOST_BRANCH
1029+
BUILD_JOBS=$(sysctl -n hw.ncpu)
1030+
echo BUILD_JOBS: $BUILD_JOBS
1031+
DEPINST_ARGS=()
1032+
DEPINST_ARGS+=("--git_args" "--jobs $GIT_FETCH_JOBS")
1033+
1034+
mkdir -p snapshot
1035+
cd snapshot
1036+
echo "Downloading library snapshot: https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz"
1037+
curl -L --retry "$NET_RETRY_COUNT" -o "${LIBRARY}-${GITHUB_SHA}.tar.gz" "https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz"
1038+
tar -xzf "${LIBRARY}-${GITHUB_SHA}.tar.gz"
1039+
if [ ! -d "${LIBRARY}-${GITHUB_SHA}" ]
1040+
then
1041+
echo "Library snapshot does not contain the library directory ${LIBRARY}-${GITHUB_SHA}:"
1042+
ls -la
1043+
exit 1
1044+
fi
1045+
rm -f "${LIBRARY}-${GITHUB_SHA}.tar.gz"
1046+
cd ..
1047+
1048+
git clone -b "$BOOST_BRANCH" --depth 1 "https://github.com/boostorg/boost.git" "boost-root"
1049+
cd boost-root
1050+
mkdir -p libs
1051+
rm -rf "libs/$LIBRARY"
1052+
mv -f "../snapshot/${LIBRARY}-${GITHUB_SHA}" "libs/$LIBRARY"
1053+
rm -rf "../snapshot"
1054+
git submodule update --init tools/boostdep
1055+
DEPINST_ARGS+=("$LIBRARY")
1056+
python3 --version
1057+
python3 tools/boostdep/depinst/depinst.py "${DEPINST_ARGS[@]}"
1058+
./bootstrap.sh
1059+
./b2 headers
1060+
1061+
if [ -n "${{matrix.compiler}}" -o -n "$GCC_TOOLCHAIN_ROOT" ]
1062+
then
1063+
echo -n "using ${{matrix.toolset}} : : ${{matrix.compiler}}" > ~/user-config.jam
1064+
if [ -n "$GCC_TOOLCHAIN_ROOT" ]
1065+
then
1066+
echo -n " : <compileflags>\"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\" <linkflags>\"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\"" >> ~/user-config.jam
1067+
fi
1068+
echo " ;" >> ~/user-config.jam
1069+
fi
1070+
1071+
# Run tests
1072+
${{matrix.toolset}} --version
1073+
B2_ARGS=("-j" "$BUILD_JOBS" "toolset=${{matrix.toolset}}" "cxxstd=${{matrix.cxxstd}}" "debug-symbols=off")
1074+
1075+
# Build variant
1076+
if [ -n "${{matrix.build_variant}}" ]
1077+
then
1078+
B2_ARGS+=("variant=${{matrix.build_variant}}")
1079+
else
1080+
B2_ARGS+=("variant=$DEFAULT_BUILD_VARIANT")
1081+
fi
1082+
1083+
# Threading
1084+
if [ -n "${{matrix.threading}}" ]
1085+
then
1086+
B2_ARGS+=("threading=${{matrix.threading}}")
1087+
fi
1088+
1089+
# UBSAN options
1090+
if [ -n "${{matrix.ubsan}}" ]
1091+
then
1092+
export UBSAN_OPTIONS="verbosity=1:print_stacktrace=1"
1093+
B2_ARGS+=("undefined-sanitizer=norecover" "define=UBSAN=1")
1094+
fi
1095+
1096+
# ASAN options
1097+
if [ -n "${{matrix.asan}}" ]
1098+
then
1099+
export ASAN_OPTIONS="verbosity=1:print_stacktrace=1"
1100+
B2_ARGS+=("address-sanitizer=norecover" "define=ASAN=1")
1101+
fi
1102+
1103+
# Common UBSAN / ASAN options
1104+
if [ -n "${{matrix.asan}}" ] || [ -n "${{matrix.ubsan}}" ]
1105+
then
1106+
B2_ARGS+=("debug-symbols=on" "visibility=global")
1107+
fi
1108+
1109+
# cxxflags
1110+
if [ -n "${{matrix.cxxflags}}" ]
1111+
then
1112+
B2_ARGS+=("cxxflags=${{matrix.cxxflags}}")
1113+
fi
1114+
1115+
# address-model
1116+
if [ -n "${{matrix.address-model}}" ]
1117+
then
1118+
B2_ARGS+=("address-model=${{matrix.address-model}}")
1119+
fi
1120+
1121+
# link-flags
1122+
if [ -n "${{matrix.linkflags}}" ]
1123+
then
1124+
B2_ARGS+=("linkflags=${{matrix.linkflags}}")
1125+
fi
1126+
1127+
B2_ARGS+=("libs/$LIBRARY/test")
1128+
./b2 "${B2_ARGS[@]}"
1129+

0 commit comments

Comments
 (0)