Skip to content

Merge pull request #235 from cppalliance/int128 #450

Merge pull request #235 from cppalliance/int128

Merge pull request #235 from cppalliance/int128 #450

Workflow file for this run

#
# Copyright 2020-2021 Peter Dimov
# Copyright 2021 Andrey Semashev
# Copyright 2021-2024 Alexander Grund
# Copyright 2022-2025 James E. King III
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
#
# This workflow uses the Boost.CI reusable workflow which builds a variety of
# configurations of your project, runs tests, and generates code coverage reports.
#
# To use it, copy this file into your repository as `.github/workflows/ci.yml` and
# customize it appropriately.
#
---
name: Boost.CI
on:
pull_request:
push:
branches:
- master
- develop
- bugfix/**
- feature/**
- fix/**
- github/**
- pr/**
paths-ignore:
- LICENSE
- meta/**
- README.md
jobs:
call-boost-ci:
name: Run Boost.CI
uses: boostorg/boost-ci/.github/workflows/reusable.yml@master
with:
exclude_compiler: 'clang-3.5,clang-3.6,clang-3.7,clang-3.8,clang-3.9,clang-4.0,clang-5.0,clang-6.0,clang-7,
clang-8,clang-9,clang-10,clang-11,clang-12,
gcc-4.7,gcc-4.8,gcc-4.9,gcc-5,gcc-6,gcc-7,gcc-8,gcc-9,gcc-10'
enable_mingw: false # We blow the stack on the 32-bit with the library
# Example of customization:
# with:
# enable_reflection: true
# enable_windows: false
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
cuda-cmake-test:
strategy:
fail-fast: false
runs-on: gpu-runner-1
steps:
- uses: Jimver/cuda-toolkit@v0.2.35
id: cuda-toolkit
with:
cuda: '12.8.0'
method: 'network'
sub-packages: '["nvcc"]'
- name: Output CUDA information
run: |
echo "Installed cuda version is: ${{steps.cuda-toolkit.outputs.cuda}}"+
echo "Cuda install location: ${{steps.cuda-toolkit.outputs.CUDA_PATH}}"
nvcc -V
- uses: actions/checkout@v5
- name: Install Packages
run: |
sudo apt-get install -y cmake make
- name: Setup Boost
run: |
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
LIBRARY=${GITHUB_REPOSITORY#*/}
echo LIBRARY: $LIBRARY
echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
echo GITHUB_REF: $GITHUB_REF
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
REF=${REF#refs/heads/}
echo REF: $REF
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
echo BOOST_BRANCH: $BOOST_BRANCH
cd ..
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
mkdir -p libs/$LIBRARY
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
git submodule update --init tools/boostdep
python3 tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY
- name: Test C++20
run: |
for std in 20; do
echo "======== Testing C++${std} ========"
cd ../boost-root
rm -rf __build__
mkdir __build__ && cd __build__
cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DBUILD_TESTING=ON -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc -DBOOST_SAFE_NUMBERS_ENABLE_CUDA=1 -DCMAKE_CUDA_ARCHITECTURES="75;86" -DCMAKE_CUDA_STANDARD=${std} ..
cmake --build . --target tests -j $(nproc)
ctest -V --no-tests=error
cd $GITHUB_WORKSPACE
done
compile-time-checks:
name: Compile-time checks (GCC)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup Boost
run: |
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
LIBRARY=${GITHUB_REPOSITORY#*/}
echo LIBRARY: $LIBRARY
echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
echo GITHUB_REF: $GITHUB_REF
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
REF=${REF#refs/heads/}
echo REF: $REF
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
echo BOOST_BRANCH: $BOOST_BRANCH
cd ..
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
mkdir -p libs/$LIBRARY
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
git submodule update --init tools/boostdep
python3 tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY
./bootstrap.sh
./b2 headers
# The dedicated tests force optimization + the feature define per target, so they
# exercise the checks regardless of the global toggle: the compile_fail_ca_* files
# must fail to compile (the check fires) and the compile_ca_* files must compile
# (the value policies are not over-fired). GCC is the reference toolset.
- name: Feature fires and does not over-fire (dedicated tests, GCC, release)
run: |
cd ../boost-root
./b2 \
libs/$LIBRARY/test//compile_fail_ca_unsigned_div_by_zero \
libs/$LIBRARY/test//compile_fail_ca_unsigned_shl_overflow \
libs/$LIBRARY/test//compile_fail_ca_unsigned_add_overflow \
libs/$LIBRARY/test//compile_fail_ca_signed_div_by_zero \
libs/$LIBRARY/test//compile_fail_ca_signed_div_min \
libs/$LIBRARY/test//compile_fail_ca_div_ceil_zero \
libs/$LIBRARY/test//compile_ca_saturating_add \
libs/$LIBRARY/test//compile_ca_checked_div_by_zero \
toolset=gcc cxxstd=20 variant=release
# End-to-end check of the B2 toggle: clean code still builds, and a test that
# divides by a compile-time-constant zero must fail to build once it is enabled.
- name: B2 toggle activates the checks
run: |
cd ../boost-root
./b2 libs/$LIBRARY/test//quick boost.safe_numbers.compile_assert=on toolset=gcc cxxstd=20 variant=release
if ./b2 libs/$LIBRARY/test//test_unsigned_division boost.safe_numbers.compile_assert=on toolset=gcc cxxstd=20 variant=release >/dev/null 2>&1; then
echo "ERROR: expected test_unsigned_division to fail to build with the feature enabled"
exit 1
fi
echo "Confirmed: enabling boost.safe_numbers.compile_assert turns the constant violation into a build error."
# Smoke check that the CMake option is declared and configures cleanly.
- name: CMake option integrates
run: |
cd ../boost-root
rm -rf __build_ca__ && mkdir __build_ca__ && cd __build_ca__
cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DBUILD_TESTING=OFF -DBOOST_SAFE_NUMBERS_ENABLE_COMPILE_ASSERT=ON -DCMAKE_BUILD_TYPE=Release ..