cppzmq/.github/workflows/ci.yml

196 lines
5.6 KiB
YAML
Raw Normal View History

2021-07-14 01:24:42 +02:00
name: CI
on: [push, pull_request]
2021-07-14 01:24:42 +02:00
defaults:
run:
shell: bash
jobs:
2021-07-08 16:19:40 +02:00
tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
2021-07-08 16:19:40 +02:00
os: ["ubuntu-latest"]
2021-07-06 17:14:54 +02:00
cppstd: ["98", "11", "20"]
2021-07-08 13:04:31 +02:00
cc: ["gcc-10"]
2021-07-08 12:57:02 +02:00
cxx: ["g++-10"]
drafts: ["ON"]
libzmq: ["4.3.4"]
2021-07-08 12:57:02 +02:00
libzmqbuild: ["cmake"]
include:
2021-07-08 19:07:27 +02:00
# older libzmq and gcc without draft
2021-07-08 16:19:40 +02:00
- os: "ubuntu-18.04"
2021-07-08 19:07:27 +02:00
cppstd: "11"
2021-07-08 13:04:31 +02:00
cc: "gcc-7"
2021-07-08 12:57:02 +02:00
cxx: "g++-7"
2021-07-06 17:14:54 +02:00
drafts: "OFF"
2021-07-08 12:57:02 +02:00
libzmq: "4.2.0"
libzmqbuild: "pkgconfig"
2021-07-14 00:47:57 +02:00
# gcc 4.8
- os: "ubuntu-18.04"
cppstd: "11"
cc: "gcc-4.8"
cxx: "g++-4.8"
drafts: "ON"
libzmq: "4.3.4"
libzmqbuild: "cmake"
aptinstall: "gcc-4.8 g++-4.8"
# gcc 5
- os: "ubuntu-18.04"
cppstd: "11"
cc: "gcc-5"
cxx: "g++-5"
drafts: "ON"
libzmq: "4.3.4"
libzmqbuild: "cmake"
aptinstall: "gcc-5 g++-5"
2021-07-08 19:07:27 +02:00
# without draft
2021-07-08 16:19:40 +02:00
- os: "ubuntu-latest"
2021-07-08 19:07:27 +02:00
cppstd: "20"
2021-07-08 13:04:31 +02:00
cc: "gcc-10"
2021-07-08 12:57:02 +02:00
cxx: "g++-10"
drafts: "OFF"
libzmq: "4.3.4"
2021-07-08 12:57:02 +02:00
libzmqbuild: "cmake"
2021-07-15 15:21:02 +02:00
# coverage (gcc version should match gcov version)
- os: "ubuntu-latest"
cppstd: "17"
cc: "gcc-9"
cxx: "g++-9"
drafts: "ON"
libzmq: "4.3.4"
libzmqbuild: "cmake"
coverage: "-DCOVERAGE=ON"
2021-07-16 13:28:41 +02:00
aptinstall: "lcov"
2021-07-08 19:07:27 +02:00
# clang
2021-07-08 16:19:40 +02:00
- os: "ubuntu-latest"
2021-07-08 19:07:27 +02:00
cppstd: "17"
2021-07-08 16:19:40 +02:00
cc: "clang-12"
cxx: "clang++-12"
drafts: "ON"
libzmq: "4.3.4"
libzmqbuild: "cmake"
2021-07-16 13:28:41 +02:00
# macos
- os: "macos-latest"
cppstd: "17"
cc: "clang"
cxx: "clang++"
drafts: "OFF"
libzmq: "4.3.4"
libzmqbuild: false
brewinstall: "zeromq"
2021-07-14 01:24:42 +02:00
# windows
- os: "windows-2016"
cppstd: "14"
cc: "msbuild"
cxx: "msbuild"
drafts: "ON"
libzmq: "4.3.4"
libzmqbuild: "cmake"
platform: "-Ax64"
- os: "windows-latest"
cppstd: "20"
cc: "msbuild"
cxx: "msbuild"
drafts: "ON"
libzmq: "4.3.4"
libzmqbuild: "cmake"
platform: "-Ax64"
2021-07-08 19:07:27 +02:00
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
VERBOSE: 1
THREADS: 2
2021-07-14 01:24:42 +02:00
BUILDTYPE: "Debug"
2021-07-08 19:07:27 +02:00
steps:
2021-07-08 12:57:02 +02:00
- uses: actions/checkout@v2
2021-07-14 00:47:57 +02:00
- name: install_deps
2021-07-16 13:28:41 +02:00
run: |
if [ ! -z "${{ matrix.aptinstall }}" ]; then
sudo apt install -y ${{ matrix.aptinstall }}
fi
if [ ! -z "${{ matrix.brewinstall }}" ]; then
brew install ${{ matrix.brewinstall }}
fi
2021-07-14 00:47:57 +02:00
2021-07-08 19:07:27 +02:00
- name: get_libzmq
run: |
curl -L https://github.com/zeromq/libzmq/archive/v${{ matrix.libzmq }}.tar.gz \
>zeromq.tar.gz
tar -xvzf zeromq.tar.gz
- name: build_libzmq_cmake
if: ${{ matrix.libzmqbuild == 'cmake' }}
run: |
2021-07-14 12:33:50 +02:00
cmake -Hlibzmq-${{ matrix.libzmq }} -Blibzmq-build ${{ matrix.platform}} \
2021-07-08 19:07:27 +02:00
-DWITH_PERF_TOOL=OFF \
-DZMQ_BUILD_TESTS=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_DRAFTS=${{ matrix.drafts }}
2021-07-14 13:44:07 +02:00
cmake --build libzmq-build --config ${BUILDTYPE} -j ${THREADS}
2021-07-14 12:33:50 +02:00
echo "LIBZMQ=${PWD}/libzmq-build" >> ${GITHUB_ENV}
2021-07-08 19:07:27 +02:00
- name: build_libzmq_pkgconfig
if: ${{ matrix.libzmqbuild == 'pkgconfig' }}
working-directory: libzmq-${{ matrix.libzmq }}
run: |
./autogen.sh &&
2021-07-14 12:33:50 +02:00
./configure --prefix=${PWD}/libzmq-build &&
2021-07-14 13:44:07 +02:00
make -j ${THREADS}
2021-07-08 19:07:27 +02:00
make install
2021-07-14 12:33:50 +02:00
echo "LIBZMQ=${PWD}/libzmq-build" >> ${GITHUB_ENV}
2021-07-08 19:07:27 +02:00
- name: build
env:
2021-07-08 19:07:27 +02:00
CMAKE_PREFIX_PATH: ${{ env.LIBZMQ }}
run: |
2021-07-15 15:21:02 +02:00
cmake -H. -Bbuild ${{ matrix.platform}} ${{ matrix.coverage }} \
2021-07-14 01:24:42 +02:00
-DCMAKE_BUILD_TYPE=${BUILDTYPE} \
-DENABLE_DRAFTS=${{ matrix.drafts }} \
-DCMAKE_CXX_STANDARD=${{ matrix.cppstd }}
2021-07-14 13:44:07 +02:00
cmake --build build --config ${BUILDTYPE} -j ${THREADS}
2021-07-14 12:33:50 +02:00
echo "CPPZMQ=${PWD}/build" >> ${GITHUB_ENV}
2021-07-08 19:07:27 +02:00
- name: test
2021-07-14 13:55:46 +02:00
# for unknown reason no tests are found and run on windows
# could be something to do with catch_discover_tests not working?
2021-07-14 12:33:50 +02:00
run: |
cd ${{ env.CPPZMQ }}
ctest -V -C ${BUILDTYPE}
2021-07-14 13:55:46 +02:00
2021-07-08 19:07:27 +02:00
- name: demo
2021-07-14 13:11:05 +02:00
# probably need to install libzmq and cppzmq for this to work on windows
if: ${{ matrix.os == 'ubuntu*' }}
2021-07-08 19:07:27 +02:00
env:
CMAKE_PREFIX_PATH: ${{ env.LIBZMQ }}:${{ env.CPPZMQ }}
run: |
2021-07-14 12:33:50 +02:00
cd demo
cmake -H. -Bbuild ${{ matrix.platform}} \
-DCMAKE_BUILD_TYPE=${BUILDTYPE} \
-DCMAKE_CXX_STANDARD=${{ matrix.cppstd }}
2021-07-14 13:44:07 +02:00
cmake --build build --config ${BUILDTYPE}
2021-07-14 12:33:50 +02:00
cd build
2021-07-14 01:24:42 +02:00
ctest -V -C ${BUILDTYPE}
2021-07-15 15:21:02 +02:00
- name: lcov
if: ${{ matrix.coverage && success() }}
run: |
lcov --capture --directory . --output-file coverage.info
lcov --remove coverage.info -o coverage_filtered.info \
'/usr/include/*' \
'/usr/local/include/*' \
${PWD}'/tests/*' \
${PWD}'/build/*'
# to generate local html: genhtml coverage_filtered.info --output-directory .
- name: coveralls_upload
if: ${{ matrix.coverage && success() }}
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./coverage_filtered.info