From ac94c483e5b936d5bfcf025832c449ffeb9f86b8 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Sun, 25 Aug 2024 17:37:13 +0200 Subject: [PATCH 1/4] Add CI jobs for MinGW32/64 --- .github/workflows/ci.yml | 56 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 903b580a0..d7dfafd64 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -635,3 +635,59 @@ jobs: cd __build_shared__ cmake -DBUILD_SHARED_LIBS=On ../libs/%LIBRARY%/test/test_cmake cmake --build . --target boost_%LIBRARY%_cmake_self_test -j %NUMBER_OF_PROCESSORS% + + MSYS2: + defaults: + run: + shell: msys2 {0} + strategy: + fail-fast: false + matrix: + include: + - { sys: MINGW32, compiler: gcc, cxxstd: '03,11,17,20' } + - { sys: MINGW64, compiler: gcc, cxxstd: '03,11,17,20' } + + runs-on: windows-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup MSYS2 environment + uses: msys2/setup-msys2@v2 + with: + msystem: ${{matrix.sys}} + update: true + install: git python + pacboy: gcc:p cmake:p ninja:p + + - name: Fetch Boost.CI + uses: actions/checkout@v4 + with: + repository: boostorg/boost-ci + ref: master + path: boost-ci-cloned + - name: Get CI scripts folder + run: | + # Copy ci folder if not testing Boost.CI + [[ "$GITHUB_REPOSITORY" =~ "boost-ci" ]] || cp -r boost-ci-cloned/ci . + rm -rf boost-ci-cloned + + - name: Setup Boost + env: + B2_COMPILER: ${{matrix.compiler}} + B2_CXXSTD: ${{matrix.cxxstd}} + B2_SANITIZE: ${{matrix.sanitize}} + B2_STDLIB: ${{matrix.stdlib}} + run: ci/github/install.sh + + - name: Run tests + run: ci/build.sh + + # Run also the CMake tests to avoid having to setup another matrix for CMake on MSYS + - name: Run CMake tests + run: | + cd "$BOOST_ROOT" + mkdir __build_cmake_test__ && cd __build_cmake_test__ + cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DBOOST_INCLUDE_LIBRARIES=$SELF -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=ON -DBoost_VERBOSE=ON .. + cmake --build . --target tests --config Debug -j$B2_JOBS + ctest --output-on-failure --build-config Debug From 3f26465afb0f306e2a39f8edd7db83dbc3847c77 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Sun, 25 Aug 2024 18:53:00 +0200 Subject: [PATCH 2/4] Remove C++03 build --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d7dfafd64..16553b3ac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -644,8 +644,8 @@ jobs: fail-fast: false matrix: include: - - { sys: MINGW32, compiler: gcc, cxxstd: '03,11,17,20' } - - { sys: MINGW64, compiler: gcc, cxxstd: '03,11,17,20' } + - { sys: MINGW32, compiler: gcc, cxxstd: '11,17,20' } + - { sys: MINGW64, compiler: gcc, cxxstd: '11,17,20' } runs-on: windows-latest From f1bf0e01e275148d30a2564856c18bd9def74b58 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Sun, 25 Aug 2024 18:41:01 +0200 Subject: [PATCH 3/4] Fix build on MinGW-w64 x86 32 bit version of MinGW-64 __MINGW64__ is not defined --- test/issues/reparse_tag_file_placeholder.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/issues/reparse_tag_file_placeholder.cpp b/test/issues/reparse_tag_file_placeholder.cpp index fbf7bf3f3..a305f4368 100644 --- a/test/issues/reparse_tag_file_placeholder.cpp +++ b/test/issues/reparse_tag_file_placeholder.cpp @@ -27,7 +27,7 @@ // Test correct boost::filesystem::status when reparse point ReparseTag set to IO_REPARSE_TAG_FILE_PLACEHOLDER // https://docs.microsoft.com/en-us/windows/compatibility/placeholder-files?redirectedfrom=MSDN -#if !defined(__MINGW32__) || defined(__MINGW64__) +// from ntifs.h, which can only be used by drivers typedef struct _REPARSE_DATA_BUFFER { ULONG ReparseTag; @@ -58,7 +58,6 @@ typedef struct _REPARSE_DATA_BUFFER } GenericReparseBuffer; }; } REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER; -#endif #ifndef IO_REPARSE_TAG_FILE_PLACEHOLDER #define IO_REPARSE_TAG_FILE_PLACEHOLDER (0x80000015L) From 51b6ae06a662c79d34a2208fc805819f2590b70a Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Sun, 25 Aug 2024 18:52:15 +0200 Subject: [PATCH 4/4] Remove actions/checkout and Boost.CI --- .github/workflows/ci.yml | 105 ++++++++++++++++++++++++++++----------- 1 file changed, 77 insertions(+), 28 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 16553b3ac..eb135b6aa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -644,14 +644,12 @@ jobs: fail-fast: false matrix: include: - - { sys: MINGW32, compiler: gcc, cxxstd: '11,17,20' } - - { sys: MINGW64, compiler: gcc, cxxstd: '11,17,20' } + - { sys: MINGW32, toolset: gcc, cxxstd: '11,17,20' } + - { sys: MINGW64, toolset: gcc, cxxstd: '11,17,20' } runs-on: windows-latest steps: - - uses: actions/checkout@v4 - - name: Setup MSYS2 environment uses: msys2/setup-msys2@v2 with: @@ -660,34 +658,85 @@ jobs: install: git python pacboy: gcc:p cmake:p ninja:p - - name: Fetch Boost.CI - uses: actions/checkout@v4 - with: - repository: boostorg/boost-ci - ref: master - path: boost-ci-cloned - - name: Get CI scripts folder - run: | - # Copy ci folder if not testing Boost.CI - [[ "$GITHUB_REPOSITORY" =~ "boost-ci" ]] || cp -r boost-ci-cloned/ci . - rm -rf boost-ci-cloned - - name: Setup Boost - env: - B2_COMPILER: ${{matrix.compiler}} - B2_CXXSTD: ${{matrix.cxxstd}} - B2_SANITIZE: ${{matrix.sanitize}} - B2_STDLIB: ${{matrix.stdlib}} - run: ci/github/install.sh + run: | + echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY + LIBRARY=${GITHUB_REPOSITORY#*/} + echo LIBRARY: $LIBRARY + echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV + echo GITHUB_BASE_REF: $GITHUB_BASE_REF + echo GITHUB_REF: $GITHUB_REF + REF=${GITHUB_BASE_REF:-$GITHUB_REF} + REF=${REF#refs/heads/} + echo REF: $REF + BOOST_BRANCH=develop && [ "$REF" = "master" ] && BOOST_BRANCH=master || true + echo BOOST_BRANCH: $BOOST_BRANCH + BUILD_JOBS=$((nproc || sysctl -n hw.ncpu) 2> /dev/null) + echo "BUILD_JOBS=$BUILD_JOBS" >> $GITHUB_ENV + echo "CMAKE_BUILD_PARALLEL_LEVEL=$BUILD_JOBS" >> $GITHUB_ENV + mkdir -p snapshot + cd snapshot + echo "Downloading library snapshot: https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz" + curl -L --retry "$NET_RETRY_COUNT" -o "${LIBRARY}-${GITHUB_SHA}.tar.gz" "https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz" + tar -xf "${LIBRARY}-${GITHUB_SHA}.tar.gz" + if [ ! -d "${LIBRARY}-${GITHUB_SHA}" ] + then + echo "Library snapshot does not contain the library directory ${LIBRARY}-${GITHUB_SHA}:" + ls -la + exit 1 + fi + rm -f "${LIBRARY}-${GITHUB_SHA}.tar.gz" + cd .. + git clone -b "$BOOST_BRANCH" --depth 1 "https://github.com/boostorg/boost.git" "boost-root" + cd boost-root + mkdir -p libs + rm -rf "libs/$LIBRARY" + mv -f "../snapshot/${LIBRARY}-${GITHUB_SHA}" "libs/$LIBRARY" + rm -rf "../snapshot" + git submodule update --init tools/boostdep + python tools/boostdep/depinst/depinst.py --git_args "--jobs $GIT_FETCH_JOBS" --include example "$LIBRARY" + ./bootstrap.sh + ./b2 headers - name: Run tests - run: ci/build.sh + run: | + cd boost-root + export BOOST_FILESYSTEM_TEST_WITH_EXAMPLES=1 + B2_ARGS=("-j" "$BUILD_JOBS" "toolset=${{matrix.toolset}}" "cxxstd=${{matrix.cxxstd}}") + if [ -n "${{matrix.build_variant}}" ] + then + B2_ARGS+=("variant=${{matrix.build_variant}}") + else + B2_ARGS+=("variant=$DEFAULT_BUILD_VARIANT") + fi + if [ -n "${{matrix.threading}}" ] + then + B2_ARGS+=("threading=${{matrix.threading}}") + fi + if [ -n "${{matrix.ubsan}}" ] + then + export UBSAN_OPTIONS="print_stacktrace=1" + B2_ARGS+=("cxxflags=-fsanitize=undefined -fno-sanitize-recover=undefined" "linkflags=-fsanitize=undefined -fuse-ld=gold" "define=UBSAN=1" "debug-symbols=on" "visibility=global") + fi + if [ -n "${{matrix.cxxflags}}" ] + then + B2_ARGS+=("cxxflags=${{matrix.cxxflags}}") + fi + if [ -n "${{matrix.linkflags}}" ] + then + B2_ARGS+=("linkflags=${{matrix.linkflags}}") + fi + B2_ARGS+=("libs/$LIBRARY/test") + ./b2 "${B2_ARGS[@]}" # Run also the CMake tests to avoid having to setup another matrix for CMake on MSYS - name: Run CMake tests run: | - cd "$BOOST_ROOT" - mkdir __build_cmake_test__ && cd __build_cmake_test__ - cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DBOOST_INCLUDE_LIBRARIES=$SELF -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=ON -DBoost_VERBOSE=ON .. - cmake --build . --target tests --config Debug -j$B2_JOBS - ctest --output-on-failure --build-config Debug + [ ! -d boost-root ] || cd boost-root + mkdir __build_static__ && cd __build_static__ + cmake -DBUILD_SHARED_LIBS=OFF ../libs/$LIBRARY/test/test_cmake + cmake --build . --target boost_${LIBRARY}_cmake_self_test -j $BUILD_JOBS + cd .. + mkdir __build_shared__ && cd __build_shared__ + cmake -DBUILD_SHARED_LIBS=ON ../libs/$LIBRARY/test/test_cmake + cmake --build . --target boost_${LIBRARY}_cmake_self_test -j $BUILD_JOBS