Setup CI posix pipeline

Summary:
related to T13434

results: https://github.com/ksimicevic/async-mqtt5/actions/runs/7423093001/job/20199741951

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27242
This commit is contained in:
Korina Šimičević
2024-01-05 13:37:20 +01:00
parent 123e70d8fe
commit 9ada50dd66
3 changed files with 135 additions and 2 deletions

133
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,133 @@
name: CI
on: [push, pull_request]
env:
BOOST_VERSION: 1.82.0
BOOST_DIR_VER_NAME: 1_82_0
jobs:
posix:
name: "${{ matrix.toolset }} std=c++${{ matrix.cxxstd }} ${{ matrix.build-type }}"
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
include:
- toolset: g++-11
compiler: g++-11
install: g++-11
os: ubuntu-latest
container: ubuntu:22.04
cxxstd: '17'
build-type: 'Release'
cxxflags: '-Wall -Wextra'
ldflags: ''
- toolset: g++-12
compiler: g++-12
install: g++-12
os: ubuntu-latest
container: ubuntu:22.04
cxxstd: '20'
build-type: 'Release'
cxxflags: '-Wall -Wextra'
ldflags: ''
- toolset: clang++-12
compiler: clang++-12
install: clang++-12
os: ubuntu-latest
container: ubuntu:22.04
cxxstd: '17'
build-type: 'Release'
cxxflags: '-Wall -Wextra -fdeclspec'
ldflags: ''
- toolset: clang++-14-libc++-14
compiler: clang++-14
install: 'clang++-14 libc++-14-dev libc++abi-14-dev'
os: ubuntu-latest
container: ubuntu:22.04
cxxstd: '17'
build-type: 'Release'
cxxflags: '-Wall -Wextra -stdlib=libc++'
ldflags: '-lc++'
- toolset: clang++-14-libc++-14
compiler: clang++-14
install: 'clang++-14 libc++-14-dev libc++abi-14-dev'
os: ubuntu-latest
container: ubuntu:22.04
cxxstd: '20'
build-type: 'Release'
cxxflags: '-Wall -Wextra -stdlib=libc++'
ldflags: '-lc++'
- toolset: clang++-15
compiler: clang++-15
install: clang++-15
os: ubuntu-latest
container: ubuntu:22.04
cxxstd: '20'
build-type: 'Release'
cxxflags: '-Wall -Wextra -fdeclspec'
ldflags: ''
runs-on: ${{ matrix.os }}
container: ${{matrix.container}}
env:
CXXFLAGS: ${{matrix.cxxflags}} -Wall -Wextra
LDFLAGS: ${{matrix.ldflags}}
CMAKE_BUILD_PARALLEL_LEVEL: 4
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup container environment
if: matrix.container
run: |
apt-get update
apt-get -y install sudo wget tar cmake git openssl libssl-dev pkg-config
- name: Install compiler
run: sudo apt-get install -y ${{ matrix.install }}
- name: Install Boost
uses: MarkusJx/install-boost@v2.4.1
id: install-boost
with:
boost_version: 1.82.0
platform_version: 22.04
# try header only instead of using prebuilt binaries
# - name: Download Boost
# run: |
# wget https://boostorg.jfrog.io/artifactory/main/release/${{env.BOOST_VERSION}}/source/boost_${{env.BOOST_DIR_VER_NAME}}.tar.gz
# tar xzf boost_${{env.BOOST_DIR_VER_NAME}}.tar.gz
# mkdir boost
# mv boost_${{env.BOOST_DIR_VER_NAME}}/boost boost
# rm -rf boost_${{env.BOOST_DIR_VER_NAME}} boost_${{env.BOOST_DIR_VER_NAME}}.tar.gz
- name: Run CMake
run: |
cmake -S . -B build/${{matrix.compiler}} \
-DCMAKE_CXX_COMPILER="${{matrix.compiler}}" -DCMAKE_CXX_FLAGS="${{env.CXXFLAGS}}" -DCMAKE_PREFIX_PATH="build/${{matrix.compiler}}"
sudo cmake --install build/${{matrix.compiler}}
env:
BOOST_ROOT: ${{steps.install-boost.outputs.BOOST_ROOT}}
- name: Build tests
run: |
cmake -S test/unit -B test/unit/build/${{matrix.compiler}} \
-DCMAKE_CXX_COMPILER="${{matrix.compiler}}" -DCMAKE_CXX_FLAGS="${{env.CXXFLAGS}}" -DCMAKE_PREFIX_PATH="test/unit/build/${{matrix.compiler}}"
cmake --build test/unit/build/${{matrix.compiler}}
env:
BOOST_ROOT: ${{steps.install-boost.outputs.BOOST_ROOT}}
- name: Run tests
run: ctest --test-dir test/unit/build/${{matrix.compiler}} --output-on-failure --no-tests=error

View File

@ -27,7 +27,7 @@ target_include_directories(mqtt-test PRIVATE include)
target_compile_features(mqtt-test PRIVATE cxx_std_17)
target_compile_definitions(mqtt-test PRIVATE BOOST_TEST_NO_MAIN=1)
find_package(OpenSSL)
find_package(OpenSSL REQUIRED)
target_link_libraries(mqtt-test PRIVATE Async::MQTT5 OpenSSL::SSL)
add_test(NAME mqtt-test COMMAND mqtt-test)

View File

@ -101,7 +101,7 @@ BOOST_AUTO_TEST_CASE(client_functions) {
connack_props ca_props;
ca_props.visit([&tcp_client](const auto& p, auto&) -> bool {
using ptype = boost::remove_cv_ref_t<decltype(p)>;
prop::value_type_t<ptype::value> value = tcp_client.connack_property(p);
[[maybe_unused]] prop::value_type_t<ptype::value> value = tcp_client.connack_property(p);
return true;
});