Skip to content

Commit

Permalink
BDDE: Move setup from CI config to script
Browse files Browse the repository at this point in the history
Allow seamless updates for all users.
  • Loading branch information
Flamefire committed May 15, 2024
1 parent 0ab7779 commit 7cc2318
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 22 deletions.
16 changes: 5 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -236,17 +236,11 @@ jobs:
- name: Setup multiarch
if: matrix.multiarch
run: |
sudo apt-get install --no-install-recommends -y binfmt-support qemu-user-static
sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
git clone --depth=1 https://github.com/jeking3/bdde.git
echo "$(pwd)/bdde/bin/linux" >> ${GITHUB_PATH}
echo "BDDE_DISTRO=${{ matrix.distro }}" >> ${GITHUB_ENV}
echo "BDDE_EDITION=${{ matrix.edition }}" >> ${GITHUB_ENV}
echo "BDDE_ARCH=${{ matrix.arch }}" >> ${GITHUB_ENV}
echo "B2_WRAPPER=bdde" >> ${GITHUB_ENV}
# Avoid: /usr/bin/windres: Can't detect architecture.
echo "B2_DONT_EMBED_MANIFEST=1" >> ${GITHUB_ENV}
env:
BDDE_DISTRO: ${{matrix.distro}}
BDDE_EDITION: ${{matrix.edition}}
BDDE_ARCH: ${{matrix.arch}}
run: ci/github/setup_bdde.sh

- name: Setup Boost
env:
Expand Down
26 changes: 26 additions & 0 deletions ci/github/setup_bdde.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#! /bin/bash
#
# Copyright 2024 Alexander Grund
# 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)
#
# Setup the Boost Docker Development Environment (BDDE)
# Requires a Linux environment with root/sudo privileges

set -ex

$(dirname "${BASH_SOURCE[0]}")/../setup_bdde.sh

echo "$(pwd)/bdde/bin/linux" >> ${GITHUB_PATH}

for var in "${!BDDE_@}"; do
echo "$var=${!var}" >> ${GITHUB_ENV}
done

echo "B2_WRAPPER=bdde" >> ${GITHUB_ENV}

if [[ "${BDDE_FIX_MANIFEST:-yes}" == "yes" ]]; then
# Avoid: /usr/bin/windres: Can't detect architecture.
echo "B2_DONT_EMBED_MANIFEST=1" >> ${GITHUB_ENV}
fi
30 changes: 30 additions & 0 deletions ci/setup_bdde.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#! /bin/bash
#
# Copyright 2024 Alexander Grund
# 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)
#
# Setup the Boost Docker Development Environment (BDDE)
#
# The BDDE project at https://github.com/jeking3/bdde includes
# build containers for different operating systems and architectures
# using multiarch containers.
# This allows e.g. building in a big-endian environment on CI
# Simply set $BDDE_DISTRO, $BDDE_EDITION & $BDDE_ARCH
# and run your commands with the prefix `bdde`, e.g. `bdde true`
#
# Requires a Linux environment with root/sudo privileges

set -ex

if [ -f "/etc/debian_version" ]; then
sudo apt-get install --no-install-recommends -y binfmt-support qemu-user-static
fi

# this prepares the VM for multiarch docker
sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes

git clone --depth=1 https://github.com/jeking3/bdde.git

export PATH="$(pwd)/bdde/bin/linux:$PATH"
14 changes: 3 additions & 11 deletions ci/travis/bdde.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,25 @@
# 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)
#

#
# Build using a Boost Docker Development Environment container.
# The BDDE project at https://github.com/jeking3/bdde includes
# build containers for different operating systems and architectures
# using multiarch containers. This allows for better continuous
# integration, for example you can build in a big-endian environment
# on Travis CI.
#
# In your .travis.yml file, set the BDDE_OS and BDDE_ARCH according
# to the instructions in the BDDE README.
#
# In your .travis.yml file, set $BDDE_DISTRO, $BDDE_EDITION, $BDDE_ARCH
# according to the instructions in the BDDE README.

set -ex

git clone --depth 1 https://github.com/jeking3/bdde.git ~/bdde
export PATH=~/bdde/bin/linux:$PATH
. $(dirname "${BASH_SOURCE[0]}")/../setup_bdde.sh

. $(dirname "${BASH_SOURCE[0]}")/../enforce.sh

# this prepares the VM for multiarch docker
docker run --rm --privileged multiarch/qemu-user-static:register --reset
bdde "echo this just pulls the image"

# now we can bootstrap and build just like normal, but it is in the container
# and avoid any permissions issues
chmod -R 777 /home/travis/build
BOOST_STEM=boost bdde "./bootstrap.sh"
BOOST_STEM=boost bdde ./b2 "libs/$SELF/test" "${B2_ARGS[@]}" "$@"

0 comments on commit 7cc2318

Please sign in to comment.