Skip to content

Commit

Permalink
Add the windows-b2-install job to ci.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
pdimov committed Nov 7, 2024
1 parent c7dd648 commit ba23a3d
Show file tree
Hide file tree
Showing 315 changed files with 123,628 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -441,3 +441,54 @@ jobs:
cmake --build . --config Release
PATH C:\cmake-prefix\bin;%PATH%
ctest --output-on-failure --no-tests=error -C Release
windows-b2-install:
strategy:
fail-fast: false
matrix:
os: windows-latest

runs-on: ${{matrix.os}}

steps:
- uses: actions/checkout@v4

- name: Setup Boost
shell: cmd
run: |
echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY%
for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi
echo LIBRARY: %LIBRARY%
echo LIBRARY=%LIBRARY%>>%GITHUB_ENV%
echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
echo GITHUB_REF: %GITHUB_REF%
if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
set BOOST_BRANCH=develop
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
echo BOOST_BRANCH: %BOOST_BRANCH%
cd ..
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\
git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY%
cmd /c bootstrap
b2 -d0 headers
- name: Run tests
shell: cmd
run: |
echo on
cd ../boost-root
set ZLIB_SOURCE=%CD%\libs\iostreams\test\zlib-1.2.11
set BZIP2_SOURCE=%CD%\libs\iostreams\test\bzip2-1.0.8
b2 -d0 -j3 --prefix=%GITHUB_WORKSPACE%\..\.local --with-headers install
b2 -j3 --prefix=%GITHUB_WORKSPACE%\..\.local --with-iostreams install
cd libs\iostreams\test\b2_install_test
mkdir __build__ && cd __build__
cmake -DCMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%\..\.local -DBoost_VERBOSE=ON ..
PATH %PATH%;%GITHUB_WORKSPACE%\..\.local\lib;%GITHUB_WORKSPACE%\..\boost-root\stage\lib
cmake --build . --config Debug && cmake --build . --config Debug --target check
cmake --build . --config Release && cmake --build . --config Release --target check
cmake --build . --config MinSizeRel && cmake --build . --config MinSizeRel --target check
cmake --build . --config RelWithDebInfo && cmake --build . --config RelWithDebInfo --target check
25 changes: 25 additions & 0 deletions test/b2_install_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2018, 2019, 2021 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt

cmake_minimum_required(VERSION 3.5...3.16)

project(boost_iostreams_install_test LANGUAGES CXX)

if(BOOST_RUNTIME_LINK STREQUAL "static")
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()

find_package(boost_iostreams REQUIRED)

add_executable(test_gzip test_gzip.cpp)
target_link_libraries(test_gzip Boost::iostreams)

add_executable(test_bzip2 test_bzip2.cpp)
target_link_libraries(test_bzip2 Boost::iostreams)

enable_testing()
add_test(NAME test_gzip COMMAND test_gzip WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
add_test(NAME test_bzip2 COMMAND test_bzip2 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})

add_custom_target(check VERBATIM COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure --no-tests=error -C $<CONFIG>)
Binary file added test/b2_install_test/test.txt.bz2
Binary file not shown.
Binary file added test/b2_install_test/test.txt.gz
Binary file not shown.
29 changes: 29 additions & 0 deletions test/b2_install_test/test_bzip2.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

// Copyright 2019 Peter Dimov.
//
// Distributed under the Boost Software License, Version 1.0.
//
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt

#include <boost/iostreams/device/file.hpp>
#include <boost/iostreams/filter/bzip2.hpp>
#include <boost/iostreams/device/back_inserter.hpp>
#include <boost/iostreams/copy.hpp>
#include <boost/iostreams/compose.hpp>
#include <boost/core/lightweight_test.hpp>

namespace io = boost::iostreams;

int main()
{
io::file_source fs( "test.txt.bz2", std::ios_base::binary );
io::bzip2_decompressor gz;

std::string s;
io::copy( io::compose( gz, fs ), io::back_inserter( s ) );

BOOST_TEST( s == "=== reference output ===" );

return boost::report_errors();
}
29 changes: 29 additions & 0 deletions test/b2_install_test/test_gzip.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

// Copyright 2019 Peter Dimov.
//
// Distributed under the Boost Software License, Version 1.0.
//
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt

#include <boost/iostreams/device/file.hpp>
#include <boost/iostreams/filter/gzip.hpp>
#include <boost/iostreams/device/back_inserter.hpp>
#include <boost/iostreams/copy.hpp>
#include <boost/iostreams/compose.hpp>
#include <boost/core/lightweight_test.hpp>

namespace io = boost::iostreams;

int main()
{
io::file_source fs( "test.txt.gz", std::ios_base::binary );
io::gzip_decompressor gz;

std::string s;
io::copy( io::compose( gz, fs ), io::back_inserter( s ) );

BOOST_TEST( s == "=== reference output ===" );

return boost::report_errors();
}
Loading

0 comments on commit ba23a3d

Please sign in to comment.