Skip to content

Commit 4b70bef

Browse files
committed
Added a Cygwin GitHub Actions job.
1 parent c172ae5 commit 4b70bef

1 file changed

Lines changed: 118 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,7 @@ jobs:
682682
- { sys: MINGW32, toolset: gcc, cxxstd: '11,17,20,23' }
683683
- { sys: MINGW64, toolset: gcc, cxxstd: '11,17,20,23' }
684684

685+
timeout-minutes: 30
685686
runs-on: windows-latest
686687

687688
steps:
@@ -775,3 +776,120 @@ jobs:
775776
mkdir __build_shared__ && cd __build_shared__
776777
cmake -DBUILD_SHARED_LIBS=ON ../libs/$LIBRARY/test/test_cmake
777778
cmake --build . --target boost_${LIBRARY}_cmake_self_test -j $BUILD_JOBS
779+
780+
cygwin:
781+
defaults:
782+
run:
783+
shell: bash
784+
785+
env:
786+
SHELLOPTS: igncr
787+
CYGWIN: winsymlinks:native
788+
789+
strategy:
790+
fail-fast: false
791+
matrix:
792+
include:
793+
- toolset: gcc
794+
cxxstd: "14-gnu,17-gnu,20-gnu,23-gnu"
795+
build_variant: debug
796+
797+
timeout-minutes: 30
798+
runs-on: windows-latest
799+
800+
steps:
801+
- name: Configure git
802+
run: |
803+
git config --global core.autocrlf input
804+
805+
- name: Install Cygwin
806+
uses: cygwin/cygwin-install-action@v6
807+
with:
808+
packages:
809+
gcc-g++
810+
cmake
811+
812+
- name: Setup Boost
813+
run: |
814+
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
815+
LIBRARY=${GITHUB_REPOSITORY#*/}
816+
echo LIBRARY: $LIBRARY
817+
echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
818+
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
819+
echo GITHUB_REF: $GITHUB_REF
820+
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
821+
REF=${REF#refs/heads/}
822+
echo REF: $REF
823+
BOOST_BRANCH=develop && [ "$REF" = "master" ] && BOOST_BRANCH=master || true
824+
echo BOOST_BRANCH: $BOOST_BRANCH
825+
BUILD_JOBS=$((nproc) 2> /dev/null)
826+
echo "BUILD_JOBS=$BUILD_JOBS" >> $GITHUB_ENV
827+
echo "CMAKE_BUILD_PARALLEL_LEVEL=$BUILD_JOBS" >> $GITHUB_ENV
828+
DEPINST_ARGS=("--git_args" "--jobs $GIT_FETCH_JOBS")
829+
mkdir -p snapshot
830+
cd snapshot
831+
echo "Downloading library snapshot: https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz"
832+
curl -L --retry "$NET_RETRY_COUNT" -o "${LIBRARY}-${GITHUB_SHA}.tar.gz" "https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz"
833+
tar -xf "${LIBRARY}-${GITHUB_SHA}.tar.gz"
834+
if [ ! -d "${LIBRARY}-${GITHUB_SHA}" ]
835+
then
836+
echo "Library snapshot does not contain the library directory ${LIBRARY}-${GITHUB_SHA}:"
837+
ls -la
838+
exit 1
839+
fi
840+
rm -f "${LIBRARY}-${GITHUB_SHA}.tar.gz"
841+
cd ..
842+
git clone -b "$BOOST_BRANCH" --depth 1 "https://github.com/boostorg/boost.git" "boost-root"
843+
cd boost-root
844+
mkdir -p libs
845+
rm -rf "libs/$LIBRARY"
846+
mv -f "../snapshot/${LIBRARY}-${GITHUB_SHA}" "libs/$LIBRARY"
847+
rm -rf "../snapshot"
848+
git submodule update --init tools/boostdep
849+
DEPINST_ARGS+=("$LIBRARY")
850+
python tools/boostdep/depinst/depinst.py "${DEPINST_ARGS[@]}"
851+
./bootstrap.sh
852+
./b2 -d0 headers
853+
854+
- name: Run tests
855+
run: |
856+
cd boost-root
857+
export BOOST_FILESYSTEM_TEST_WITH_EXAMPLES=1
858+
B2_ARGS=("-j" "$BUILD_JOBS" "toolset=${{matrix.toolset}}" "cxxstd=${{matrix.cxxstd}}")
859+
if [ -n "${{matrix.build_variant}}" ]
860+
then
861+
B2_ARGS+=("variant=${{matrix.build_variant}}")
862+
else
863+
B2_ARGS+=("variant=$DEFAULT_BUILD_VARIANT")
864+
fi
865+
if [ -n "${{matrix.threading}}" ]
866+
then
867+
B2_ARGS+=("threading=${{matrix.threading}}")
868+
fi
869+
if [ -n "${{matrix.ubsan}}" ]
870+
then
871+
export UBSAN_OPTIONS="print_stacktrace=1"
872+
B2_ARGS+=("cxxflags=-fsanitize=undefined -fno-sanitize-recover=undefined" "linkflags=-fsanitize=undefined -fuse-ld=gold" "define=UBSAN=1" "debug-symbols=on" "visibility=global")
873+
fi
874+
if [ -n "${{matrix.cxxflags}}" ]
875+
then
876+
B2_ARGS+=("cxxflags=${{matrix.cxxflags}}")
877+
fi
878+
if [ -n "${{matrix.linkflags}}" ]
879+
then
880+
B2_ARGS+=("linkflags=${{matrix.linkflags}}")
881+
fi
882+
B2_ARGS+=("libs/$LIBRARY/test")
883+
./b2 "${B2_ARGS[@]}"
884+
885+
# Run also the CMake tests to avoid having to setup another matrix for CMake on Cygwin
886+
- name: Run CMake tests
887+
run: |
888+
[ ! -d boost-root ] || cd boost-root
889+
mkdir __build_static__ && cd __build_static__
890+
cmake -DBUILD_SHARED_LIBS=OFF ../libs/$LIBRARY/test/test_cmake
891+
cmake --build . --target boost_${LIBRARY}_cmake_self_test -j $BUILD_JOBS
892+
cd ..
893+
mkdir __build_shared__ && cd __build_shared__
894+
cmake -DBUILD_SHARED_LIBS=ON ../libs/$LIBRARY/test/test_cmake
895+
cmake --build . --target boost_${LIBRARY}_cmake_self_test -j $BUILD_JOBS

0 commit comments

Comments
 (0)