Added ARM CIs

Added ARM docker images
Added ARM CIs for gcc and clang on Linux
Fixed a linker error on cmake when no CMAKE_CXX_STD
    is specified and the compiler defaults to C++03
ci.py now supports empty cxxstd for cmake

Close #130
Close #134
This commit is contained in:
Ruben Perez 2023-03-26 23:28:46 +02:00
parent 643e39f85e
commit 3606474a50
5 changed files with 138 additions and 102 deletions

View File

@ -5,15 +5,23 @@
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
_triggers = { "branch": [ "master", "develop", "drone*", "bugfix/*", "feature/*", "fix/*", "pr/*" ] }
_container_tag = '65e51d3af7132dcb1001249629c24cc59b934cb6'
_triggers = { "branch": [ "master", "develop", "drone*", "feature/*", "bugfix/*", "fix/*", "pr/*" ] }
_container_tag = 'a6ccc56343736f8b4edea3686c92d9856469fa36'
def _image(name):
return 'ghcr.io/anarthal-containers/{}:{}'.format(name, _container_tag)
def _b2_command(source_dir, toolset, cxxstd, variant, stdlib='native', address_model='64', server_host='localhost'):
def _b2_command(
source_dir,
toolset,
cxxstd,
variant,
stdlib='native',
address_model='64',
server_host='localhost'
):
return 'python tools/ci.py ' + \
'--clean=1 ' + \
'--build-kind=b2 ' + \
@ -57,15 +65,22 @@ def _cmake_command(
'--server-host={} '.format(server_host)
def _linux_pipeline(name, image, command, db):
def _pipeline(
name,
image,
os,
command,
db,
arch='amd64'
):
return {
"name": name,
"kind": "pipeline",
"type": "docker",
"trigger": _triggers,
"platform": {
"os": "linux",
"arch": "amd64"
"os": os,
"arch": arch
},
"clone": {
"retries": 5
@ -75,10 +90,10 @@ def _linux_pipeline(name, image, command, db):
"name": "Everything",
"image": image,
"pull": "if-not-exists",
"volumes": [{
"volumes":[{
"name": "mysql-socket",
"path": "/var/run/mysqld"
}],
}] if db != None else [],
"commands": [command],
"environment": {
"CODECOV_TOKEN": {
@ -93,34 +108,11 @@ def _linux_pipeline(name, image, command, db):
"name": "mysql-socket",
"path": "/var/run/mysqld"
}]
}],
}] if db != None else [],
"volumes": [{
"name": "mysql-socket",
"temp": {}
}]
}
def _windows_pipeline(name, image, command):
return {
"name": name,
"kind": "pipeline",
"type": "docker",
"trigger": _triggers,
"platform": {
"os": "windows",
"arch": "amd64"
},
"clone": {
"retries": 5
},
"node": {},
"steps": [{
"name": "Everything",
"image": image,
"pull": "if-not-exists",
"commands": [command]
}]
}] if db != None else []
}
@ -130,7 +122,8 @@ def linux_b2(
toolset,
cxxstd,
variant='debug,release',
stdlib='native'
stdlib='native',
arch='amd64'
):
command = _b2_command(
source_dir='$(pwd)',
@ -140,7 +133,14 @@ def linux_b2(
stdlib=stdlib,
server_host='mysql'
)
return _linux_pipeline(name, image, command, db='mysql8')
return _pipeline(
name=name,
image=image,
os='linux',
command=command,
db='mysql8',
arch=arch
)
def windows_b2(
@ -159,7 +159,7 @@ def windows_b2(
address_model=address_model,
server_host='localhost'
)
return _windows_pipeline(name, image, command)
return _pipeline(name=name, image=image, os='windows', command=command, db=None)
def linux_cmake(
@ -188,7 +188,7 @@ def linux_cmake(
db=db,
server_host='mysql'
)
return _linux_pipeline(name, image, command, db=db)
return _pipeline(name=name, image=image, os='linux', command=command, db=db)
def windows_cmake(
@ -202,32 +202,23 @@ def windows_cmake(
db='mysql8',
server_host='localhost'
)
return _windows_pipeline(name, _image('build-msvc14_3'), command)
return _pipeline(
name=name,
image=_image('build-msvc14_3'),
os='windows',
command=command,
db=None
)
def docs():
return {
"name": "Linux docs",
"kind": "pipeline",
"type": "docker",
"trigger": _triggers,
"platform": {
"os": "linux",
"arch": "amd64"
},
"clone": {
"retries": 5
},
"node": {},
"steps": [{
"name": "Everything",
"image": _image('build-docs'),
"pull": "if-not-exists",
"commands": [
'python tools/ci.py --build-kind=docs --clean=1 --source-dir=$(pwd)'
]
}]
}
return _pipeline(
name='Linux docs',
image=_image('build-docs'),
os='linux',
command='python tools/ci.py --build-kind=docs --clean=1 --source-dir=$(pwd)',
db=None
)
def main(ctx):
@ -247,15 +238,17 @@ def main(ctx):
windows_cmake('Windows CMake shared', build_shared_libs=1),
# B2 Linux
linux_b2('Linux B2 clang-3.6', _image('build-clang3_6'), toolset='clang-3.6', cxxstd='11,14'),
linux_b2('Linux B2 clang-7', _image('build-clang7'), toolset='clang-7', cxxstd='14,17'),
linux_b2('Linux B2 clang-11', _image('build-clang11'), toolset='clang-11', cxxstd='20'),
linux_b2('Linux B2 clang-14', _image('build-clang14'), toolset='clang-14', cxxstd='17,20'),
linux_b2('Linux B2 clang-libc++', _image('build-clang14'), toolset='clang-14', cxxstd='20', stdlib='libc++'),
linux_b2('Linux B2 gcc-5', _image('build-gcc5'), toolset='gcc-5', cxxstd='11'), # gcc-5 C++14 doesn't like my constexpr field_view
linux_b2('Linux B2 gcc-6', _image('build-gcc6'), toolset='gcc-6', cxxstd='14,17'),
linux_b2('Linux B2 gcc-10', _image('build-gcc10'), toolset='gcc-10', cxxstd='17,20'),
linux_b2('Linux B2 gcc-11', _image('build-gcc11'), toolset='gcc-11', cxxstd='17,20'),
linux_b2('Linux B2 clang-3.6', _image('build-clang3_6'), toolset='clang-3.6', cxxstd='11,14'),
linux_b2('Linux B2 clang-7', _image('build-clang7'), toolset='clang-7', cxxstd='14,17'),
linux_b2('Linux B2 clang-11', _image('build-clang11'), toolset='clang-11', cxxstd='20'),
linux_b2('Linux B2 clang-14', _image('build-clang14'), toolset='clang-14', cxxstd='17,20'),
linux_b2('Linux B2 clang-libc++', _image('build-clang14'), toolset='clang-14', cxxstd='20', stdlib='libc++'),
linux_b2('Linux B2 clang-14-arm64', _image('build-clang14'), toolset='clang-14', cxxstd='20', arch='arm64'),
linux_b2('Linux B2 gcc-5', _image('build-gcc5'), toolset='gcc-5', cxxstd='11'), # gcc-5 C++14 doesn't like my constexpr field_view
linux_b2('Linux B2 gcc-6', _image('build-gcc6'), toolset='gcc-6', cxxstd='14,17'),
linux_b2('Linux B2 gcc-10', _image('build-gcc10'), toolset='gcc-10', cxxstd='17,20'),
linux_b2('Linux B2 gcc-11', _image('build-gcc11'), toolset='gcc-11', cxxstd='17,20'),
linux_b2('Linux B2 gcc-11-arm64', _image('build-gcc11'), toolset='gcc-11', cxxstd='20', arch='arm64'),
# B2 Windows
windows_b2('Windows B2 msvc14.1 32-bit', _image('build-msvc14_1'), toolset='msvc-14.1', cxxstd='11,14,17', variant='release', address_model='32'),

View File

@ -9,34 +9,72 @@ name: Build Docker images
on: workflow_dispatch
jobs:
build-and-push-image:
linux-images:
strategy:
matrix:
include:
- { image: build-msvc14_1, dockerfile: build-msvc, os: windows-2019, base-image: "cppalliance/dronevs2017:1" }
- { image: build-msvc14_2, dockerfile: build-msvc, os: windows-2019, base-image: "cppalliance/dronevs2019:1" }
- { image: build-msvc14_3, dockerfile: build-msvc, os: windows-2019, base-image: "cppalliance/dronevs2022:1" }
- { image: build-clang3_6, dockerfile: build-clang3_6, os: ubuntu-latest }
- { image: build-clang7, dockerfile: build-clang7, os: ubuntu-latest }
- { image: build-clang11, dockerfile: build-clang11, os: ubuntu-latest }
- { image: build-clang14, dockerfile: build-clang14, os: ubuntu-latest }
- { image: build-gcc5, dockerfile: build-gcc5, os: ubuntu-latest }
- { image: build-gcc6, dockerfile: build-gcc6, os: ubuntu-latest }
- { image: build-gcc10, dockerfile: build-gcc10, os: ubuntu-latest }
- { image: build-gcc11, dockerfile: build-gcc11, os: ubuntu-latest }
- { image: build-cmake3_8, dockerfile: build-cmake3_8, os: ubuntu-latest }
- { image: build-noopenssl, dockerfile: build-noopenssl, os: ubuntu-latest }
- { image: build-docs, dockerfile: build-docs, os: ubuntu-latest }
- { image: mysql5, dockerfile: mysql5, os: ubuntu-latest }
- { image: mysql8, dockerfile: mysql8, os: ubuntu-latest }
- { image: mariadb, dockerfile: mariadb, os: ubuntu-latest }
- { image: build-clang3_6, dockerfile: build-clang3_6, platforms: "linux/amd64", }
- { image: build-clang7, dockerfile: build-clang7, platforms: "linux/amd64", }
- { image: build-clang11, dockerfile: build-clang11, platforms: "linux/amd64", }
- { image: build-clang14, dockerfile: build-clang14, platforms: "linux/amd64, linux/arm64/v8" }
- { image: build-gcc5, dockerfile: build-gcc5, platforms: "linux/amd64", }
- { image: build-gcc6, dockerfile: build-gcc6, platforms: "linux/amd64", }
- { image: build-gcc10, dockerfile: build-gcc10, platforms: "linux/amd64", }
- { image: build-gcc11, dockerfile: build-gcc11, platforms: "linux/amd64, linux/arm64/v8" }
- { image: build-cmake3_8, dockerfile: build-cmake3_8, platforms: "linux/amd64", }
- { image: build-noopenssl, dockerfile: build-noopenssl, platforms: "linux/amd64", }
- { image: build-docs, dockerfile: build-docs, platforms: "linux/amd64", }
- { image: mysql5, dockerfile: mysql5, platforms: "linux/amd64", }
- { image: mysql8, dockerfile: mysql8, platforms: "linux/amd64, linux/arm64/v8" }
- { image: mariadb, dockerfile: mariadb, platforms: "linux/amd64, linux/arm64/v8" }
permissions:
contents: read
packages: write
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: anarthal-containers
password: ${{ secrets.ANARTHAL_CONTAINERS_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
push: true
file: tools/docker/${{ matrix.dockerfile }}.dockerfile
build-args: ${{ matrix.build-args }}
platforms: ${{ matrix.platforms }}
tags: ghcr.io/anarthal-containers/${{ matrix.image }}:${{ github.sha }}, ghcr.io/anarthal-containers/${{ matrix.image }}:latest
windows-images:
strategy:
matrix:
include:
- { image: build-msvc14_1, base-image: "cppalliance/dronevs2017:1" }
- { image: build-msvc14_2, base-image: "cppalliance/dronevs2019:1" }
- { image: build-msvc14_3, base-image: "cppalliance/dronevs2022:1" }
permissions:
contents: read
packages: write
runs-on: windows-2019
defaults:
run:
@ -56,6 +94,5 @@ jobs:
- name: Build and push Docker image
run: |
FULL_IMAGE=ghcr.io/anarthal-containers/${{ matrix.image }}
if [ "${{ matrix.base-image }}" != "" ]; then BUILD_ARG="--build-arg BASE_IMAGE=${{ matrix.base-image }}"; fi
docker build -f tools/docker/${{ matrix.dockerfile }}.dockerfile $BUILD_ARG -t $FULL_IMAGE:$GITHUB_SHA -t $FULL_IMAGE:latest .
docker push $FULL_IMAGE --all-tags
docker build -f tools/docker/build-msvc.dockerfile --build-arg BASE_IMAGE=${{ matrix.base-image }} -t $FULL_IMAGE:$GITHUB_SHA -t $FULL_IMAGE:latest .
docker push $FULL_IMAGE --all-tags

View File

@ -152,6 +152,11 @@ if(BUILD_TESTING)
PUBLIC
BOOST_ASIO_SEPARATE_COMPILATION
)
target_compile_features(
boost_mysql_asio
PUBLIC
cxx_std_11
)
# All examples require a real server to run
if (BOOST_MYSQL_INTEGRATION_TESTS)

View File

@ -267,7 +267,7 @@ def _cmake_build(
'--with-date_time',
'--with-test',
'-d0',
'cxxstd={}'.format(cxxstd),
] + (['cxxstd={}'.format(cxxstd)] if cxxstd else []) + [
'install'
])
@ -283,7 +283,7 @@ def _cmake_build(
generator,
'-DCMAKE_PREFIX_PATH={}'.format(_build_prefix_path(*cmake_prefix_path)),
'-DCMAKE_BUILD_TYPE={}'.format(build_type),
'-DCMAKE_CXX_STANDARD={}'.format(cxxstd),
] + (['-DCMAKE_CXX_STANDARD={}'.format(cxxstd)] if cxxstd else []) + [
'-DBOOST_INCLUDE_LIBRARIES=mysql',
'-DBUILD_SHARED_LIBS={}'.format(_cmake_bool(build_shared_libs)),
'-DBUILD_TESTING=ON',
@ -300,7 +300,7 @@ def _cmake_build(
'cmake',
'-DCMAKE_PREFIX_PATH={}'.format(_build_prefix_path(b2_distro, *cmake_prefix_path)),
'-DCMAKE_BUILD_TYPE={}'.format(build_type),
'-DCMAKE_CXX_STANDARD={}'.format(cxxstd),
] + (['-DCMAKE_CXX_STANDARD={}'.format(cxxstd)] if cxxstd else []) + [
'-DBOOST_MYSQL_INTEGRATION_TESTS=ON',
'-DBOOST_MYSQL_VALGRIND_TESTS={}'.format(_cmake_bool(valgrind)),
'-DBOOST_MYSQL_COVERAGE={}'.format(_cmake_bool(coverage)),

View File

@ -8,19 +8,20 @@
set -e
BK=b2
BK=cmake
IMAGE=build-gcc11
CONTAINER=builder-$IMAGE-$BK
FULL_IMAGE=ghcr.io/anarthal-containers/$IMAGE
DB=mysql8
docker start mariadb
docker start $DB
docker start $CONTAINER || docker run -dit \
--name $CONTAINER \
-v ~/workspace/mysql:/opt/boost-mysql \
-v /var/run/mysqld:/var/run/mysqld \
$FULL_IMAGE
docker network connect my-net $CONTAINER || echo "Network already connected"
docker exec $CONTAINER python /opt/boost-mysql/tools/ci.py --source-dir=/opt/boost-mysql --server-host=mysql \
docker exec $CONTAINER python /opt/boost-mysql/tools/ci.py --source-dir=/opt/boost-mysql \
--build-kind=$BK \
--build-shared-libs=1 \
--valgrind=0 \
@ -28,14 +29,14 @@ docker exec $CONTAINER python /opt/boost-mysql/tools/ci.py --source-dir=/opt/boo
--clean=0 \
--toolset=gcc \
--cxxstd=17 \
--variant=release \
--variant=debug \
--cmake-standalone-tests=1 \
--cmake-add-subdir-tests=1 \
--cmake-install-tests=1 \
--cmake-build-type=Release \
--cmake-build-type=Debug \
--stdlib=native \
--server-host=mariadb \
--db=mariadb
--server-host=$DB \
--db=$DB
if [ "$BK" == "docs" ]; then
cp -r ~/workspace/mysql/doc/html ~/workspace/boost-root/libs/mysql/doc/