Continuous Integration #435
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is the continuous integration job for `scribbu`. It will run on | |
# both MacOS & Ubuntu, using various versions of `boost`. I'd also | |
# like to try installing & building against multple `gcc` versions. | |
# The intent here is get as many lints & checks as possible out of my | |
# personal checklist & into automation, being run every night. | |
# Reference: | |
# | |
# - pwd | |
# - MacOS: /Users/runner/work/scribbu/scribbu | |
# - Ubuntu: /home/runner/work/scribbu/scribbu | |
name: Continuous Integration | |
on: | |
workflow_dispatch: | |
push: | |
pull_request: | |
types: [opened, edited, reopened] # don't say `synchronize`-- that is taken care of by `push` | |
schedule: | |
- cron: '01 02 * * *' | |
jobs: | |
build: | |
name: build | |
strategy: | |
matrix: | |
os: [macos-12, ubuntu-22.04] | |
# I moved to C++ 20 2024-01-12-- the earliest version of boost that can compile | |
# under C++ 20 seems to be 1.75. That was released 2020-12-11, over three years | |
# ago so I'm comfortable calling that "oldest", now. Let's call 1.81 (one year ago) | |
# "pinned". | |
boost: [oldest, pinned, latest] | |
include: | |
- os: macos-12 | |
boost: oldest | |
boost-ver: 1_75_0 | |
boost-dl: https://boostorg.jfrog.io/artifactory/main/release/1.75.0/source/boost_1_75_0.tar.bz2 | |
- os: macos-12 | |
boost: pinned | |
boost-ver: 1_81_0 | |
boost-dl: https://boostorg.jfrog.io/artifactory/main/release/1.81.0/source/boost_1_81_0.tar.bz2 | |
- os: macos-12 | |
boost: latest | |
boost-ver: 1_84_0 | |
boost-dl: https://boostorg.jfrog.io/artifactory/main/release/1.84.0/source/boost_1_84_0.tar.bz2 | |
- os: ubuntu-22.04 | |
boost: oldest | |
boost-ver: 1_75_0 | |
boost-dl: https://boostorg.jfrog.io/artifactory/main/release/1.75.0/source/boost_1_75_0.tar.bz2 | |
- os: ubuntu-22.04 | |
boost: pinned | |
boost-ver: 1_81_0 | |
boost-dl: https://boostorg.jfrog.io/artifactory/main/release/1.81.0/source/boost_1_81_0.tar.bz2 | |
- os: ubuntu-22.04 | |
boost: latest | |
boost-ver: latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v2 | |
- name: Check for TODO-s left in code | |
shell: bash | |
run: | | |
set -x | |
if find . -not -path '*/.git/*' -not -name 'tbt-lexer.cc' -not -name 'tbt-lexer.hh' '(' -iname '*.hh' -or -iname '*cc' ')' -print0 | xargs -0 -e grep -nE 'TODO|TOOD|\\todo|\\tood'; then | |
echo "You have TODO-s" | |
exit 1 | |
fi | |
- name: Get build number | |
shell: bash | |
run: | | |
set -x | |
version=`awk '/^AC_INIT/ {print substr($2, 2, length($2)-3)}' configure.ac` | |
echo "Building scribbu version $version." | |
echo "SCRIBBU_BUILD_NUMBER=${version}" >> $GITHUB_ENV | |
- name: Install pre-requisites (Ubuntu) | |
if: matrix.os == 'ubuntu-22.04' | |
shell: bash | |
run: | | |
set -x | |
sudo apt-get update | |
sudo apt-get install -y autoconf automake libtool openssl guile-3.0-dev doxygen flex bison graphviz libunistring-dev texlive tzdata locales | |
- name: Install pre-requisites (MacOS) | |
if: matrix.os == 'macos-12' | |
shell: bash | |
run: | | |
set -x | |
# This seems wrong on multiple levels, but see here: | |
# <https://github.com/orgs/Homebrew/discussions/4612#discussioncomment-6339258> | |
set +e | |
brew cleanup | |
# Will exit with non-zero status if it finds problems, but can be handy | |
# for trouble-shooting: | |
brew doctor | |
brew update | |
brew upgrade | |
brew install autoconf automake libtool openssl doxygen flex bison graphviz texinfo | |
brew install --cask basictex | |
type -p guile || brew install guile | |
set -e | |
- name: Cache boost (Ubuntu) | |
# On Ubuntu, we install "latest" directly from the package repositories. | |
if: matrix.os == 'ubuntu-22.04' && matrix.boost != 'latest' | |
id: cache-boost-ubuntu | |
uses: actions/cache@v2 | |
with: | |
path: boost_${{ matrix.boost-ver }}/installdir | |
key: ${{ runner.os }}-${{ matrix.boost-ver }} | |
- name: Cache boost (MacOS) | |
if: matrix.os == 'macos-12' | |
id: cache-boost-macos | |
uses: actions/cache@v2 | |
with: | |
path: boost_${{ matrix.boost-ver }}/installdir | |
key: ${{ runner.os }}-${{ matrix.boost-ver }} | |
- name: Install boost (Ubuntu, latest) | |
if: matrix.os == 'ubuntu-22.04' && matrix.boost == 'latest' | |
run: | | |
set -x | |
pwd | |
sudo apt-get install -y libboost-all-dev | |
- name: Get boost (Ubuntu, non-latest) | |
if: matrix.os == 'ubuntu-22.04' && matrix.boost != 'latest' && steps.cache-boost-ubuntu.outputs.cache-hit != 'true' | |
run: | | |
set -ex | |
pwd | |
curl -L -o boost_${{ matrix.boost-ver }}.tar.bz2 ${{ matrix.boost-dl }} | |
md5sum boost_${{ matrix.boost-ver }}.tar.bz2 | |
tar xf boost_${{ matrix.boost-ver }}.tar.bz2 | |
cd boost_${{ matrix.boost-ver }} | |
mkdir installdir | |
# libboost_python fails for boost 1.58.0-- I don't need it, so didn't bother debugging it | |
./bootstrap.sh --prefix=./installdir --without-libraries=python || cat bootstrap.log | |
./b2 && ./b2 install | |
- name: Get boost (MacOS) | |
if: matrix.os == 'macos-12' && steps.cache-boost-macos.outputs.cache-hit != 'true' | |
run: | | |
set -ex | |
pwd | |
curl -L -o boost_${{ matrix.boost-ver }}.tar.bz2 ${{ matrix.boost-dl }} | |
ls -l boost_${{ matrix.boost-ver }}.tar.bz2 | |
md5 boost_${{ matrix.boost-ver }}.tar.bz2 | |
# Apple clang version 14.0.0 (clang-1400.0.29.202) | |
cc --version | |
tar xf boost_${{ matrix.boost-ver }}.tar.bz2 | |
mkdir boost_${{ matrix.boost-ver }}/installdir | |
- name: Patch boost source (MacOS) | |
if: matrix.os == 'macos-12' && steps.cache-boost-macos.outputs.cache-hit != 'true' && matrix.boost == 'oldest' | |
run: | | |
cd boost_${{ matrix.boost-ver }}/tools/build/src/engine | |
cp build.sh build.sh.bak | |
awk '/darwin\)/{print; print " BOOST_JAM_OPT_JAM=\"$BOOST_JAM_OPT_JAM $CFLAGS $LIBS\""; next }1' build.sh > build.sh.tmp | |
mv build.sh.tmp build.sh | |
chmod a+x build.sh | |
# cat build.sh | |
cp execcmd.c execcmd.c.bak | |
awk '/#include "execcmd.h"/{print; print "#include \"output.h\""; next }1' execcmd.c > execcmd.c.tmp | |
mv execcmd.c.tmp execcmd.c | |
# cat execcmd.c | |
cp make.c make.c.bak | |
awk '/#include "make.h"/{print; print "#include \"output.h\""; next }1' make.c > make.c.tmp | |
mv make.c.tmp make.c | |
# cat make.c | |
cp filesys.c filesys.c.bak | |
awk '/#include "filesys.h"/{print; print "int filelist_empty( FILELIST * list );"; next }1' filesys.c > filesys.c.tmp | |
mv filesys.c.tmp filesys.c | |
# cat filesys.c | |
cp modules/path.c modules/path.c.bak | |
awk '/#include "..\/timestamp.h"/{print; print "#include \"../filesys.h\""; next }1' modules/path.c > modules/path.c.tmp | |
mv modules/path.c.tmp modules/path.c | |
# cat modules/path.c | |
cp fileunix.c fileunix.c.bak | |
awk '/#include "jam.h"/{print; print "int filelist_empty( FILELIST * list );"; next }1' fileunix.c > fileunix.c.tmp | |
awk '/#include "jam.h"/{print; print "#include \"filesys.h\""; next }1' fileunix.c.tmp > fileunix.c.tmp.1 | |
awk '/#include "filesys.h"/{print; print "int file_collect_archive_content_( file_archive_info_t * const archive );"; next }1' fileunix.c.tmp.1 > fileunix.c | |
# cat fileunix.c | |
cd ../tools | |
cp darwin.jam darwin.jam.bak | |
head -n138 darwin.jam > darwin.jam.tmp | |
tail -n +145 darwin.jam >> darwin.jam.tmp | |
mv darwin.jam.tmp darwin.jam | |
- name: Build boost (MacOS) | |
if: matrix.os == 'macos-12' && steps.cache-boost-macos.outputs.cache-hit != 'true' | |
shell: bash | |
run: | | |
pwd | |
set -x | |
cd boost_${{ matrix.boost-ver }} | |
pwd | |
ls | |
export CFLAGS="-Wno-error=implicit-function-declaration" | |
# python failed for boost 1.63; I don't use it, so didn't bother debugging | |
./bootstrap.sh --prefix=./installdir --without-libraries=python || { cat bootstrap.log; exit 1; } | |
./b2 | |
./b2 install | |
- name: Patch boost library dependencies (MacOS, non-oldest) | |
if: matrix.os == 'macos-12' && matrix.boost != 'oldest' # && steps.cache-boost-macos.outputs.cache-hit != 'true' | |
run: | | |
cd boost_${{ matrix.boost-ver }}/installdir/lib | |
pwd | |
ls | |
echo ================================================ | |
otool -L libboost_log.dylib | |
otool -L libboost_chrono.dylib | |
otool -L libboost_thread.dylib | |
echo ================================================ | |
here=$(pwd) | |
install_name_tool -change @rpath/libboost_atomic.dylib ${here}/libboost_atomic.dylib libboost_log.dylib | |
install_name_tool -change @rpath/libboost_chrono.dylib ${here}/libboost_chrono.dylib libboost_log.dylib | |
install_name_tool -change @rpath/libboost_filesystem.dylib ${here}/libboost_filesystem.dylib libboost_log.dylib | |
install_name_tool -change @rpath/libboost_thread.dylib ${here}/libboost_thread.dylib libboost_log.dylib | |
install_name_tool -change @rpath/libboost_date_time.dylib ${here}/libboost_date_time.dylib libboost_log.dylib | |
install_name_tool -change @rpath/libboost_system.dylib ${here}/libboost_system.dylib libboost_log.dylib | |
install_name_tool -change @rpath/libboost_regex.dylib ${here}/libboost_regex.dylib libboost_log.dylib | |
install_name_tool -change @rpath/libboost_system.dylib ${here}/libboost_system.dylib libboost_chrono.dylib | |
install_name_tool -change @rpath/libboost_system.dylib ${here}/libboost_system.dylib libboost_thread.dylib | |
echo ================================================ | |
otool -L libboost_log.dylib | |
otool -L libboost_chrono.dylib | |
otool -L libboost_thread.dylib | |
echo ================================================ | |
- name: Patch boost library dependencies (MacOS, oldest) | |
if: matrix.os == 'macos-12' && matrix.boost == 'oldest' # && steps.cache-boost-macos.outputs.cache-hit != 'true' | |
run: | | |
cd boost_${{ matrix.boost-ver }}/installdir/lib | |
pwd | |
ls | |
echo ================================================ | |
otool -L libboost_log.dylib | |
otool -L libboost_chrono.dylib | |
otool -L libboost_thread.dylib | |
otool -L libboost_unit_test_framework.dylib | |
otool -L libboost_timer.dylib | |
echo ================================================ | |
here=$(pwd) | |
install_name_tool -change libboost_atomic.dylib ${here}/libboost_atomic.dylib libboost_log.dylib | |
install_name_tool -change libboost_chrono.dylib ${here}/libboost_chrono.dylib libboost_log.dylib | |
install_name_tool -change libboost_filesystem.dylib ${here}/libboost_filesystem.dylib libboost_log.dylib | |
install_name_tool -change libboost_thread.dylib ${here}/libboost_thread.dylib libboost_log.dylib | |
install_name_tool -change libboost_date_time.dylib ${here}/libboost_date_time.dylib libboost_log.dylib | |
install_name_tool -change libboost_system.dylib ${here}/libboost_system.dylib libboost_log.dylib | |
install_name_tool -change libboost_regex.dylib ${here}/libboost_regex.dylib libboost_log.dylib | |
install_name_tool -change libboost_system.dylib ${here}/libboost_system.dylib libboost_chrono.dylib | |
install_name_tool -change libboost_system.dylib ${here}/libboost_system.dylib libboost_thread.dylib | |
install_name_tool -change libboost_timer.dylib ${here}/libboost_timer.dylib libboost_unit_test_framework.dylib | |
install_name_tool -change libboost_chrono.dylib ${here}/libboost_chrono.dylib libboost_timer.dylib | |
echo ================================================ | |
otool -L libboost_log.dylib | |
otool -L libboost_chrono.dylib | |
otool -L libboost_thread.dylib | |
otool -L libboost_unit_test_framework.dylib | |
otool -L libboost_timer.dylib | |
echo ================================================ | |
- name: Configure scribbu (Ubuntu, non-latest) | |
if: matrix.os == 'ubuntu-22.04' && matrix.boost != 'latest' | |
shell: bash | |
run: | | |
autoconf --version | |
automake --version | |
set -x | |
pwd | |
ls | |
./bootstrap | |
./configure --with-boost=$(cd boost_${{ matrix.boost-ver }}/installdir; pwd) | |
- name: Configure scribbu (Ubuntu, latest) | |
if: matrix.os == 'ubuntu-22.04' && matrix.boost == 'latest' | |
shell: bash | |
run: | | |
autoconf --version | |
automake --version | |
set -x | |
pwd | |
ls | |
./bootstrap | |
./configure | |
- name: Configure scribbu (MacOS) | |
if: matrix.os == 'macos-12' | |
shell: bash | |
run: | | |
autoconf --version | |
automake --version | |
set -x | |
pwd | |
ls | |
./bootstrap | |
eval "$(/usr/libexec/path_helper)" | |
PATH="/usr/local/opt/bison/bin:/usr/local/opt/texinfo/bin:$PATH" ./configure --with-boost=$(cd boost_${{ matrix.boost-ver }}/installdir; pwd) --with-openssl=/usr/local/opt/openssl CPPFLAGS="-D_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR -I/usr/local/opt/openssl@1.1/include" LDFLAGS="-L/usr/local/opt/openssl@1.1/lib" | |
- name: Make scribbu (Ubuntu) | |
if: matrix.os == 'ubuntu-22.04' | |
shell: bash | |
run: | | |
set -x | |
pwd | |
make -j 4 | |
- name: Make scribbu (MacOS) | |
if: matrix.os == 'macos-12' | |
shell: bash | |
run: | | |
set -x | |
pwd | |
eval "$(/usr/libexec/path_helper)" | |
PATH="/usr/local/opt/bison/bin:/usr/local/opt/texinfo/bin:$PATH" make -j 4 | |
- name: Patch boost binary dependencies (MacOS) | |
if: matrix.os == 'macos-12' | |
shell: bash | |
run: | | |
set -x | |
echo "====================================" | |
otool -L scribbu/.libs/libscribbu.dylib | |
echo "====================================" | |
there=$(cd boost_${{ matrix.boost-ver }}/installdir/lib; pwd) | |
echo "Changing the load location for boost libs to ${there}." | |
install_name_tool -change @rpath/libboost_iostreams.dylib ${there}/libboost_iostreams.dylib scribbu/.libs/libscribbu.dylib | |
install_name_tool -change @rpath/libboost_log.dylib ${there}/libboost_log.dylib scribbu/.libs/libscribbu.dylib | |
install_name_tool -change @rpath/libboost_program_options.dylib ${there}/libboost_program_options.dylib scribbu/.libs/libscribbu.dylib | |
install_name_tool -change @rpath/libboost_regex.dylib ${there}/libboost_regex.dylib scribbu/.libs/libscribbu.dylib | |
install_name_tool -change @rpath/libboost_system.dylib ${there}/libboost_system.dylib scribbu/.libs/libscribbu.dylib | |
echo "====================================" | |
otool -L scribbu/.libs/libscribbu.dylib | |
echo "====================================" | |
echo "====================================" | |
otool -L src/.libs/scribbu | |
echo "====================================" | |
there=$(cd boost_${{ matrix.boost-ver }}/installdir/lib; pwd) | |
echo "Changing the load location for boost libs to ${there}." | |
install_name_tool -change @rpath/libboost_iostreams.dylib ${there}/libboost_iostreams.dylib src/.libs/scribbu | |
install_name_tool -change @rpath/libboost_log.dylib ${there}/libboost_log.dylib src/.libs/scribbu | |
install_name_tool -change @rpath/libboost_program_options.dylib ${there}/libboost_program_options.dylib src/.libs/scribbu | |
install_name_tool -change @rpath/libboost_regex.dylib ${there}/libboost_regex.dylib src/.libs/scribbu | |
install_name_tool -change @rpath/libboost_system.dylib ${there}/libboost_system.dylib src/.libs/scribbu | |
there=$(cd scribbu/.libs; pwd) | |
echo "Changing the load location for scribbu lib to be ${there}." | |
install_name_tool -change /usr/local/lib/libscribbu.4.dylib ${there}/libscribbu.4.dylib src/.libs/scribbu | |
echo "====================================" | |
otool -L src/.libs/scribbu | |
src/.libs/scribbu --version | |
echo "====================================" | |
cd test && make unit | |
echo "====================================" | |
otool -L .libs/unit | |
echo "====================================" | |
there=$(cd ../boost_${{ matrix.boost-ver }}/installdir/lib; pwd) | |
echo "Changing the load location for boost libs to ${there}." | |
install_name_tool -change @rpath/libboost_iostreams.dylib ${there}/libboost_iostreams.dylib .libs/unit | |
install_name_tool -change @rpath/libboost_log.dylib ${there}/libboost_log.dylib .libs/unit | |
install_name_tool -change @rpath/libboost_program_options.dylib ${there}/libboost_program_options.dylib .libs/unit | |
install_name_tool -change @rpath/libboost_regex.dylib ${there}/libboost_regex.dylib .libs/unit | |
install_name_tool -change @rpath/libboost_system.dylib ${there}/libboost_system.dylib .libs/unit | |
install_name_tool -change @rpath/libboost_unit_test_framework.dylib ${there}/libboost_unit_test_framework.dylib .libs/unit | |
there=$(cd ../scribbu/.libs; pwd) | |
echo "Changing the load location for unit lib to be ${there}." | |
install_name_tool -change /usr/local/lib/libscribbu.4.dylib ${there}/libscribbu.4.dylib .libs/unit | |
echo "====================================" | |
otool -L .libs/unit | |
.libs/unit --help | |
- name: Test scribbu (Ubuntu, non-latest) | |
if: matrix.os == 'ubuntu-22.04' && matrix.boost != 'latest' | |
shell: bash | |
run: | | |
set -x | |
pwd | |
here=$(pwd) | |
ldd scribbu/.libs/libscribbu.so | |
find ${here}/boost_${{ matrix.boost-ver }}/installdir -iname '*.so' | |
export LD_LIBRARY_PATH="${here}/boost_${{ matrix.boost-ver }}/installdir/lib:$LD_LIBRARY_PATH" | |
pwd | |
if ! make check; then | |
cat test/test-suite.log | |
exit 1 | |
fi | |
- name: Test scribbu (Ubuntu, latest) | |
if: matrix.os == 'ubuntu-22.04' && matrix.boost == 'latest' | |
shell: bash | |
run: | | |
set -x | |
pwd | |
ldd scribbu/.libs/libscribbu.so | |
if ! make check; then | |
cat test/test-suite.log | |
exit 1 | |
fi | |
- name: Test scribbu (MacOS) | |
if: matrix.os == 'macos-12' | |
shell: bash | |
run: | | |
set -x | |
pwd | |
if ! make check; then | |
cat test/test-suite.log | |
exit 1 | |
fi | |
- name: Test the Autotools distribution (Ubuntu, non-latest) | |
# I only make the Autotools distro on Ubuntu, so just test there | |
if: matrix.os == 'ubuntu-22.04' && matrix.boost != 'latest' | |
shell: bash | |
run: | | |
set -x | |
pwd | |
ls | |
here=$(pwd) | |
version=${{ env.SCRIBBU_BUILD_NUMBER }} | |
export DISTCHECK_CONFIGURE_FLAGS="--with-boost=$(cd boost_${{ matrix.boost-ver }}/installdir; pwd)" | |
export LD_LIBRARY_PATH="${here}/boost_${{ matrix.boost-ver }}/installdir/lib:$LD_LIBRARY_PATH" | |
if ! make -j 4 distcheck; then | |
cat test/test-suite.log | |
test -f scribbu-${version}/_build/sub/test/test-suite.log && \ | |
cat scribbu-${version}/_build/sub/test/test-suite.log | |
exit 1 | |
fi | |
- name: Test the Autotools distribution (Ubuntu, latest) | |
if: matrix.os == 'ubuntu-22.04' && matrix.boost == 'latest' | |
shell: bash | |
run: | | |
pwd | |
make -j 4 distcheck | |
# Given that I had to move heaven & earth to get `make check` to | |
# work on MacOS, I'm going to hold-off on `make distcheck` until I | |
# want to really support MacOS, or someone asks for it... or | |
# something. |