Skip to content

Add support for modular build structure. #36

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 12 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 127 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: GitHub Actions CI

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

jobs:
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: multi_array
scan-dirs: test
compilers: |
gcc >= 4.8
clang >= 3.5
msvc >= 14.0
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: ${{ fromJSON(needs.cpp-matrix.outputs.matrix) }}

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

steps:
# 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: |
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: Setup C++ Compiler
uses: alandefreitas/cpp-actions/setup-cpp@master
id: setup-cpp
with:
compiler: ${{ matrix.compiler }}
version: ${{ matrix.version }}

- name: Install Packages
if: matrix.install != ''
uses: alandefreitas/cpp-actions/package-install@master
id: package-install
with:
apt-get: ${{ matrix.install }}

- name: Clone Library
uses: actions/checkout@v4

- 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

- name: Copy Library
shell: bash
run: |
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: 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
30 changes: 30 additions & 0 deletions build.jam
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# 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/array//boost_array
/boost/assert//boost_assert
/boost/concept_check//boost_concept_check
/boost/config//boost_config
/boost/core//boost_core
/boost/functional//boost_functional
/boost/iterator//boost_iterator
/boost/mpl//boost_mpl
/boost/static_assert//boost_static_assert
/boost/type_traits//boost_type_traits ;

project /boost/multi_array
;

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

call-if : boost-library multi_array
;
6 changes: 4 additions & 2 deletions test/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

import testing ;

project : requirements <library>/boost/multi_array//boost_multi_array ;

compile-fail fail_cbracket.cpp ;
compile-fail fail_cdata.cpp ;
compile-fail fail_citerator.cpp ;
Expand All @@ -15,7 +17,7 @@ compile-fail fail_csubarray.cpp ;
compile-fail fail_csubarray2.cpp ;
compile-fail fail_csubarray3.cpp ;
compile-fail fail_cview.cpp ;
compile-fail fail_cview2.cpp ;
compile-fail fail_cview2.cpp : <library>/boost/test//included ;
compile-fail fail_cview3.cpp ;
compile-fail fail_ref_cbracket.cpp ;
compile-fail fail_ref_cdata.cpp ;
Expand All @@ -28,7 +30,7 @@ compile-fail fail_ref_csubarray3.cpp ;
compile-fail fail_ref_cview.cpp ;
compile-fail fail_ref_cview2.cpp ;
compile-fail fail_ref_cview3.cpp ;

run constructors.cpp ;
run access.cpp ;
run compare.cpp ;
Expand Down