@@ -635,3 +635,108 @@ jobs:
635635 cd __build_shared__
636636 cmake -DBUILD_SHARED_LIBS=On ../libs/%LIBRARY%/test/test_cmake
637637 cmake --build . --target boost_%LIBRARY%_cmake_self_test -j %NUMBER_OF_PROCESSORS%
638+
639+ MSYS2 :
640+ defaults :
641+ run :
642+ shell : msys2 {0}
643+ strategy :
644+ fail-fast : false
645+ matrix :
646+ include :
647+ - { sys: MINGW32, toolset: gcc, cxxstd: '11,17,20' }
648+ - { sys: MINGW64, toolset: gcc, cxxstd: '11,17,20' }
649+
650+ runs-on : windows-latest
651+
652+ steps :
653+ - name : Setup MSYS2 environment
654+ uses : msys2/setup-msys2@v2
655+ with :
656+ msystem : ${{matrix.sys}}
657+ update : true
658+ install : git python
659+ pacboy : gcc:p cmake:p ninja:p
660+
661+ - name : Setup Boost
662+ run : |
663+ echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
664+ LIBRARY=${GITHUB_REPOSITORY#*/}
665+ echo LIBRARY: $LIBRARY
666+ echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
667+ echo GITHUB_BASE_REF: $GITHUB_BASE_REF
668+ echo GITHUB_REF: $GITHUB_REF
669+ REF=${GITHUB_BASE_REF:-$GITHUB_REF}
670+ REF=${REF#refs/heads/}
671+ echo REF: $REF
672+ BOOST_BRANCH=develop && [ "$REF" = "master" ] && BOOST_BRANCH=master || true
673+ echo BOOST_BRANCH: $BOOST_BRANCH
674+ BUILD_JOBS=$((nproc || sysctl -n hw.ncpu) 2> /dev/null)
675+ echo "BUILD_JOBS=$BUILD_JOBS" >> $GITHUB_ENV
676+ echo "CMAKE_BUILD_PARALLEL_LEVEL=$BUILD_JOBS" >> $GITHUB_ENV
677+ mkdir -p snapshot
678+ cd snapshot
679+ echo "Downloading library snapshot: https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz"
680+ curl -L --retry "$NET_RETRY_COUNT" -o "${LIBRARY}-${GITHUB_SHA}.tar.gz" "https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz"
681+ tar -xf "${LIBRARY}-${GITHUB_SHA}.tar.gz"
682+ if [ ! -d "${LIBRARY}-${GITHUB_SHA}" ]
683+ then
684+ echo "Library snapshot does not contain the library directory ${LIBRARY}-${GITHUB_SHA}:"
685+ ls -la
686+ exit 1
687+ fi
688+ rm -f "${LIBRARY}-${GITHUB_SHA}.tar.gz"
689+ cd ..
690+ git clone -b "$BOOST_BRANCH" --depth 1 "https://github.com/boostorg/boost.git" "boost-root"
691+ cd boost-root
692+ mkdir -p libs
693+ rm -rf "libs/$LIBRARY"
694+ mv -f "../snapshot/${LIBRARY}-${GITHUB_SHA}" "libs/$LIBRARY"
695+ rm -rf "../snapshot"
696+ git submodule update --init tools/boostdep
697+ python tools/boostdep/depinst/depinst.py --git_args "--jobs $GIT_FETCH_JOBS" --include example "$LIBRARY"
698+ ./bootstrap.sh
699+ ./b2 headers
700+
701+ - name : Run tests
702+ run : |
703+ cd boost-root
704+ export BOOST_FILESYSTEM_TEST_WITH_EXAMPLES=1
705+ B2_ARGS=("-j" "$BUILD_JOBS" "toolset=${{matrix.toolset}}" "cxxstd=${{matrix.cxxstd}}")
706+ if [ -n "${{matrix.build_variant}}" ]
707+ then
708+ B2_ARGS+=("variant=${{matrix.build_variant}}")
709+ else
710+ B2_ARGS+=("variant=$DEFAULT_BUILD_VARIANT")
711+ fi
712+ if [ -n "${{matrix.threading}}" ]
713+ then
714+ B2_ARGS+=("threading=${{matrix.threading}}")
715+ fi
716+ if [ -n "${{matrix.ubsan}}" ]
717+ then
718+ export UBSAN_OPTIONS="print_stacktrace=1"
719+ B2_ARGS+=("cxxflags=-fsanitize=undefined -fno-sanitize-recover=undefined" "linkflags=-fsanitize=undefined -fuse-ld=gold" "define=UBSAN=1" "debug-symbols=on" "visibility=global")
720+ fi
721+ if [ -n "${{matrix.cxxflags}}" ]
722+ then
723+ B2_ARGS+=("cxxflags=${{matrix.cxxflags}}")
724+ fi
725+ if [ -n "${{matrix.linkflags}}" ]
726+ then
727+ B2_ARGS+=("linkflags=${{matrix.linkflags}}")
728+ fi
729+ B2_ARGS+=("libs/$LIBRARY/test")
730+ ./b2 "${B2_ARGS[@]}"
731+
732+ # Run also the CMake tests to avoid having to setup another matrix for CMake on MSYS
733+ - name : Run CMake tests
734+ run : |
735+ [ ! -d boost-root ] || cd boost-root
736+ mkdir __build_static__ && cd __build_static__
737+ cmake -DBUILD_SHARED_LIBS=OFF ../libs/$LIBRARY/test/test_cmake
738+ cmake --build . --target boost_${LIBRARY}_cmake_self_test -j $BUILD_JOBS
739+ cd ..
740+ mkdir __build_shared__ && cd __build_shared__
741+ cmake -DBUILD_SHARED_LIBS=ON ../libs/$LIBRARY/test/test_cmake
742+ cmake --build . --target boost_${LIBRARY}_cmake_self_test -j $BUILD_JOBS
0 commit comments