Skip to content

Add support for modular build structure. #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
267 changes: 104 additions & 163 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,186 +1,127 @@
name: CI
name: GitHub Actions CI

on:
pull_request:
push:
branches:
- master
- develop
- githubactions*
- feature/**
- fix/**
- pr/**

jobs:
posix:
cpp-matrix:
runs-on: ubuntu-latest
name: Generate Test Matrix
outputs:
matrix: ${{ steps.cpp-matrix.outputs.matrix }}
steps:
- name: Generate Test Matrix
uses: alandefreitas/cpp-actions/cpp-matrix@master
id: cpp-matrix
with:
extra-values: |
boost-lib: io
scan-dirs: test
compilers: |
gcc >= 4.8
clang >= 3.5
msvc >= 14.1
apple-clang *
mingw *
clang-cl *
standards: ">=11"
latest-factors: |
gcc Asan TSan UBSan
clang BoundsSan IntSan
factors: |
gcc Shared
msvc Shared x86
mingw Shared
subrange-policy: |
msvc: one-per-minor
trace-commands: true
build:
needs: cpp-matrix
strategy:
fail-fast: false
matrix:
include:
- toolset: gcc-4.8
standard: "03,11"
os: ubuntu-18.04
install: g++-4.8
- toolset: gcc-5
standard: "03,11,14,1z"
os: ubuntu-18.04
install: g++-5
- toolset: gcc-6
standard: "03,11,14,1z"
os: ubuntu-18.04
install: g++-6
- toolset: gcc-7
standard: "03,11,14,17"
os: ubuntu-18.04
- toolset: gcc-8
standard: "03,11,14,17,2a"
os: ubuntu-18.04
install: g++-8
- toolset: gcc-9
standard: "03,11,14,17,2a"
os: ubuntu-18.04
- toolset: gcc-10
standard: "03,11,14,17,2a"
os: ubuntu-20.04
install: g++-10
- toolset: gcc-11
standard: "03,11,14,17,2a"
os: ubuntu-20.04
install: g++-11
- toolset: clang
compiler: clang++-3.9
standard: "03,11,14"
os: ubuntu-18.04
install: clang-3.9
- toolset: clang
compiler: clang++-4.0
standard: "03,11,14"
os: ubuntu-18.04
install: clang-4.0
- toolset: clang
compiler: clang++-5.0
standard: "03,11,14,1z"
os: ubuntu-18.04
install: clang-5.0
- toolset: clang
compiler: clang++-6.0
standard: "03,11,14,17"
os: ubuntu-18.04
install: clang-6.0
- toolset: clang
compiler: clang++-7
standard: "03,11,14,17"
os: ubuntu-18.04
install: clang-7
- toolset: clang
compiler: clang++-8
standard: "03,11,14,17"
os: ubuntu-20.04
install: clang-8
- toolset: clang
compiler: clang++-9
standard: "03,11,14,17,2a"
os: ubuntu-20.04
install: clang-9
- toolset: clang
compiler: clang++-10
standard: "03,11,14,17,2a"
os: ubuntu-20.04
install: clang-10
- toolset: clang
compiler: clang++-11
cxxstd: "03,11,14,17,2a"
os: ubuntu-20.04
install: clang-11
- toolset: clang
compiler: clang++-12
cxxstd: "03,11,14,17,2a"
os: ubuntu-20.04
install: clang-12
- toolset: clang
standard: "03,11,14,17,2a"
os: macos-10.15
include: ${{ fromJSON(needs.cpp-matrix.outputs.matrix) }}

runs-on: ${{matrix.os}}
# use matrix entries
name: ${{ matrix.name }}
runs-on: ${{ matrix.runs-on }}
container: ${{ matrix.container }}

steps:
- uses: actions/checkout@v2

- name: Install packages
if: matrix.install
run: sudo apt install ${{matrix.install}}

- name: Setup Boost
# GitHub Actions no longer support older containers.
# The workaround is to install our own Node.js for the actions.
- name: Patch Node
# The containers that need Node.js 20 will have volumes set up so that
# the Node.js 20 installation can go there.
if: ${{ matrix.container.volumes }}
run: |
cd ..
git clone --depth 1 https://github.com/boostorg/boost
cd boost
cp -r $GITHUB_WORKSPACE/* libs/io
git submodule init libs/assert
git submodule init libs/config
git submodule init libs/core
git submodule init libs/headers
git submodule init libs/type_traits
git submodule init tools/build
git submodule init tools/boost_install
git submodule update
./bootstrap.sh
./b2 -d0 headers
set -x
apt-get update
apt-get install -y curl xz-utils
curl -LO https://archives.boost.io/misc/node/node-v20.9.0-linux-x64-glibc-217.tar.xz
tar -xf node-v20.9.0-linux-x64-glibc-217.tar.xz --strip-components 1 -C /node20217
ldd /__e/node20/bin/node

- name: Create user-config.jam
if: matrix.compiler
run: |
echo "using ${{matrix.toolset}} : : ${{matrix.compiler}} ;" > ~/user-config.jam
- name: Setup C++ Compiler
uses: alandefreitas/cpp-actions/setup-cpp@master
id: setup-cpp
with:
compiler: ${{ matrix.compiler }}
version: ${{ matrix.version }}

- name: Run tests
run: |
cd ../boost
./b2 -j3 libs/io/test toolset=${{matrix.toolset}} cxxstd=${{matrix.standard}} variant=debug,release
- name: Install Packages
if: matrix.install != ''
uses: alandefreitas/cpp-actions/package-install@master
id: package-install
with:
apt-get: ${{ matrix.install }}

windows:
strategy:
fail-fast: false
matrix:
include:
- toolset: msvc-14.1
standard: "14,17,latest"
target: 32,64
os: windows-2016
- toolset: msvc-14.2
standard: "14,17,latest"
target: 32,64
os: windows-2019
- toolset: msvc-14.3
cxxstd: "14,17,latest"
addrmd: 32,64
os: windows-2022
- toolset: gcc
standard: "03,11,14,17,2a"
target: 64
os: windows-2019
- name: Clone Library
uses: actions/checkout@v4

runs-on: ${{matrix.os}}
- name: Clone Boost
uses: alandefreitas/cpp-actions/boost-clone@master
id: boost-clone
with:
branch: ${{ (github.ref_name == 'master' && github.ref_name) || 'develop' }}
boost-dir: ../boost-root
scan-modules-dir: .
scan-modules-ignore: ${{ matrix.boost-lib }}
modules-scan-paths: ${{ matrix.scan-dirs }}
cache: false

steps:
- uses: actions/checkout@v2

- name: Setup Boost
shell: cmd
- name: Copy Library
shell: bash
run: |
cd ..
git clone --depth 1 https://github.com/boostorg/boost boost
cd boost
xcopy /s /e /q %GITHUB_WORKSPACE% libs\io\
git submodule init libs/assert
git submodule init libs/config
git submodule init libs/core
git submodule init libs/static_assert
git submodule init libs/type_traits
git submodule init libs/headers
git submodule init tools/build
git submodule init tools/boost_install
git submodule update
cmd /c bootstrap
b2 -d0 headers
workspace_root=$(echo "$GITHUB_WORKSPACE" | sed 's/\\/\//g')
cd ../boost-root
rm -rf "libs/${{ matrix.boost-lib }}"
mkdir "libs/${{ matrix.boost-lib }}"
cp -r "$workspace_root"/* "libs/${{ matrix.boost-lib }}"

- name: Run tests
shell: cmd
run: |
cd ../boost
b2 -j3 libs/io/test toolset=${{matrix.toolset}} cxxstd=${{matrix.standard}} address-model=${{matrix.target}} variant=debug,release
- name: B2 Workflow
uses: alandefreitas/cpp-actions/b2-workflow@master
with:
source-dir: ${{ steps.boost-clone.outputs.boost-dir }}
modules: ${{ matrix.boost-lib }}
toolset: ${{ matrix.b2-toolset }}
build-variant: ${{ matrix.build-type }}
cxx: ${{ steps.setup-cpp.outputs.cxx || '' }}
cxxstd: ${{ matrix.cxxstd }}
address-model: ${{ matrix.address-model }}
asan: ${{ matrix.asan }}
ubsan: ${{ matrix.ubsan }}
tsan: ${{ matrix.tsan }}
shared: ${{ matrix.shared }}
abbreviate-paths: false
hash: true
debug-configuration: true
trace-commands: true
21 changes: 21 additions & 0 deletions build.jam
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright René Ferdinand Rivera Morell 2023-2024
# 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)

require-b2 5.2 ;

constant boost_dependencies :
/boost/config//boost_config ;

project /boost/io
;

explicit
[ alias boost_io : : :
: <include>include <library>$(boost_dependencies) ]
[ alias all : boost_io test ]
;

call-if : boost-library io
;
5 changes: 4 additions & 1 deletion test/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@

import testing ;

project : requirements <warnings>pedantic <warnings-as-errors>on ;
project : requirements <warnings>pedantic <warnings-as-errors>on
<library>/boost/core//boost_core
<library>/boost/type_traits//boost_type_traits
;

run ios_state_unit_test.cpp ;
run ios_state_test.cpp ;
Expand Down