Skip to content

Commit b09673b

Browse files
committed
Add Boost testing to CI
1 parent daedff5 commit b09673b

File tree

9 files changed

+250
-0
lines changed

9 files changed

+250
-0
lines changed

.github/scripts/boost/build.sh

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/bash
2+
3+
source `dirname ${BASH_SOURCE[0]}`/../config.sh
4+
5+
BOOST_BUILD_PATH=$BUILD_PATH/boost
6+
BOOST_SOURCE_PATH=$SOURCE_PATH/boost
7+
8+
mkdir -p $BOOST_BUILD_PATH
9+
cd $BOOST_BUILD_PATH
10+
11+
if [[ "$RUN_CONFIG" = 1 ]] || [[ ! -f "$BOOST_BUILD_PATH/Makefile" ]]; then
12+
echo "::group::Configure Boost"
13+
rm -rf $BOOST_BUILD_PATH/*
14+
15+
if [[ "$DEBUG" = 1 ]]; then
16+
HOST_OPTIONS=" \
17+
-DCMAKE_BUILD_TYPE=Debug"
18+
fi
19+
20+
# TODO: Install?
21+
# --target install \
22+
# -DCMAKE_INSTALL_PREFIX=$BOOST_PATH \
23+
24+
# TODO: Patch Boost modules to use -Wa,-mbig-obj instead of passing it here to all modules
25+
CXXFLAGS="-D_WIN32_WINNT=0x0A00 -Wno-error=attributes -Wno-attributes -Wa,-mbig-obj" \
26+
LINK_FLAGS="-static-libstdc++ -static-libgcc" \
27+
cmake \
28+
$BOOST_SOURCE_PATH \
29+
-DBUILD_TESTING=ON \
30+
-DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN_FILE \
31+
-DBOOST_CHARCONV_QUADMATH_FOUND_EXITCODE=0 \
32+
-DBOOST_CONTEXT_ARCHITECTURE=x86_64 \
33+
-DBOOST_CONTEXT_BINARY_FORMAT=pe \
34+
-DBOOST_CONTEXT_ABI=ms \
35+
$HOST_OPTIONS
36+
echo "::endgroup::"
37+
fi
38+
39+
echo "::group::Build Boost and its tests"
40+
cmake --build . --target tests-quick -- -k $BUILD_MAKE_OPTIONS
41+
echo "::endgroup::"
42+
43+
echo "::group::Make generated paths relative"
44+
# TODO: Is this needed? Why?
45+
sed -i '/^Build directory/d' "DartConfiguration.tcl"
46+
47+
find . -type f -name "CTestTestfile.cmake" | while IFS= read -r file
48+
do
49+
build_dir=$(cat "$file" | grep '# Build directory: ' | cut -f2 -d ':' | tr -d [:space:] | sed -E "s|($BOOST_BUILD_PATH/).*|\1|")
50+
if [ -n "$build_dir" ]; then
51+
sed -i "s|$build_dir|../../../|g" "$file"
52+
fi
53+
done
54+
echo "::endgroup::"
55+
56+
echo 'Success!'

.github/scripts/boost/checkout.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
source `dirname ${BASH_SOURCE[0]}`/../config.sh
4+
5+
BOOST_SOURCE_PATH=$SOURCE_PATH/boost
6+
7+
mkdir -p $BOOST_SOURCE_PATH
8+
9+
echo "::group::Checkout Boost"
10+
git clone --recurse-submodules --single-branch https://github.com/$BOOST_REPO.git -b $BOOST_BRANCH $BOOST_SOURCE_PATH
11+
cd $BOOST_SOURCE_PATH
12+
13+
# Add missing assembler files definition for GCC+Win+Aarch64 in Boost.Context
14+
pushd libs/context
15+
git checkout e4c91576d27c359f4b38a009409e5b611132de04
16+
popd
17+
18+
# Switch serialization to current (as of 3rd Feb 2025) develop to get fix for missing dependency
19+
# on filesystem library.
20+
# Error: undefined reference to `boost::filesystem::detail::path_traits::convert(...)
21+
pushd libs/serialization
22+
git checkout 8a8c62864f05732131bf6785d54466d8ac6cd477
23+
popd
24+
25+
# Unmerged fix: https://github.com/boostorg/thread/pull/408
26+
# Error: ../boost/thread/future.hpp:4671:19: error: ‘struct boost::detail::run_it<FutureExecutorContinuationSharedState>’ has no member named ‘that’; did you mean ‘that_’?
27+
pushd libs/thread
28+
git apply $ROOT_PATH/.github/scripts/boost/thread.patch
29+
popd
30+
echo "::endgroup::"
31+
32+
echo 'Success!'
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
source `dirname ${BASH_SOURCE[0]}`/../config.sh
4+
5+
echo "::group::Test Boost"
6+
pushd $BOOST_TESTS_PATH
7+
8+
tree
9+
10+
ctest $BUILD_MAKE_OPTIONS --output-on-failure --no-tests=error -R quick
11+
12+
popd
13+
echo "::endgroup::"
14+
15+
echo "Success!"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
source `dirname ${BASH_SOURCE[0]}`/../config.sh
4+
5+
BOOST_BUILD_PATH=$BUILD_PATH/boost
6+
7+
echo "::group::Pack Boost tests"
8+
mkdir -p $ARTIFACT_PATH
9+
cd $BOOST_BUILD_PATH
10+
zip -r $ARTIFACT_PATH/$TOOLCHAIN_NAME-boost-tests.zip * # TODO: ? --exclude src *.o *.d
11+
echo "::endgroup::"
12+
13+
echo 'Success!'

.github/scripts/boost/pack.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
source `dirname ${BASH_SOURCE[0]}`/../config.sh
4+
5+
echo "::group::Pack Boost"
6+
mkdir -p $ARTIFACT_PATH
7+
cd $BOOST_PATH
8+
zip -r $ARTIFACT_PATH/$TOOLCHAIN_NAME-boost.zip *
9+
echo "::endgroup::"
10+
11+
echo 'Success!'
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
. $PSScriptRoot\..\config.ps1
2+
3+
Write-Output "::group::Unpack Boost tests"
4+
Remove-Item $env:BOOST_TESTS_PATH -Recurse -Force -ErrorAction Ignore
5+
Set-PSDebug -Trace 0 # echo off
6+
Expand-Archive -LiteralPath $env:ARTIFACT_PATH\$env:TOOLCHAIN_NAME-boost-tests.zip -DestinationPath $env:BOOST_TESTS_PATH
7+
Write-Output "::endgroup::"
8+
9+
Write-Output 'Success!'

.github/scripts/config.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ if ( -not $env:OPENBLAS_TESTS_PATH ) { $env:OPENBLAS_TESTS_PATH = "$PWD\openblas
1616
if ( -not $env:OPENSSL_TESTS_PATH ) { $env:OPENSSL_TESTS_PATH = "$PWD\openssl-tests" }
1717
if ( -not $env:LIBJPEG_TURBO_TESTS_PATH ) { $env:LIBJPEG_TURBO_TESTS_PATH = "$PWD\libjpeg-turbo-tests" }
1818
if ( -not $env:FFMPEG_TESTS_PATH ) { $env:FFMPEG_TESTS_PATH = "$PWD\ffmpeg-tests" }
19+
if ( -not $env:BOOST_TESTS_PATH ) { $env:BOOST_TESTS_PATH = "$PWD\boost-tests" }
1920

2021
if ( -not $env:RUNTIME_PACKAGE_NAME ) { $env:RUNTIME_PACKAGE_NAME = "$env:TOOLCHAIN_NAME-runtime.tar.gz" }
2122
if ( -not $env:TESTS_PACKAGE_NAME ) { $env:TESTS_PACKAGE_NAME = "$env:TOOLCHAIN_NAME-tests.tar.gz" }

.github/scripts/config.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ FFMPEG_BRANCH=${FFMPEG_BRANCH:-release/6.1}
9292
FFMPEG_PATH=${FFMPEG_PATH:-~/ffmpeg}
9393
FFMPEG_TESTS_PATH=${FFMPEG_TESTS_PATH:-~/ffmpeg-tests}
9494

95+
BOOST_REPO=${BOOST_REPO:-boostorg/boost}
96+
BOOST_BRANCH=${BOOST_BRANCH:-boost-1.87.0}
97+
BOOST_PATH=${BOOST_PATH:-~/boost}
98+
BOOST_TESTS_PATH=${BOOST_TESTS_PATH:-~/boost-tests}
99+
95100
TESTS_PATH=${TESTS_PATH:-$ROOT_PATH/tests/build/bin/}
96101
TESTS_PACKAGE_NAME=${TESTS_PACKAGE_NAME:-$TOOLCHAIN_NAME-tests.tar.gz}
97102

.github/workflows/advanced.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,3 +1096,111 @@ jobs:
10961096
# shell: bash
10971097
# run: |
10981098
# .github/scripts/ffmpeg/execute-tests.sh
1099+
1100+
build-boost:
1101+
needs: [build-toolchain]
1102+
runs-on: ubuntu-latest
1103+
1104+
env:
1105+
BOOST_PATH: ${{ github.workspace }}/boost
1106+
1107+
steps:
1108+
- name: Checkout repository
1109+
uses: actions/checkout@v4
1110+
with:
1111+
path: ${{ github.workspace }}
1112+
1113+
- name: Checkout Boost
1114+
run: |
1115+
.github/scripts/boost/checkout.sh
1116+
1117+
- name: Extract cache keys
1118+
run: |
1119+
.github/scripts/extract-cache-keys.sh '${{ toJSON(needs.build-toolchain.outputs) }}'
1120+
1121+
- name: Download ${{ env.TOOLCHAIN_NAME }} toolchain
1122+
uses: actions/cache/restore@v4
1123+
with:
1124+
path: ${{ env.ARTIFACT_PATH }}/${{ env.TOOLCHAIN_PACKAGE_NAME }}
1125+
key: ${{ env.toolchain-cache-key }}
1126+
enableCrossOsArchive: true
1127+
fail-on-cache-miss: true
1128+
1129+
- name: Unpack toolchain
1130+
run: |
1131+
.github/scripts/toolchain/unpack.sh
1132+
1133+
- name: Build Boost
1134+
run: |
1135+
.github/scripts/boost/build.sh
1136+
1137+
- name: Pack Boost tests
1138+
run: |
1139+
.github/scripts/boost/pack-tests.sh
1140+
1141+
# - name: Upload artifact
1142+
# uses: actions/upload-artifact@v4
1143+
# with:
1144+
# name: ${{ env.TOOLCHAIN_NAME }}-boost
1145+
# path: ${{ env.ARTIFACT_PATH }}/${{ env.TOOLCHAIN_NAME }}-boost.zip
1146+
# retention-days: 3
1147+
1148+
- name: Upload tests artifact
1149+
uses: actions/upload-artifact@v4
1150+
with:
1151+
name: ${{ env.TOOLCHAIN_NAME }}-boost-tests
1152+
path: ${{ env.ARTIFACT_PATH }}/${{ env.TOOLCHAIN_NAME }}-boost-tests.zip
1153+
retention-days: 3
1154+
1155+
execute-boost-tests:
1156+
needs: [
1157+
build-toolchain,
1158+
build-boost
1159+
]
1160+
runs-on: [Windows, GCC, ARM64]
1161+
1162+
env:
1163+
BOOST_TESTS_PATH: ${{ github.workspace }}/boost-tests
1164+
1165+
steps:
1166+
- name: Checkout repository
1167+
uses: actions/checkout@v4
1168+
with:
1169+
path: ${{ github.workspace }}
1170+
1171+
- name: Install zstd
1172+
run: |
1173+
.github/scripts/install-zstd.ps1
1174+
1175+
- name: Extract cache keys
1176+
shell: bash
1177+
run: |
1178+
.github/scripts/extract-cache-keys.sh '${{ toJSON(needs.build-toolchain.outputs) }}'
1179+
1180+
- name: Download ${{ env.TOOLCHAIN_NAME }} runtime
1181+
uses: actions/cache/restore@v4
1182+
with:
1183+
path: ${{ env.RELATIVE_ARTIFACT_PATH }}/${{ env.RUNTIME_PACKAGE_NAME }}
1184+
key: ${{ env.runtime-cache-key }}
1185+
restore-keys: ${{ env.runtime-cache-key }}
1186+
enableCrossOsArchive: true
1187+
fail-on-cache-miss: true
1188+
1189+
- name: Download Boost tests
1190+
uses: actions/download-artifact@v4
1191+
with:
1192+
name: ${{ env.TOOLCHAIN_NAME }}-boost-tests
1193+
path: ${{ env.ARTIFACT_PATH }}
1194+
1195+
- name: Unpack ${{ env.TOOLCHAIN_NAME }} runtime
1196+
run: |
1197+
.github/scripts/toolchain/unpack-runtime.ps1
1198+
1199+
- name: Unpack Boost tests
1200+
run: |
1201+
.github/scripts/boost/unpack-tests.ps1
1202+
1203+
- name: Execute Boost tests
1204+
shell: bash
1205+
run: |
1206+
.github/scripts/boost/execute-tests.sh

0 commit comments

Comments
 (0)